1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:14:46 -07:00

liblink: use same TEXT $frame-arg encoding for all architectures

Change-Id: I3417a8c5ddd7f405939edc9fdef086e4741495a1
Reviewed-on: https://go-review.googlesource.com/3571
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Russ Cox 2015-01-29 12:26:21 -05:00
parent a293c7e68f
commit 72521319c7
25 changed files with 2114 additions and 2063 deletions

View File

@ -62,7 +62,7 @@
%token <sym> LNAME LLAB LVAR
%type <lval> con expr oexpr pointer offset sreg spreg creg
%type <lval> rcon cond reglist
%type <addr> gen rel reg regreg freg shift fcon frcon
%type <addr> gen rel reg regreg freg shift fcon frcon textsize
%type <addr> imm ximm name oreg ireg nireg ioreg imsr
%%
prog:
@ -212,26 +212,15 @@ inst:
/*
* TEXT
*/
| LTYPEB name ',' imm
| LTYPEB name ',' '$' textsize
{
settext($2.sym);
$4.type = TYPE_TEXTSIZE;
$4.u.argsize = ArgsSizeUnknown;
outcode($1, Always, &$2, 0, &$4);
outcode($1, Always, &$2, 0, &$5);
}
| LTYPEB name ',' con ',' imm
| LTYPEB name ',' con ',' '$' textsize
{
settext($2.sym);
$6.type = TYPE_TEXTSIZE;
$6.u.argsize = ArgsSizeUnknown;
outcode($1, Always, &$2, $4, &$6);
}
| LTYPEB name ',' con ',' imm '-' con
{
settext($2.sym);
$6.type = TYPE_TEXTSIZE;
$6.u.argsize = $8;
outcode($1, Always, &$2, $4, &$6);
outcode($1, Always, &$2, $4, &$7);
}
/*
* GLOBL
@ -393,6 +382,32 @@ rel:
$$.offset = $1->value + $2;
}
textsize:
LCONST
{
$$.type = TYPE_TEXTSIZE;
$$.offset = $1;
$$.u.argsize = ArgsSizeUnknown;
}
| '-' LCONST
{
$$.type = TYPE_TEXTSIZE;
$$.offset = -$2;
$$.u.argsize = ArgsSizeUnknown;
}
| LCONST '-' LCONST
{
$$.type = TYPE_TEXTSIZE;
$$.offset = $1;
$$.u.argsize = $3;
}
| '-' LCONST '-' LCONST
{
$$.type = TYPE_TEXTSIZE;
$$.offset = -$2;
$$.u.argsize = $4;
}
ximm: '$' con
{
$$ = nullgen;

File diff suppressed because it is too large Load Diff

View File

@ -21,12 +21,10 @@ defframe(Prog *ptxt)
NodeList *l;
Node *n;
// fill in argument size
// fill in argument size, stack size
ptxt->to.type = TYPE_TEXTSIZE;
ptxt->to.u.argsize = rnd(curfn->type->argwid, widthptr);
// fill in final stack size
frame = rnd(stksize+maxarg, widthptr);
frame = rnd(stksize+maxarg, widthreg);
ptxt->to.offset = frame;
// insert code to contain ambiguously live variables

View File

@ -149,6 +149,7 @@ enum
C_HREG,
C_ADDR, /* reference to relocatable address */
C_TEXTSIZE,
C_GOK,

View File

