go/src/cmd/compile/internal/gc
Josh Bleecher Snyder 165a96e281 cmd/compile: fix pos of typenames created during SSA construction
Prior to this CL, the function's position was used.
The dottype Node's position is clearly better.

I'm not thrilled about introducing a reference to
lineno in the middle of SSA construction;
I will have to remove it later.
My immediate goal is stability and correctness of positions,
though, since that aids refactoring, so this is an improvement.

An example from package io:

func (t *multiWriter) WriteString(s string) (n int, err error) {
	var p []byte // lazily initialized if/when needed
	for _, w := range t.writers {
		if sw, ok := w.(stringWriter); ok {
			n, err = sw.WriteString(s)

The w.(stringWriter) type assertion includes loading
the address of static type data for stringWriter:

LEAQ	type."".stringWriter(SB), R10

Prior to this CL, this instruction was given the line number
of the function declaration.
After this CL, this instruction is given the line number
of the type assertion itself.

Change-Id: Ifcca274b581a5a57d7e3102c4d7b7786bf307210
Reviewed-on: https://go-review.googlesource.com/38389
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-03-21 04:14:26 +00:00
..
builtin runtime: add mapassign_fast* 2017-03-13 23:43:16 +00:00
testdata cmd/compile: emit fused multiply-{add,subtract} instructions on s390x 2017-02-28 15:34:20 +00:00
alg.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00
align.go cmd/compile/internal/gc: handle recursive interfaces better 2017-03-21 01:56:25 +00:00
asm_test.go cmd/compile: emit fused multiply-{add,subtract} on ppc64x 2017-03-20 20:01:29 +00:00
bexport.go cmd/compile/internal/gc: export interface embedding information 2017-03-21 02:35:40 +00:00
bimport.go cmd/compile/internal/gc: export interface embedding information 2017-03-21 02:35:40 +00:00
bitset.go cmd/compile/internal/gc: replace Node.Ullman with Node.HasCall 2017-03-03 22:35:44 +00:00
builtin.go runtime: add mapassign_fast* 2017-03-13 23:43:16 +00:00
builtin_test.go all: use testing.GoToolPath instead of "go" 2016-08-30 22:49:11 +00:00
bv.go cmd/compile: make liveness more efficient 2017-02-03 19:41:44 +00:00
checkcfg.go cmd/compile: check labels and gotos before building SSA 2017-03-15 21:44:57 +00:00
closure.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00
const.go cmd/compile: fix misleading "truncated to int" messages 2017-03-07 19:34:22 +00:00
constFold_test.go cmd/compile: fix bad generated format strings in test 2016-08-16 14:14:51 +00:00
dcl.go cmd/compile/internal/gc: handle recursive interfaces better 2017-03-21 01:56:25 +00:00
esc.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00
export.go cmd/compile: use Fatalf for more internal errors 2017-03-14 17:58:38 +00:00
fixedbugs_test.go cmd/compile: inline convT2{I,E} when result doesn't escape 2016-09-19 02:37:08 +00:00
float_test.go cmd/compile: fix uint<->float conversion on 386 2016-08-16 17:20:11 +00:00
fmt.go cmd/compile/internal/gc: handle recursive interfaces better 2017-03-21 01:56:25 +00:00
gen.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00
global_test.go all: use testing.GoToolPath instead of "go" 2016-08-30 22:49:11 +00:00
go.go cmd/compile: remove ProgInfo tables 2017-03-20 23:29:51 +00:00
gsubr.go cmd/internal/obj: remove unneeded Addr.Node and Prog.Opt fields 2017-03-20 23:49:29 +00:00
iface_test.go cmd/compile: inline convT2{I,E} when result doesn't escape 2016-09-19 02:37:08 +00:00
init.go cmd/compile: use autogenerated position for init functions 2017-03-21 03:59:54 +00:00
inl.go cmd/compile: intrinsics for math/bits.{Len,LeadingZeros} 2017-03-16 22:53:49 +00:00
lex.go cmd/compile/internal/gc: unexport or remove global functions 2017-02-10 17:57:38 +00:00
lex_test.go cmd/compile: provide line number for cgo directive error (fix a TODO) 2017-02-02 21:24:50 +00:00
logic_test.go cmd/compile: add tests for logical simplification rewrite rules 2016-05-26 22:16:52 +00:00
main.go cmd/internal/obj: convert Debug* Link fields into bools 2017-03-20 22:08:41 +00:00
mkbuiltin.go cmd/compile: update signature of runtime.memclr* 2017-02-28 19:22:29 +00:00
mpfloat.go cmd/compile: use Fatalf for more internal errors 2017-03-14 17:58:38 +00:00
mpint.go cmd/compile: use Fatalf for more internal errors 2017-03-14 17:58:38 +00:00
noder.go cmd/compile: check for missing function body earlier 2017-03-21 04:04:46 +00:00
obj.go cmd/compile, cmd/asm: remove Link.Plists 2017-03-01 00:29:23 +00:00
opnames.go cmd/compile: check loop rescheduling with stack bound, not counter 2017-03-08 18:52:12 +00:00
order.go cmd/compile: use Fatalf for more internal errors 2017-03-14 17:58:38 +00:00
pgen.go cmd/compile: check for missing function body earlier 2017-03-21 04:04:46 +00:00
pgen_test.go cmd/compile: pack bool fields in Node, Name, Func and Type structs to bitsets 2017-03-03 21:06:03 +00:00
phi.go cmd/compile: speed up hot phi insertion code 2017-02-03 05:36:22 +00:00
plive.go cmd/compile: remove ProgInfo tables 2017-03-20 23:29:51 +00:00
racewalk.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00
range.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00
reflect.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00
reflect_test.go cmd/compile/internal/gc: use sort.Interface for reflect methods 2015-09-21 22:27:53 +00:00
select.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00
shift_test.go cmd/compile: test non-constant shifts 2016-06-01 00:06:00 +00:00
sinit.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00
sizeof_test.go cmd/compile/internal/gc: remove unneeded Type.Pos field 2017-03-21 02:44:40 +00:00
ssa.go cmd/compile: fix pos of typenames created during SSA construction 2017-03-21 04:14:26 +00:00
ssa_test.go cmd/compile/internal/gc: make tests run faster 2016-11-03 01:07:08 +00:00
subr.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00
swt.go cmd/compile: add Type.LongString and Type.ShortString 2017-03-14 01:51:56 +00:00
swt_test.go cmd/dist: copy needed packages from standard library during bootstrap 2016-10-17 15:22:11 +00:00
syntax.go cmd/compile: reduce allocs when appending to Node slices 2017-03-19 06:30:46 +00:00
timings.go cmd/compile: add compiler phase timing 2016-08-17 17:27:04 +00:00
trace.go cmd/compile/internal/gc: add runtime/trace support 2016-10-12 13:57:26 +00:00
type.go cmd/compile/internal/gc: remove unneeded Type.Pos field 2017-03-21 02:44:40 +00:00
typecheck.go cmd/compile/internal/gc: handle recursive interfaces better 2017-03-21 01:56:25 +00:00
universe.go cmd/compile/internal/gc: split SetInterface from SetFields 2017-03-20 22:00:14 +00:00
unsafe.go cmd/compile: handle unsafe builtins like universal builtins 2016-10-18 22:34:44 +00:00
util.go cmd/compile,link: generate PC-value tables with inlining information 2017-03-03 21:29:30 +00:00
walk.go cmd/compile: replace all uses of ptrto by typPtr 2017-03-19 14:29:53 +00:00