From: Matthew Dempsky Date: Mon, 7 Dec 2015 10:12:12 +0000 (-0800) Subject: cmd/compile: base mapaccess optimizations on algtype X-Git-Tag: go1.6beta1~163 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=423b0cc25ad8f75825db70a370ea9b696a17074d;p=gostls13.git cmd/compile: base mapaccess optimizations on algtype algtype already controls the behavior of the normal map access code paths, so it makes sense to base the decision on which optimized paths are applicable on it too. Enables use of optimized paths for key types like [8]byte and struct{s string}. Fixes #13271. Change-Id: I48c52d97abaa7259ad5aba9641ea996a967cd359 Reviewed-on: https://go-review.googlesource.com/17464 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index 9051be0eeb..efc42fc02c 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -787,14 +787,12 @@ opswitch: t := r.Left.Type p := "" if t.Type.Width <= 128 { // Check ../../runtime/hashmap.go:maxValueSize before changing. - switch Simsimtype(t.Down) { - case TINT32, TUINT32: + switch algtype(t.Down) { + case AMEM32: p = "mapaccess2_fast32" - - case TINT64, TUINT64: + case AMEM64: p = "mapaccess2_fast64" - - case TSTRING: + case ASTRING: p = "mapaccess2_faststr" } } @@ -1203,14 +1201,12 @@ opswitch: t := n.Left.Type p := "" if t.Type.Width <= 128 { // Check ../../runtime/hashmap.go:maxValueSize before changing. - switch Simsimtype(t.Down) { - case TINT32, TUINT32: + switch algtype(t.Down) { + case AMEM32: p = "mapaccess1_fast32" - - case TINT64, TUINT64: + case AMEM64: p = "mapaccess1_fast64" - - case TSTRING: + case ASTRING: p = "mapaccess1_faststr" } }