mirror of
https://github.com/golang/go
synced 2024-11-21 21:14:47 -07:00
5l: two stack split bugs in one day
An ARM expert could probably phrase the comparison in fewer instructions, but this works. R=ken2 CC=golang-dev https://golang.org/cl/2620041
This commit is contained in:
parent
10b53867e8
commit
231fcea7e6
@ -37,6 +37,7 @@
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
StackBig = 4096,
|
StackBig = 4096,
|
||||||
|
StackSmall = 128,
|
||||||
};
|
};
|
||||||
|
|
||||||
static Sym* sym_div;
|
static Sym* sym_div;
|
||||||
@ -296,7 +297,7 @@ noops(void)
|
|||||||
// TODO(kaib): add more trampolines
|
// TODO(kaib): add more trampolines
|
||||||
// TODO(kaib): put stackguard in register
|
// TODO(kaib): put stackguard in register
|
||||||
// TODO(kaib): add support for -K and underflow detection
|
// TODO(kaib): add support for -K and underflow detection
|
||||||
|
|
||||||
// MOVW g_stackguard(g), R1
|
// MOVW g_stackguard(g), R1
|
||||||
p = appendp(p);
|
p = appendp(p);
|
||||||
p->as = AMOVW;
|
p->as = AMOVW;
|
||||||
@ -304,14 +305,31 @@ noops(void)
|
|||||||
p->from.reg = REGG;
|
p->from.reg = REGG;
|
||||||
p->to.type = D_REG;
|
p->to.type = D_REG;
|
||||||
p->to.reg = 1;
|
p->to.reg = 1;
|
||||||
|
|
||||||
// CMP R1, $-autosize(SP)
|
if(autosize < StackSmall) {
|
||||||
p = appendp(p);
|
// CMP R1, SP
|
||||||
p->as = ACMP;
|
p = appendp(p);
|
||||||
p->from.type = D_REG;
|
p->as = ACMP;
|
||||||
p->from.reg = 1;
|
p->from.type = D_REG;
|
||||||
p->from.offset = -autosize;
|
p->from.reg = 1;
|
||||||
p->reg = REGSP;
|
p->reg = REGSP;
|
||||||
|
} else {
|
||||||
|
// MOVW $-autosize(SP), R2
|
||||||
|
// CMP R1, R2
|
||||||
|
p = appendp(p);
|
||||||
|
p->as = AMOVW;
|
||||||
|
p->from.type = D_CONST;
|
||||||
|
p->from.reg = REGSP;
|
||||||
|
p->from.offset = -autosize;
|
||||||
|
p->to.type = D_REG;
|
||||||
|
p->to.reg = 2;
|
||||||
|
|
||||||
|
p = appendp(p);
|
||||||
|
p->as = ACMP;
|
||||||
|
p->from.type = D_REG;
|
||||||
|
p->from.reg = 1;
|
||||||
|
p->reg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
// MOVW.LO $autosize, R1
|
// MOVW.LO $autosize, R1
|
||||||
p = appendp(p);
|
p = appendp(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user