• Cherry Zhang's avatar
    [dev.ssa] cmd/compile: fix argument size of runtime call in SSA for ARM · 6adb97bd
    Cherry Zhang authored
    The argument size for runtime call was incorrectly includes the size
    of LR (FixedFrameSize in general). This makes the stack frame
    sometimes unnecessarily 4 bytes larger on ARM.
    For example,
    	func f(b []byte) byte { return b[0] }
    compiles to
    	0x0000 00000 (h.go:6)	TEXT	"".f(SB), $4-16 // <-- framesize = 4
    	0x0000 00000 (h.go:6)	MOVW	8(g), R1
    	0x0004 00004 (h.go:6)	CMP	R1, R13
    	0x0008 00008 (h.go:6)	BLS	52
    	0x000c 00012 (h.go:6)	MOVW.W	R14, -8(R13)
    	0x0010 00016 (h.go:6)	FUNCDATA	$0, gclocals·8355ad952265fec823c17fcf739bd009(SB)
    	0x0010 00016 (h.go:6)	FUNCDATA	$1, gclocals·69c1753bd5f81501d95132d08af04464(SB)
    	0x0010 00016 (h.go:6)	MOVW	"".b+4(FP), R0
    	0x0014 00020 (h.go:6)	CMP	$0, R0
    	0x0018 00024 (h.go:6)	BLS	44
    	0x001c 00028 (h.go:6)	MOVW	"".b(FP), R0
    	0x0020 00032 (h.go:6)	MOVBU	(R0), R0
    	0x0024 00036 (h.go:6)	MOVB	R0, "".~r1+12(FP)
    	0x0028 00040 (h.go:6)	MOVW.P	8(R13), R15
    	0x002c 00044 (h.go:6)	PCDATA	$0, $1
    	0x002c 00044 (h.go:6)	CALL	runtime.panicindex(SB)
    	0x0030 00048 (h.go:6)	UNDEF
    	0x0034 00052 (h.go:6)	NOP
    	0x0034 00052 (h.go:6)	MOVW	R14, R3
    	0x0038 00056 (h.go:6)	CALL	runtime.morestack_noctxt(SB)
    	0x003c 00060 (h.go:6)	JMP	0
    
    Note that the frame size is 4, but there is actually no local. It
    incorrectly thinks call to runtime.panicindex needs 4 bytes space
    for argument.
    
    This CL fixes it.
    
    Updates #15365.
    
    Change-Id: Ic65d55283a6aa8a7861d7a3fbc7b63c35785eeec
    Reviewed-on: https://go-review.googlesource.com/24909
    Run-TryBot: Cherry Zhang <cherryyz@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarDavid Chase <drchase@google.com>
    6adb97bd
Name
Last commit
Last update
..
builtin Loading commit data...
testdata Loading commit data...
alg.go Loading commit data...
align.go Loading commit data...
asm_test.go Loading commit data...
bexport.go Loading commit data...
bimport.go Loading commit data...
builtin.go Loading commit data...
builtin_test.go Loading commit data...
bv.go Loading commit data...
cgen.go Loading commit data...
closure.go Loading commit data...
const.go Loading commit data...
constFold_test.go Loading commit data...
cplx.go Loading commit data...
dcl.go Loading commit data...
esc.go Loading commit data...
export.go Loading commit data...
fixedbugs_test.go Loading commit data...
float_test.go Loading commit data...
fmt.go Loading commit data...
gen.go Loading commit data...
global_test.go Loading commit data...
go.go Loading commit data...
gsubr.go Loading commit data...
init.go Loading commit data...
inl.go Loading commit data...
lex.go Loading commit data...
lex_test.go Loading commit data...
logic_test.go Loading commit data...
magic.go Loading commit data...
main.go Loading commit data...
mkbuiltin.go Loading commit data...
mpfloat.go Loading commit data...
mpint.go Loading commit data...
obj.go Loading commit data...
opnames.go Loading commit data...
order.go Loading commit data...
parser.go Loading commit data...
pgen.go Loading commit data...
pgen_test.go Loading commit data...
plive.go Loading commit data...
popt.go Loading commit data...
racewalk.go Loading commit data...
range.go Loading commit data...
reflect.go Loading commit data...
reflect_test.go Loading commit data...
reg.go Loading commit data...
select.go Loading commit data...
shift_test.go Loading commit data...
sinit.go Loading commit data...
sizeof_test.go Loading commit data...
sparselocatephifunctions.go Loading commit data...
ssa.go Loading commit data...
ssa_test.go Loading commit data...
subr.go Loading commit data...
swt.go Loading commit data...
swt_test.go Loading commit data...
syntax.go Loading commit data...
type.go Loading commit data...
typecheck.go Loading commit data...
universe.go Loading commit data...
unsafe.go Loading commit data...
util.go Loading commit data...
walk.go Loading commit data...