mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
cmd/6g, cmd/8g: disable Duff's device on NaCl.
Native Client forbids jumps/calls to arbitrary locations and enforces a particular alignement, which makes the Duff's device ineffective. LGTM=khr R=rsc, dave, khr CC=golang-codereviews https://golang.org/cl/84400043
This commit is contained in:
parent
e25d73d7f9
commit
c6a41a3559
|
@ -1448,7 +1448,7 @@ sgen(Node *n, Node *ns, int64 w)
|
|||
gins(ACLD, N, N);
|
||||
} else {
|
||||
// normal direction
|
||||
if(q > 128) {
|
||||
if(q > 128 || (nacl && q >= 4)) {
|
||||
gconreg(movptr, q, D_CX);
|
||||
gins(AREP, N, N); // repeat
|
||||
gins(AMOVSQ, N, N); // MOVQ *(SI)+,*(DI)+
|
||||
|
|
|
@ -77,7 +77,7 @@ zerorange(Prog *p, vlong frame, vlong lo, vlong hi, uint32 *ax)
|
|||
for(i = 0; i < cnt; i += widthreg) {
|
||||
p = appendpp(p, AMOVQ, D_AX, 0, D_SP+D_INDIR, frame+lo+i);
|
||||
}
|
||||
} else if(cnt <= 128*widthreg) {
|
||||
} else if(!nacl && (cnt <= 128*widthreg)) {
|
||||
p = appendpp(p, leaptr, D_SP+D_INDIR, frame+lo, D_DI, 0);
|
||||
p = appendpp(p, ADUFFZERO, D_NONE, 0, D_ADDR, 2*(128-cnt/widthreg));
|
||||
p->to.sym = linksym(pkglookup("duffzero", runtimepkg));
|
||||
|
@ -1119,7 +1119,7 @@ clearfat(Node *nl)
|
|||
savex(D_AX, &ax, &oldax, N, types[tptr]);
|
||||
gconreg(AMOVL, 0, D_AX);
|
||||
|
||||
if(q > 128) {
|
||||
if(q > 128 || (q >= 4 && nacl)) {
|
||||
gconreg(movptr, q, D_CX);
|
||||
gins(AREP, N, N); // repeat
|
||||
gins(ASTOSQ, N, N); // STOQ AL,*(DI)+
|
||||
|
|
|
@ -1315,7 +1315,7 @@ sgen(Node *n, Node *res, int64 w)
|
|||
} else {
|
||||
gins(ACLD, N, N); // paranoia. TODO(rsc): remove?
|
||||
// normal direction
|
||||
if(q > 128) {
|
||||
if(q > 128 || (q >= 4 && nacl)) {
|
||||
gconreg(AMOVL, q, D_CX);
|
||||
gins(AREP, N, N); // repeat
|
||||
gins(AMOVSL, N, N); // MOVL *(SI)+,*(DI)+
|
||||
|
|
|
@ -75,7 +75,7 @@ zerorange(Prog *p, vlong frame, vlong lo, vlong hi, uint32 *ax)
|
|||
for(i = 0; i < cnt; i += widthreg) {
|
||||
p = appendpp(p, AMOVL, D_AX, 0, D_SP+D_INDIR, frame+lo+i);
|
||||
}
|
||||
} else if(cnt <= 128*widthreg) {
|
||||
} else if(!nacl && cnt <= 128*widthreg) {
|
||||
p = appendpp(p, ALEAL, D_SP+D_INDIR, frame+lo, D_DI, 0);
|
||||
p = appendpp(p, ADUFFZERO, D_NONE, 0, D_ADDR, 1*(128-cnt/widthreg));
|
||||
p->to.sym = linksym(pkglookup("duffzero", runtimepkg));
|
||||
|
@ -176,7 +176,7 @@ clearfat(Node *nl)
|
|||
agen(nl, &n1);
|
||||
gconreg(AMOVL, 0, D_AX);
|
||||
|
||||
if(q > 128) {
|
||||
if(q > 128 || (q >= 4 && nacl)) {
|
||||
gconreg(AMOVL, q, D_CX);
|
||||
gins(AREP, N, N); // repeat
|
||||
gins(ASTOSL, N, N); // STOL AL,*(DI)+
|
||||
|
|
Loading…
Reference in a new issue