mirror of
https://github.com/golang/go
synced 2024-11-18 08:44:43 -07:00
cmd/gc: record argument size for all indirect function calls
This is required to properly unwind reflect.methodValueCall/makeFuncStub. Fixes #5954. Stats for 'go install std': 61849 total INSTCALL 24655 currently have ArgSize metadata 27278 have ArgSize metadata with this change godoc size before: 11351888, after: 11364288 R=golang-dev, rsc CC=golang-dev https://golang.org/cl/12163043
This commit is contained in:
parent
156e8b306d
commit
8679d5f2b5
@ -81,7 +81,12 @@ ginscall(Node *f, int proc)
|
||||
setmaxarg(f->type);
|
||||
|
||||
arg = -1;
|
||||
if(f->type != T && ((f->sym != S && f->sym->pkg == runtimepkg) || proc == 1 || proc == 2)) {
|
||||
// Most functions have a fixed-size argument block, so traceback uses that during unwind.
|
||||
// Not all, though: there are some variadic functions in package runtime,
|
||||
// and for those we emit call-specific metadata recorded by caller.
|
||||
// Reflect generates functions with variable argsize (see reflect.methodValueCall/makeFuncStub),
|
||||
// so we do this for all indirect calls as well.
|
||||
if(f->type != T && (f->sym == S || (f->sym != S && f->sym->pkg == runtimepkg) || proc == 1 || proc == 2)) {
|
||||
arg = f->type->argwid;
|
||||
if(proc == 1 || proc == 2)
|
||||
arg += 3*widthptr;
|
||||
|
@ -79,7 +79,12 @@ ginscall(Node *f, int proc)
|
||||
setmaxarg(f->type);
|
||||
|
||||
arg = -1;
|
||||
if(f->type != T && ((f->sym != S && f->sym->pkg == runtimepkg) || proc == 1 || proc == 2)) {
|
||||
// Most functions have a fixed-size argument block, so traceback uses that during unwind.
|
||||
// Not all, though: there are some variadic functions in package runtime,
|
||||
// and for those we emit call-specific metadata recorded by caller.
|
||||
// Reflect generates functions with variable argsize (see reflect.methodValueCall/makeFuncStub),
|
||||
// so we do this for all indirect calls as well.
|
||||
if(f->type != T && (f->sym == S || (f->sym != S && f->sym->pkg == runtimepkg) || proc == 1 || proc == 2)) {
|
||||
arg = f->type->argwid;
|
||||
if(proc == 1 || proc == 2)
|
||||
arg += 2*widthptr;
|
||||
|
@ -123,7 +123,12 @@ ginscall(Node *f, int proc)
|
||||
setmaxarg(f->type);
|
||||
|
||||
arg = -1;
|
||||
if(f->type != T && ((f->sym != S && f->sym->pkg == runtimepkg) || proc == 1 || proc == 2)) {
|
||||
// Most functions have a fixed-size argument block, so traceback uses that during unwind.
|
||||
// Not all, though: there are some variadic functions in package runtime,
|
||||
// and for those we emit call-specific metadata recorded by caller.
|
||||
// Reflect generates functions with variable argsize (see reflect.methodValueCall/makeFuncStub),
|
||||
// so we do this for all indirect calls as well.
|
||||
if(f->type != T && (f->sym == S || (f->sym != S && f->sym->pkg == runtimepkg) || proc == 1 || proc == 2)) {
|
||||
arg = f->type->argwid;
|
||||
if(proc == 1 || proc == 2)
|
||||
arg += 2*widthptr;
|
||||
|
@ -5,6 +5,7 @@
|
||||
// makeFuncStub is the code half of the function returned by MakeFunc.
|
||||
// See the comment on the declaration of makeFuncStub in makefunc.go
|
||||
// for more details.
|
||||
// No argsize here, gc generates argsize info at call site.
|
||||
TEXT ·makeFuncStub(SB),7,$8
|
||||
MOVL DX, 0(SP)
|
||||
LEAL argframe+0(FP), CX
|
||||
@ -15,6 +16,7 @@ TEXT ·makeFuncStub(SB),7,$8
|
||||
// methodValueCall is the code half of the function returned by makeMethodValue.
|
||||
// See the comment on the declaration of methodValueCall in makefunc.go
|
||||
// for more details.
|
||||
// No argsize here, gc generates argsize info at call site.
|
||||
TEXT ·methodValueCall(SB),7,$8
|
||||
MOVL DX, 0(SP)
|
||||
LEAL argframe+0(FP), CX
|
||||
|
@ -5,6 +5,7 @@
|
||||
// makeFuncStub is the code half of the function returned by MakeFunc.
|
||||
// See the comment on the declaration of makeFuncStub in makefunc.go
|
||||
// for more details.
|
||||
// No argsize here, gc generates argsize info at call site.
|
||||
TEXT ·makeFuncStub(SB),7,$16
|
||||
MOVQ DX, 0(SP)
|
||||
LEAQ argframe+0(FP), CX
|
||||
@ -15,6 +16,7 @@ TEXT ·makeFuncStub(SB),7,$16
|
||||
// methodValueCall is the code half of the function returned by makeMethodValue.
|
||||
// See the comment on the declaration of methodValueCall in makefunc.go
|
||||
// for more details.
|
||||
// No argsize here, gc generates argsize info at call site.
|
||||
TEXT ·methodValueCall(SB),7,$16
|
||||
MOVQ DX, 0(SP)
|
||||
LEAQ argframe+0(FP), CX
|
||||
|
@ -5,6 +5,7 @@
|
||||
// makeFuncStub is jumped to by the code generated by MakeFunc.
|
||||
// See the comment on the declaration of makeFuncStub in makefunc.go
|
||||
// for more details.
|
||||
// No argsize here, gc generates argsize info at call site.
|
||||
TEXT ·makeFuncStub(SB),7,$8
|
||||
MOVW R7, 4(R13)
|
||||
MOVW $argframe+0(FP), R1
|
||||
@ -15,6 +16,7 @@ TEXT ·makeFuncStub(SB),7,$8
|
||||
// methodValueCall is the code half of the function returned by makeMethodValue.
|
||||
// See the comment on the declaration of methodValueCall in makefunc.go
|
||||
// for more details.
|
||||
// No argsize here, gc generates argsize info at call site.
|
||||
TEXT ·methodValueCall(SB),7,$8
|
||||
MOVW R7, 4(R13)
|
||||
MOVW $argframe+0(FP), R1
|
||||
|
@ -102,7 +102,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
|
||||
// Most functions have a fixed-size argument block,
|
||||
// so we can use metadata about the function f.
|
||||
// Not all, though: there are some variadic functions
|
||||
// in package runtime, and for those we use call-specific
|
||||
// in package runtime and reflect, and for those we use call-specific
|
||||
// metadata recorded by f's caller.
|
||||
if(callback != nil || printing) {
|
||||
frame.argp = (byte*)frame.fp + sizeof(uintptr);
|
||||
|
@ -118,7 +118,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
|
||||
// Most functions have a fixed-size argument block,
|
||||
// so we can use metadata about the function f.
|
||||
// Not all, though: there are some variadic functions
|
||||
// in package runtime, and for those we use call-specific
|
||||
// in package runtime and reflect, and for those we use call-specific
|
||||
// metadata recorded by f's caller.
|
||||
if(callback != nil || printing) {
|
||||
frame.argp = (byte*)frame.fp;
|
||||
|
Loading…
Reference in New Issue
Block a user