]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: optimize non-empty-interface type conversions
authorKeith Randall <khr@golang.org>
Wed, 4 Jan 2017 00:15:38 +0000 (16:15 -0800)
committerKeith Randall <khr@golang.org>
Mon, 13 Feb 2017 18:16:31 +0000 (18:16 +0000)
commit5a75d6a08ebb727c0e2bf5c8fbcbc104d260d302
tree7fa0fe7218a250e9636b7bcbb487a8cd8e765907
parentee2f5fafd88b5ce1404fa40e3645a409e9630897
cmd/compile: optimize non-empty-interface type conversions

When doing i.(T) for non-empty-interface i and concrete type T,
there's no need to read the type out of the itab. Just compare the
itab to the itab we expect for that interface/type pair.

Also optimize type switches by putting the type hash of the
concrete type in the itab. That way we don't need to load the
type pointer out of the itab.

Update #18492

Change-Id: I49e280a21e5687e771db5b8a56b685291ac168ce
Reviewed-on: https://go-review.googlesource.com/34810
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/gc/builtin.go
src/cmd/compile/internal/gc/builtin/runtime.go
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/pgen.go
src/cmd/compile/internal/gc/reflect.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/swt.go
src/runtime/iface.go
src/runtime/plugin.go
src/runtime/runtime2.go