go/src/cmd/compile/internal/gc
Than McIntosh fed33d76bc cmd/compile: delay inlinable method compilation for -c=1
When the concurrent back end is not enabled, it is possible to have a
scenario where: we compile a specific inlinable non-pointer-receiver
method T.M, then at some point later on in the compilation we visit a
type that triggers generation of a pointer-receiver wrapper (*T).M,
which then results in an inline of T.M into (*T).M. This introduces
subtle differences in the DWARF as compared with when the concurrent
back end is enabled (in the concurrent case, by the time we run the
SSA back end on T.M is is marked as being inlined, whereas in the
non-current case it is not marked inlined).

As a fix, at the point where we would normally compile a given
function in the xtop list right away, if the function is a method AND
is inlinable AND hasn't been inlined, then delay its compilation until
compileFunctions (so as to make sure that when we do compile it, all
possible inlining has been complete). In addition, make sure that
the abstract function symbol for the inlined function gets recorded
correctly.

Fixes #38068.

Change-Id: I57410ab5658bd4ee5b4b80750518e9b20fd6ba52
Reviewed-on: https://go-review.googlesource.com/c/go/+/234178
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2020-05-21 14:45:26 +00:00
..
builtin cmd/compile: optimize make+copy pattern to avoid memclr 2020-05-07 17:50:24 +00:00
testdata all: fix incorrect channel and API usage in some unit tests 2020-02-27 19:04:17 +00:00
alg.go cmd/compile: eliminate some array equality alg loops 2020-04-27 17:34:32 +00:00
algkind_string.go cmd/compile: make AlgKind a stringer 2020-04-16 03:19:50 +00:00
align.go cmd/compile: clean up slice and string offsets/sizes 2020-04-09 01:16:43 +00:00
bench_test.go cmd/compile: add indexed memory modification ops to amd64 2020-04-30 17:21:31 +00:00
bexport.go all: fix a bunch of misspellings 2019-11-15 21:04:43 +00:00
bimport.go cmd/compile: report more precise errors about untyped constants 2019-09-09 22:12:15 +00:00
bitset.go cmd/compile: inline calls to local closures 2017-10-11 22:32:36 +00:00
bootstrap.go cmd/compile: add mutex profiling support 2017-04-05 22:10:54 +00:00
builtin.go cmd/compile: optimize make+copy pattern to avoid memclr 2020-05-07 17:50:24 +00:00
builtin_test.go cmd/compile: mark a few more tests as parallel 2019-05-13 20:36:21 +00:00
bv.go cmd/compile: use math/bits for bvec 2020-04-09 01:14:53 +00:00
class_string.go cmd/compile: remove PDISCARD class 2019-10-13 01:47:43 +00:00
closure.go cmd/compile: more precise analysis of method values 2020-04-21 20:49:34 +00:00
const.go cmd/compile: remove guard for OCOMPLEX in evconst 2020-03-11 20:17:30 +00:00
constFold_test.go cmd/compile: use std "DO NOT EDIT" comment for generated files 2017-03-31 18:50:40 +00:00
dcl.go cmd/compile: remove totype0 type-constructor helpers 2020-04-16 22:06:45 +00:00
dep_test.go cmd/compile/internal/gc: use GoToolPath in TestDeps 2019-09-03 19:54:33 +00:00
dump.go all: clean up code with token.IsExported 2019-04-16 14:43:48 +00:00
dwinl.go cmd/compile: use existing instructions instead of nops for inline marks 2019-03-25 16:49:29 +00:00
esc.go cmd/compile: restore more missing -m=2 escape analysis details 2019-11-07 21:59:16 +00:00
escape.go cmd/compile: use fixVariadicCall in escape analysis 2020-04-23 22:02:12 +00:00
export.go cmd/compile: change size diagnostic to use benchmark format 2019-10-03 20:43:01 +00:00
fixedbugs_test.go cmd/compile: move Issue 16214 test, delete asm_test file 2018-04-16 11:51:56 +00:00
float_test.go cmd/compile: don't allow NaNs in floating-point constant ops 2020-03-04 04:49:54 +00:00
fmt.go cmd/compile: optimize make+copy pattern to avoid memclr 2020-05-07 17:50:24 +00:00
gen.go cmd/compile: remove tempname usages 2019-09-06 16:59:11 +00:00
global_test.go cmd/compile: mark a few more tests as parallel 2019-05-13 20:36:21 +00:00
go.go cmd/compile: remove nil check for p in isReflectPkg 2020-04-20 05:15:24 +00:00
gsubr.go cmd/compile,runtime: stack maps only at calls, remove register maps 2020-04-29 21:29:21 +00:00
iexport.go [dev.link] cmd/internal/goobj2: add index fingerprint to object file 2020-04-24 17:47:14 +00:00
iface_test.go cmd/compile: inline convT2{I,E} when result doesn't escape 2016-09-19 02:37:08 +00:00
iimport.go cmd/compile: use ReadFull to read fingerprint 2020-05-05 18:32:35 +00:00
init.go cmd/compile: skip empty init function in fninit 2019-10-18 12:04:04 +00:00
initorder.go cmd/compile: use Node.Right for OAS2* nodes (cleanup) 2019-09-28 05:04:49 +00:00
inl.go cmd/compile: refactor detecting package reflect logic 2020-04-20 02:39:16 +00:00
inl_test.go cmd/compile: update TestIntendedInlining for riscv64 2020-04-13 17:29:23 +00:00
lang_test.go cmd/compile: correct check for valid -lang version 2018-11-13 00:08:32 +00:00
lex.go cmd/compile: detect and diagnose invalid //go: directive placement 2020-04-21 16:47:01 +00:00
lex_test.go all: fix incorrect channel and API usage in some unit tests 2020-02-27 19:04:17 +00:00
logic_test.go cmd/compile: add tests for logical simplification rewrite rules 2016-05-26 22:16:52 +00:00
main.go [dev.link] cmd/internal/goobj2: add index fingerprint to object file 2020-04-24 17:47:14 +00:00
mapfile_mmap.go cmd/compile: add indexed export format 2018-04-24 01:05:27 +00:00
mapfile_read.go cmd/compile: add indexed export format 2018-04-24 01:05:27 +00:00
mkbuiltin.go cmd/compile: factor out Pkg, Sym, and Type into package types 2017-04-07 03:04:00 +00:00
mpfloat.go cmd/compile: resolve TODO of Mpflt.SetString 2019-10-30 04:55:05 +00:00
mpint.go cmd/compile: don't report redundant error for invalid integer literals 2019-03-12 22:59:12 +00:00
noder.go cmd/compile: omit file:pos for non-existent errors 2020-05-08 20:28:57 +00:00
obj.go cmd/compile: delete gdata 2020-04-20 15:37:49 +00:00
op_string.go cmd/compile: optimize make+copy pattern to avoid memclr 2020-05-07 17:50:24 +00:00
order.go cmd/compile: optimize make+copy pattern to avoid memclr 2020-05-07 17:50:24 +00:00
pgen.go cmd/compile: delay inlinable method compilation for -c=1 2020-05-21 14:45:26 +00:00
pgen_test.go cmd/compile: merge TPTR32 and TPTR64 as TPTR 2018-10-04 04:08:08 +00:00
phi.go all: update comment URLs from HTTP to HTTPS, where possible 2018-06-01 21:52:00 +00:00
plive.go cmd/compile,runtime: stack maps only at calls, remove register maps 2020-04-29 21:29:21 +00:00
pprof.go cmd/compile: add mutex profiling support 2017-04-05 22:10:54 +00:00
racewalk.go cmd,runtime: enable race detector on arm64 2018-11-13 16:57:22 +00:00
range.go all: fix a bunch of misspellings 2019-11-15 21:04:43 +00:00
reflect.go cmd/compile, cmd/link, runtime: make defers low-cost through inline code and extra funcdata 2019-10-24 13:54:11 +00:00
reproduciblebuilds_test.go cmd/compile: make duplicate anonymous interface output deterministic 2019-07-02 13:52:21 +00:00
scc.go cmd/compile: more precise analysis of method values 2020-04-21 20:49:34 +00:00
scope.go cmd/compile: remove large intermediate slice from gc.scopePCs 2019-05-13 15:52:36 +00:00
scope_test.go cmd/compile: assign correct declaration line to DIE of captured vars 2020-02-24 20:00:38 +00:00
select.go cmd/compile: use Node.Right for OAS2* nodes (cleanup) 2019-09-28 05:04:49 +00:00
shift_test.go cmd/compile: test non-constant shifts 2016-06-01 00:06:00 +00:00
sinit.go cmd/compile: do not emit code for discardable blank fields 2020-05-06 04:34:54 +00:00
sizeof_test.go cmd/compile, cmd/link, runtime: make defers low-cost through inline code and extra funcdata 2019-10-24 13:54:11 +00:00
ssa.go cmd/compile: don't emit stack maps for write barrier calls 2020-04-29 21:29:18 +00:00
ssa_test.go cmd/compile: move last compile tests to new test infrastructure 2018-08-24 22:59:12 +00:00
subr.go cmd/compile: omit file:pos for non-existent errors 2020-05-08 20:28:57 +00:00
swt.go cmd/compile: make type switch case positions consistent 2020-04-14 17:44:16 +00:00
syntax.go cmd/compile: optimize make+copy pattern to avoid memclr 2020-05-07 17:50:24 +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
truncconst_test.go cmd/compile: diagnose constant division by complex zero 2017-04-12 17:29:28 +00:00
typecheck.go cmd/compile: improve error when setting unexported fields 2020-05-08 20:44:01 +00:00
types.go cmd/compile: remove vestigial TDDDFIELD 2019-09-09 23:17:01 +00:00
types_acc.go cmd/compile: factor out Pkg, Sym, and Type into package types 2017-04-07 03:04:00 +00:00
universe.go cmd/compile: clean up slice and string offsets/sizes 2020-04-09 01:16:43 +00:00
unsafe.go cmd/compile: bulk rename 2018-11-19 00:02:53 +00:00
util.go cmd/compile: add mutex profiling support 2017-04-05 22:10:54 +00:00
walk.go cmd/compile: optimize make+copy pattern to avoid memclr 2020-05-07 17:50:24 +00:00
zerorange_test.go cmd/compile: add an explicit test for compile of arch.ZeroRange 2019-10-02 17:24:11 +00:00