@ -57,8 +57,8 @@
%token <dval> LFCONST
%token <sval> LSCONST LSP
%token <sym> LNAME LLAB LVAR
%type <lval> con con2 expr pointer offset
%type <addr> mem imm imm2 reg nam rel rem rim rom omem nmem
%type <lval> con expr pointer offset
%type <addr> mem imm reg nam rel rem rim rom omem nmem textsize
%type <addr2> nonnon nonrel nonrem rimnon rimrem remrim
%type <addr2> spec1 spec2 spec3 spec4 spec5 spec6 spec7 spec8 spec9
%type <addr2> spec10 spec11 spec12 spec13
@ -191,18 +191,18 @@ spec1: /* DATA */
}
spec2: /* TEXT */
mem ',' imm2
mem ',' '$' textsize
{
settext($1.sym);
$$.from = $1;
$$.to = $3;
$$.to = $4;
}
| mem ',' con ',' imm2
| mem ',' con ',' '$' textsize
{
settext($1.sym);
$$.from = $1;
$$.from.scale = $3;
$$.to = $5;
$$.to = $6;
}
spec3: /* JMP/CALL */
@ -412,13 +412,6 @@ reg:
$$.type = TYPE_REG;
$$.reg = $1;
}
imm2:
'$' con2
{
$$ = nullgen;
$$.type = TYPE_CONST;
$$.offset = $2;
}
imm:
'$' con
@ -634,26 +627,30 @@ con:
$$ = $2;
}
con2:
textsize:
LCONST
{
$$ = ($1 & 0xffffffffLL) +
((vlong)ArgsSizeUnknown << 32);
$$.type = TYPE_TEXTSIZE;
$$.offset = $1;
$$.u.argsize = ArgsSizeUnknown;
}
| '-' LCONST
{
$$ = (-$2 & 0xffffffffLL) +
((vlong)ArgsSizeUnknown << 32);
$$.type = TYPE_TEXTSIZE;
$$.offset = -$2;
$$.u.argsize = ArgsSizeUnknown;
}
| LCONST '-' LCONST
{
$$ = ($1 & 0xffffffffLL) +
(($3 & 0xffffLL) << 32);
$$.type = TYPE_TEXTSIZE;
$$.offset = $1;
$$.u.argsize = $3;
}
| '-' LCONST '-' LCONST
{
$$ = (-$2 & 0xffffffffLL) +
(($4 & 0xffffLL) << 32);
$$.type = TYPE_TEXTSIZE;
$$.offset = -$2;
$$.u.argsize = $4;
}
expr:

File diff suppressed because it is too large Load Diff

View File

@ -21,13 +21,11 @@ defframe(Prog *ptxt)
NodeList *l;
Node *n;
// fill in argument size
ptxt->to.offset = rnd(curfn->type->argwid, widthptr);
// fill in final stack size
ptxt->to.offset <<= 32;
// fill in argument size, stack size
ptxt->to.type = TYPE_TEXTSIZE;
ptxt->to.u.argsize = rnd(curfn->type->argwid, widthptr);
frame = rnd(stksize+maxarg, widthreg);
ptxt->to.offset |= frame;
ptxt->to.offset = frame;
// insert code to zero ambiguously live variables
// so that the garbage collector only sees initialized values

View File

@ -38,10 +38,6 @@
%union {
Sym *sym;
int32 lval;
struct {
int32 v1;
int32 v2;
} con2;
double dval;
char sval[8];
Addr addr;
@ -61,8 +57,7 @@
%token <sval> LSCONST LSP
%token <sym> LNAME LLAB LVAR
%type <lval> con expr pointer offset
%type <con2> con2
%type <addr> mem imm imm2 reg nam rel rem rim rom omem nmem
%type <addr> mem imm reg nam rel rem rim rom omem nmem textsize
%type <addr2> nonnon nonrel nonrem rimnon rimrem remrim
%type <addr2> spec1 spec2 spec3 spec4 spec5 spec6 spec7 spec8 spec9 spec10 spec11 spec12
%%
@ -193,18 +188,18 @@ spec1: /* DATA */
}
spec2: /* TEXT */
mem ',' imm2
mem ',' '$' textsize
{
settext($1.sym);
$$.from = $1;
$$.to = $3;
$$.to = $4;
}
| mem ',' con ',' imm2
| mem ',' con ',' '$' textsize
{
settext($1.sym);
$$.from = $1;
$$.from.scale = $3;
$$.to = $5;
$$.to = $6;
}
spec3: /* JMP/CALL */
@ -453,35 +448,30 @@ imm:
$$.u.dval = -$3;
}
imm2:
'$' con2
{
$$ = nullgen;
$$.type = TYPE_TEXTSIZE;
$$.offset = $2.v1;
$$.u.argsize = $2.v2;
}
con2:
textsize:
LCONST
{
$$.v1 = $1;
$$.v2 = ArgsSizeUnknown;
$$.type = TYPE_TEXTSIZE;
$$.offset = $1;
$$.u.argsize = ArgsSizeUnknown;
}
| '-' LCONST
{
$$.v1 = -$2;
$$.v2 = ArgsSizeUnknown;
$$.type = TYPE_TEXTSIZE;
$$.offset = -$2;
$$.u.argsize = ArgsSizeUnknown;
}
| LCONST '-' LCONST
{
$$.v1 = $1;
$$.v2 = $3;
$$.type = TYPE_TEXTSIZE;
$$.offset = $1;
$$.u.argsize = $3;
}
| '-' LCONST '-' LCONST
{
$$.v1 = -$2;
$$.v2 = $4;
$$.type = TYPE_TEXTSIZE;
$$.offset = -$2;
$$.u.argsize = $4;
}
mem:

