]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/5g, cmd/6g, cmd/8g: provide embedded trampolines with argument size information
authorCarl Shapiro <cshapiro@google.com>
Fri, 31 May 2013 20:34:57 +0000 (13:34 -0700)
committerCarl Shapiro <cshapiro@google.com>
Fri, 31 May 2013 20:34:57 +0000 (13:34 -0700)
An embedded trampoline is a function that exists to marshal
a receiver of type *S to a receiver of type *T when T is an
embedded field in S.

Embedded trampolines are generated by a special path through
the compiler and are not subject to the general analysis and
annotation done to functions.  Their effects must be provided
explicitly.

R=golang-dev, r, daniel.morsing, minux.ma
CC=golang-dev
https://golang.org/cl/9874043

src/cmd/5g/gobj.c
src/cmd/6g/gobj.c
src/cmd/8g/gobj.c

index 9c5fb2a962af91ec93a57c160b2c588fa174f92a..3bdb3268a4f886d86a5e3e9ef2bab08788872656 100644 (file)
@@ -548,8 +548,9 @@ out:
        p->from.name = D_EXTERN;
        p->from.sym = newnam;
        p->to.type = D_CONST2;
-       p->reg = 7;
-       p->to.offset2 = 0;
+       p->to.offset = 0;  // stack size
+       p->to.offset2 = rnd(method->type->argwid, widthptr);  // argument size
+       p->reg = 7;  // textflag
        p->to.reg = NREG;
 //print("1. %P\n", p);
 
index cdbbd5d9db0938eef4c529673efdefcff040aca9..c7e87f1c811a2805ea615f8034ced7605881df7e 100644 (file)
@@ -528,8 +528,9 @@ out:
        p->from.type = D_EXTERN;
        p->from.sym = newnam;
        p->to.type = D_CONST;
-       p->to.offset = 0;
-       p->from.scale = 7;
+       p->to.offset = 0; // stack size
+       p->to.offset |= rnd(method->type->argwid, widthptr) << 32;  // argument size
+       p->from.scale = 7;  // textflag
 //print("1. %P\n", p);
 
        mov = AMOVQ;
index 39717d5b1ace82ea47b372be4bac025a03919e42..f695468cdf201f86df4604de20abdb56f10015b6 100644 (file)
@@ -534,8 +534,9 @@ out:
        p->from.type = D_EXTERN;
        p->from.sym = newnam;
        p->to.type = D_CONST;
-       p->to.offset = 0;
-       p->from.scale = 7;
+       p->to.offset = 0;  // stack skize
+       p->to.offset2 = rnd(method->type->argwid, widthptr);  // argument size
+       p->from.scale = 7;  // textflag
 //print("1. %P\n", p);
 
        mov = AMOVL;