File diff suppressed because it is too large Load Diff

View File

@ -118,17 +118,13 @@ typedef union YYSTYPE
{
Sym *sym;
int32 lval;
struct {
int32 v1;
int32 v2;
} con2;
double dval;
char sval[8];
Addr addr;
Addr2 addr2;
}
/* Line 1529 of yacc.c. */
#line 132 "y.tab.h"
#line 128 "y.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1

View File

@ -21,11 +21,10 @@ defframe(Prog *ptxt)
NodeList *l;
Node *n;
// fill in argument size
// fill in argument size, stack size
ptxt->to.type = TYPE_TEXTSIZE;
ptxt->to.u.argsize = rnd(curfn->type->argwid, widthptr);
// fill in final stack size
frame = rnd(stksize+maxarg, widthptr);
frame = rnd(stksize+maxarg, widthreg);
ptxt->to.offset = frame;
// insert code to zero ambiguously live variables

View File

@ -60,7 +60,7 @@
%token <sval> LSCONST
%token <sym> LNAME LLAB LVAR
%type <lval> con expr pointer offset sreg
%type <addr> addr rreg regaddr name creg freg xlreg lr ctr
%type <addr> addr rreg regaddr name creg freg xlreg lr ctr textsize
%type <addr> imm ximm fimm rel psr lcr cbit fpscr msr mask
%%
prog:
@ -613,24 +613,15 @@ inst:
/*
* TEXT
*/
| LTEXT name ',' imm
| LTEXT name ',' '$' textsize
{
settext($2.sym);
outcode($1, &$2, 0, &$4);
outcode($1, &$2, 0, &$5);
}
| LTEXT name ',' con ',' imm
| LTEXT name ',' con ',' '$' textsize
{
settext($2.sym);
$6.offset &= 0xffffffffull;
$6.offset |= (vlong)ArgsSizeUnknown << 32;
outcode($1, &$2, $4, &$6);
}
| LTEXT name ',' con ',' imm '-' con
{
settext($2.sym);
$6.offset &= 0xffffffffull;
$6.offset |= ($8 & 0xffffffffull) << 32;
outcode($1, &$2, $4, &$6);
outcode($1, &$2, $4, &$7);
}
/*
* GLOBL
@ -812,6 +803,32 @@ mask:
$$.offset = v;
}
textsize:
LCONST
{
$$.type = TYPE_TEXTSIZE;
$$.offset = $1;
$$.u.argsize = ArgsSizeUnknown;
}
| '-' LCONST
{
$$.type = TYPE_TEXTSIZE;
$$.offset = -$2;
$$.u.argsize = ArgsSizeUnknown;
}
| LCONST '-' LCONST
{
$$.type = TYPE_TEXTSIZE;
$$.offset = $1;
$$.u.argsize = $3;
}
| '-' LCONST '-' LCONST
{
$$.type = TYPE_TEXTSIZE;
$$.offset = -$2;
$$.u.argsize = $4;
}
ximm:
'$' addr
{

File diff suppressed because it is too large Load Diff

View File

@ -21,13 +21,11 @@ defframe(Prog *ptxt)
NodeList *l;
Node *n;
// fill in argument size
ptxt->to.offset = rnd(curfn->type->argwid, widthptr);
// fill in final stack size
ptxt->to.offset <<= 32;
// fill in argument size, stack size
ptxt->to.type = TYPE_TEXTSIZE;
ptxt->to.u.argsize = rnd(curfn->type->argwid, widthptr);
frame = rnd(stksize+maxarg, widthreg);
ptxt->to.offset |= frame;
ptxt->to.offset = frame;
// insert code to zero ambiguously live variables
// so that the garbage collector only sees initialized values

View File

@ -286,6 +286,7 @@ enum
C_ANY,
C_GOK,
C_ADDR,
C_TEXTSIZE,
C_NCLASS, /* must be the last */
};

View File

@ -71,8 +71,8 @@ static Optab optab[] =
{
/* struct Optab:
OPCODE, from, prog->reg, to, type,size,param,flag */
{ ATEXT, C_ADDR, C_NONE, C_LCON, 0, 0, 0 },
{ ATEXT, C_ADDR, C_REG, C_LCON, 0, 0, 0 },
{ ATEXT, C_ADDR, C_NONE, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_ADDR, C_REG, C_TEXTSIZE, 0, 0, 0 },
{ AADD, C_REG, C_REG, C_REG, 1, 4, 0 },
{ AADD, C_REG, C_NONE, C_REG, 1, 4, 0 },
@ -1122,8 +1122,10 @@ aclass(Link *ctxt, Addr *a)
return C_SFCON;
return C_LFCON;
case TYPE_CONST:
case TYPE_TEXTSIZE:
return C_TEXTSIZE;
case TYPE_CONST:
switch(a->name) {
case TYPE_NONE:

View File

@ -113,6 +113,7 @@ enum
Ymr, Ymm,
Yxr, Yxm,
Ytls,
Ytextsize,
Ymax,
Zxxx = 0,
@ -197,7 +198,7 @@ static uchar ynone[] =
};
static uchar ytext[] =
{
Ymb, Yi64, Zpseudo,1,
Ymb, Ytextsize, Zpseudo,1,
0
};
static uchar ynop[] =
@ -1998,6 +1999,9 @@ oclass(Link *ctxt, Addr *a)
if((v>>32) == 0)
return Yi32; /* unsigned */
return Yi64;
case TYPE_TEXTSIZE:
return Ytextsize;
}
if(a->type != TYPE_REG) {

View File

@ -76,6 +76,7 @@ enum
Ym,
Ybr,
Ycol,
Ytextsize,
Ytls,
Ycs, Yss, Yds, Yes, Yfs, Ygs,
@ -150,7 +151,7 @@ static uchar ynone[] =
};
static uchar ytext[] =
{
Ymb, Yi32, Zpseudo,1,
Ymb, Ytextsize, Zpseudo,1,
0
};
static uchar ynop[] =
@ -1538,7 +1539,6 @@ oclass(Link *ctxt, Addr *a)
// fall through
case TYPE_CONST:
case TYPE_TEXTSIZE:
if(a->sym != nil)
ctxt->diag("TYPE_CONST with symbol: %D", a);
@ -1550,6 +1550,9 @@ oclass(Link *ctxt, Addr *a)
if(v >= -128 && v <= 127)
return Yi8;
return Yi32;
case TYPE_TEXTSIZE:
return Ytextsize;
}
if(a->type != TYPE_REG) {

View File

@ -59,14 +59,14 @@ struct Optab
};
static Optab optab[] = {
{ ATEXT, C_LEXT, C_NONE, C_NONE, C_LCON, 0, 0, 0 },
{ ATEXT, C_LEXT, C_REG, C_NONE, C_LCON, 0, 0, 0 },
{ ATEXT, C_LEXT, C_NONE, C_LCON, C_LCON, 0, 0, 0 },
{ ATEXT, C_LEXT, C_REG, C_LCON, C_LCON, 0, 0, 0 },
{ ATEXT, C_ADDR, C_NONE, C_NONE, C_LCON, 0, 0, 0 },
{ ATEXT, C_ADDR, C_REG, C_NONE, C_LCON, 0, 0, 0 },
{ ATEXT, C_ADDR, C_NONE, C_LCON, C_LCON, 0, 0, 0 },
{ ATEXT, C_ADDR, C_REG, C_LCON, C_LCON, 0, 0, 0 },
{ ATEXT, C_LEXT, C_NONE, C_NONE, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_LEXT, C_REG, C_NONE, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_LEXT, C_NONE, C_LCON, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_LEXT, C_REG, C_LCON, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_ADDR, C_NONE, C_NONE, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_ADDR, C_REG, C_NONE, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_ADDR, C_NONE, C_LCON, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_ADDR, C_REG, C_LCON, C_TEXTSIZE, 0, 0, 0 },
/* move register */
{ AMOVD, C_REG, C_NONE, C_NONE, C_REG, 1, 4, 0 },
@ -497,7 +497,7 @@ span9(Link *ctxt, LSym *cursym)
if(p == nil || p->link == nil) // handle external functions and ELF section symbols
return;
ctxt->cursym = cursym;
ctxt->autosize = (int32)(p->to.offset & 0xffffffffll) + 8;
ctxt->autosize = p->to.offset + 8;
if(oprange[AANDN].start == nil)
buildop(ctxt);
@ -673,6 +673,9 @@ aclass(Link *ctxt, Addr *a)
}
return C_GOK;
case TYPE_TEXTSIZE:
return C_TEXTSIZE;
case TYPE_CONST:
switch(a->name) {
case TYPE_NONE:

View File

@ -33,6 +33,7 @@
#include <bio.h>
#include <link.h>
#include "../cmd/5l/5.out.h"
#include "../runtime/funcdata.h"
enum
{
@ -163,7 +164,10 @@ Dconv(Fmt *fp)
break;
case TYPE_TEXTSIZE:
sprint(str, "$%lld-%d", a->offset, a->u.argsize);
if(a->u.argsize == ArgsSizeUnknown)
sprint(str, "$%lld", a->offset);
else
sprint(str, "$%lld-%lld", a->offset, a->u.argsize);
break;
case TYPE_SHIFT:

View File

@ -33,13 +33,13 @@
#include <bio.h>
#include <link.h>
#include "../cmd/6l/6.out.h"
#include "../runtime/funcdata.h"
//
// Format conversions
// %A int Opcodes (instruction mnemonics)
//
// %D Addr* Addresses (instruction operands)
// Flags: "%lD": seperate the high and low words of a constant by "-"
//
// %P Prog* Instructions
//
@ -91,11 +91,11 @@ Pconv(Fmt *fp)
case ATEXT:
if(p->from.scale) {
sprint(str, "%.5lld (%L) %A %D,%d,%lD",
sprint(str, "%.5lld (%L) %A %D,%d,%D",
p->pc, p->lineno, p->as, &p->from, p->from.scale, &p->to);
break;
}
sprint(str, "%.5lld (%L) %A %D,%lD",
sprint(str, "%.5lld (%L) %A %D,%D",
p->pc, p->lineno, p->as, &p->from, &p->to);
break;
@ -194,10 +194,6 @@ Dconv(Fmt *fp)
break;
case TYPE_CONST:
if(fp->flags & FmtLong) {
sprint(str, "$%lld-%lld", a->offset&0xffffffffLL, a->offset>>32);
break;
}
sprint(str, "$%lld", a->offset);
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
@ -207,6 +203,13 @@ Dconv(Fmt *fp)
strcat(str, s);
}
break;
case TYPE_TEXTSIZE:
if(a->u.argsize == ArgsSizeUnknown)
sprint(str, "$%lld", a->offset);
else
sprint(str, "$%lld-%lld", a->offset, a->u.argsize);
break;
case TYPE_FCONST:
sprint(str, "$(%.17g)", a->u.dval);

View File

@ -33,6 +33,7 @@
#include <bio.h>
#include <link.h>
#include "../cmd/8l/8.out.h"
#include "../runtime/funcdata.h"
static int Aconv(Fmt *fp);
static int Dconv(Fmt *fp);
@ -77,11 +78,11 @@ Pconv(Fmt *fp)
case ATEXT:
if(p->from.scale) {
sprint(str, "%.5lld (%L) %A %D,%d,%lD",
sprint(str, "%.5lld (%L) %A %D,%d,%D",
p->pc, p->lineno, p->as, &p->from, p->from.scale, &p->to);
break;
}
sprint(str, "%.5lld (%L) %A %D,%lD",
sprint(str, "%.5lld (%L) %A %D,%D",
p->pc, p->lineno, p->as, &p->from, &p->to);
break;
@ -198,7 +199,10 @@ Dconv(Fmt *fp)
break;
case TYPE_TEXTSIZE:
sprint(str, "$%lld-%d", a->offset, a->u.argsize);
if(a->u.argsize == ArgsSizeUnknown)
sprint(str, "$%lld", a->offset);
else
sprint(str, "$%lld-%lld", a->offset, a->u.argsize);
break;
case TYPE_FCONST:

View File

@ -32,6 +32,7 @@
#include <bio.h>
#include <link.h>
#include "../cmd/9l/9.out.h"
#include "../runtime/funcdata.h"
enum
{
@ -51,7 +52,6 @@ static int DRconv(Fmt*);
// %A int Opcodes (instruction mnemonics)
//
// %D Addr* Addresses (instruction operands)
// Flags: "%lD": seperate the high and low words of a constant by "-"
//
// %P Prog* Instructions
//
@ -97,9 +97,9 @@ Pconv(Fmt *fp)
sprint(str, "%.5lld (%L) %A %D/%d,%D", p->pc, p->lineno, a, &p->from, p->reg, &p->to);
else if(a == ATEXT) {
if(p->reg != 0)
sprint(str, "%.5lld (%L) %A %D,%d,%lD", p->pc, p->lineno, a, &p->from, p->reg, &p->to);
sprint(str, "%.5lld (%L) %A %D,%d,%D", p->pc, p->lineno, a, &p->from, p->reg, &p->to);
else
sprint(str, "%.5lld (%L) %A %D,%lD", p->pc, p->lineno, a, &p->from, &p->to);
sprint(str, "%.5lld (%L) %A %D,%D", p->pc, p->lineno, a, &p->from, &p->to);
} else if(a == AGLOBL) {
if(p->reg != 0)
sprint(str, "%.5lld (%L) %A %D,%d,%D", p->pc, p->lineno, a, &p->from, p->reg, &p->to);
@ -154,16 +154,6 @@ Dconv(Fmt *fp)
a = va_arg(fp->args, Addr*);
if(fp->flags & FmtLong) {
if(a->type == TYPE_CONST)
sprint(str, "$%d-%d", (int32)a->offset, (int32)(a->offset>>32));
else {
// ATEXT dst is not constant
sprint(str, "!!%D", a);
}
goto ret;
}
switch(a->type) {
default:
sprint(str, "GOK-type(%d)", a->type);
@ -182,6 +172,13 @@ Dconv(Fmt *fp)
sprint(str, "$%M", a);
break;
case TYPE_TEXTSIZE:
if(a->u.argsize == ArgsSizeUnknown)
sprint(str, "$%lld", a->offset);
else
sprint(str, "$%lld-%lld", a->offset, a->u.argsize);
break;
case TYPE_MEM:
if(a->reg != 0)
sprint(str, "%M(%R)", a, a->reg);
@ -222,7 +219,6 @@ Dconv(Fmt *fp)
break;
}
ret:
return fmtstrcpy(fp, str);
}

View File

@ -361,26 +361,13 @@ static Prog* load_g_cx(Link*, Prog*);
static Prog* stacksplit(Link*, Prog*, int32, int32, int, Prog**);
static void indir_cx(Link*, Addr*);
static void
parsetextconst(vlong arg, vlong *textstksiz, vlong *textarg)
{
*textstksiz = arg & 0xffffffffLL;
if(*textstksiz & 0x80000000LL)
*textstksiz = -(-*textstksiz & 0xffffffffLL);
*textarg = (arg >> 32) & 0xffffffffLL;
if(*textarg & 0x80000000LL)
*textarg = 0;
*textarg = (*textarg+7) & ~7LL;
}
static void
preprocess(Link *ctxt, LSym *cursym)
{
Prog *p, *q, *p1, *p2;
int32 autoffset, deltasp;
int a, pcsize, bpsize;
vlong textstksiz, textarg;
vlong textarg;
if(ctxt->tlsg == nil)
ctxt->tlsg = linklookup(ctxt, "runtime.tlsg", 0);
@ -398,8 +385,7 @@ preprocess(Link *ctxt, LSym *cursym)
return;
p = cursym->text;
parsetextconst(p->to.offset, &textstksiz, &textarg);
autoffset = textstksiz;
autoffset = p->to.offset;
if(autoffset < 0)
autoffset = 0;
@ -409,14 +395,14 @@ preprocess(Link *ctxt, LSym *cursym)
// another function, so in that case we omit this.
bpsize = ctxt->arch->ptrsize;
autoffset += bpsize;
textstksiz += bpsize;
p->to.offset = ((uint64)p->to.offset & (0xffffffffull<<32)) | (uint32)autoffset;
p->to.offset += bpsize;
} else {
bpsize = 0;
}
cursym->args = p->to.offset>>32;
cursym->locals = textstksiz;
textarg = p->to.u.argsize;
cursym->args = textarg;
cursym->locals = p->to.offset;
if(autoffset < StackSmall && !(p->from.scale & NOSPLIT)) {
for(q = p; q != nil; q = q->link) {

View File

@ -162,25 +162,12 @@ progedit(Link *ctxt, Prog *p)
static Prog* stacksplit(Link*, Prog*, int32, int);
static void
parsetextconst(vlong arg, vlong *textstksiz, vlong *textarg)
{
*textstksiz = arg & 0xffffffffLL;
if(*textstksiz & 0x80000000LL)
*textstksiz = -(-*textstksiz & 0xffffffffLL);
*textarg = (arg >> 32) & 0xffffffffLL;
if(*textarg & 0x80000000LL)
*textarg = 0;
*textarg = (*textarg+7) & ~7LL;
}
static void
preprocess(Link *ctxt, LSym *cursym)
{
Prog *p, *q, *p1, *p2, *q1;
int o, mov, aoffset;
vlong textstksiz, textarg;
vlong textstksiz;
int32 autosize;
if(ctxt->symmorestack[0] == nil) {
@ -195,9 +182,9 @@ preprocess(Link *ctxt, LSym *cursym)
return;
p = cursym->text;
parsetextconst(p->to.offset, &textstksiz, &textarg);
textstksiz = p->to.offset;
cursym->args = p->to.offset>>32;
cursym->args = p->to.u.argsize;
cursym->locals = textstksiz;
/*
@ -378,7 +365,7 @@ preprocess(Link *ctxt, LSym *cursym)
else
if(autosize & 4)
autosize += 4;
p->to.offset = ((uint64)p->to.offset & (0xffffffffull<<32)) | (uint32)(autosize-8);
p->to.offset = autosize-8;
if(!(p->reg & NOSPLIT))
p = stacksplit(ctxt, p, autosize, !(cursym->text->reg&NEEDCTXT)); // emit split check