mirror of
https://github.com/golang/go.git
synced 2025-05-29 11:25:43 +00:00
ifaceop was being called with integers
that came from two different enums. spilt into ifacecvt and ifaceop depending on which enum the argument is. R=ken OCL=29122 CL=29122
This commit is contained in:
parent
2da5022bcf
commit
a39bae095a
@ -909,7 +909,8 @@ Node* mapop(Node*, int);
|
|||||||
Type* fixchan(Type*);
|
Type* fixchan(Type*);
|
||||||
Node* chanop(Node*, int);
|
Node* chanop(Node*, int);
|
||||||
Node* arrayop(Node*, int);
|
Node* arrayop(Node*, int);
|
||||||
Node* ifaceop(Type*, Node*, int);
|
Node* ifacecvt(Type*, Node*, int);
|
||||||
|
Node* ifaceop(Node*);
|
||||||
int ifaceas(Type*, Type*, int);
|
int ifaceas(Type*, Type*, int);
|
||||||
int ifaceas1(Type*, Type*, int);
|
int ifaceas1(Type*, Type*, int);
|
||||||
void ifacecheck(Type*, Type*, int, int);
|
void ifacecheck(Type*, Type*, int, int);
|
||||||
@ -1063,3 +1064,5 @@ int duint32(Sym *s, int off, uint32 v);
|
|||||||
int duintptr(Sym *s, int off, uint32 v);
|
int duintptr(Sym *s, int off, uint32 v);
|
||||||
int duintxx(Sym *s, int off, uint64 v, int wid);
|
int duintxx(Sym *s, int off, uint64 v, int wid);
|
||||||
void genembedtramp(Type*, Sig*);
|
void genembedtramp(Type*, Sig*);
|
||||||
|
int gen_as_init(Node*, Node*);
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ loop:
|
|||||||
}
|
}
|
||||||
if(et == Inone)
|
if(et == Inone)
|
||||||
break;
|
break;
|
||||||
r = ifaceop(r->type, r->left, et);
|
r = ifacecvt(r->type, r->left, et);
|
||||||
l = ascompatet(n->op, &n->left, &r->type, 0);
|
l = ascompatet(n->op, &n->left, &r->type, 0);
|
||||||
if(l != N)
|
if(l != N)
|
||||||
indir(n, list(r, reorder2(l)));
|
indir(n, list(r, reorder2(l)));
|
||||||
@ -1077,7 +1077,7 @@ loop:
|
|||||||
if(!okforeq[et] && !isslice(n->left->type))
|
if(!okforeq[et] && !isslice(n->left->type))
|
||||||
goto badt;
|
goto badt;
|
||||||
if(isinter(n->left->type)) {
|
if(isinter(n->left->type)) {
|
||||||
indir(n, ifaceop(T, n, n->op));
|
indir(n, ifaceop(n));
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
t = types[TBOOL];
|
t = types[TBOOL];
|
||||||
@ -1227,7 +1227,7 @@ walkconv(Node *n)
|
|||||||
goto nop;
|
goto nop;
|
||||||
}
|
}
|
||||||
if(et != Inone) {
|
if(et != Inone) {
|
||||||
indir(n, ifaceop(t, l, et));
|
indir(n, ifacecvt(t, l, et));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
goto bad;
|
goto bad;
|
||||||
@ -2997,7 +2997,7 @@ ifacename[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
Node*
|
Node*
|
||||||
ifaceop(Type *tl, Node *n, int op)
|
ifacecvt(Type *tl, Node *n, int et)
|
||||||
{
|
{
|
||||||
Type *tr;
|
Type *tr;
|
||||||
Node *r, *a, *on;
|
Node *r, *a, *on;
|
||||||
@ -3005,9 +3005,9 @@ ifaceop(Type *tl, Node *n, int op)
|
|||||||
|
|
||||||
tr = n->type;
|
tr = n->type;
|
||||||
|
|
||||||
switch(op) {
|
switch(et) {
|
||||||
default:
|
default:
|
||||||
fatal("ifaceop: unknown op %O\n", op);
|
fatal("ifacecvt: unknown op %d\n", et);
|
||||||
|
|
||||||
case T2I:
|
case T2I:
|
||||||
// ifaceT2I(sigi *byte, sigt *byte, elem any) (ret any);
|
// ifaceT2I(sigi *byte, sigt *byte, elem any) (ret any);
|
||||||
@ -3017,14 +3017,14 @@ ifaceop(Type *tl, Node *n, int op)
|
|||||||
|
|
||||||
s = signame(tr); // sigt
|
s = signame(tr); // sigt
|
||||||
if(s == S)
|
if(s == S)
|
||||||
fatal("ifaceop: signame-1 T2I: %lT", tr);
|
fatal("ifacecvt: signame-1 T2I: %lT", tr);
|
||||||
a = s->oname;
|
a = s->oname;
|
||||||
a = nod(OADDR, a, N);
|
a = nod(OADDR, a, N);
|
||||||
r = list(a, r);
|
r = list(a, r);
|
||||||
|
|
||||||
s = signame(tl); // sigi
|
s = signame(tl); // sigi
|
||||||
if(s == S) {
|
if(s == S) {
|
||||||
fatal("ifaceop: signame-2 T2I: %lT", tl);
|
fatal("ifacecvt: signame-2 T2I: %lT", tl);
|
||||||
}
|
}
|
||||||
a = s->oname;
|
a = s->oname;
|
||||||
a = nod(OADDR, a, N);
|
a = nod(OADDR, a, N);
|
||||||
@ -3049,12 +3049,12 @@ ifaceop(Type *tl, Node *n, int op)
|
|||||||
|
|
||||||
s = signame(tl); // sigi or sigt
|
s = signame(tl); // sigi or sigt
|
||||||
if(s == S)
|
if(s == S)
|
||||||
fatal("ifaceop: signame %d", op);
|
fatal("ifacecvt: signame %d", et);
|
||||||
a = s->oname;
|
a = s->oname;
|
||||||
a = nod(OADDR, a, N);
|
a = nod(OADDR, a, N);
|
||||||
r = list(a, r);
|
r = list(a, r);
|
||||||
|
|
||||||
on = syslook(ifacename[op], 1);
|
on = syslook(ifacename[et], 1);
|
||||||
argtype(on, tr);
|
argtype(on, tr);
|
||||||
argtype(on, tl);
|
argtype(on, tl);
|
||||||
break;
|
break;
|
||||||
@ -3077,7 +3077,7 @@ ifaceop(Type *tl, Node *n, int op)
|
|||||||
|
|
||||||
s = signame(tr); // sigt
|
s = signame(tr); // sigt
|
||||||
if(s == S)
|
if(s == S)
|
||||||
fatal("ifaceop: signame-1 T2E: %lT", tr);
|
fatal("ifacecvt: signame-1 T2E: %lT", tr);
|
||||||
a = s->oname;
|
a = s->oname;
|
||||||
a = nod(OADDR, a, N);
|
a = nod(OADDR, a, N);
|
||||||
r = list(a, r);
|
r = list(a, r);
|
||||||
@ -3086,6 +3086,21 @@ ifaceop(Type *tl, Node *n, int op)
|
|||||||
argtype(on, tr);
|
argtype(on, tr);
|
||||||
argtype(on, tl);
|
argtype(on, tl);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = nod(OCALL, on, r);
|
||||||
|
walktype(r, Erv);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
Node*
|
||||||
|
ifaceop(Node *n)
|
||||||
|
{
|
||||||
|
Node *r, *a, *on;
|
||||||
|
|
||||||
|
switch(n->op) {
|
||||||
|
default:
|
||||||
|
fatal("ifaceop %O", n->op);
|
||||||
|
|
||||||
case OEQ:
|
case OEQ:
|
||||||
case ONE:
|
case ONE:
|
||||||
@ -3097,7 +3112,7 @@ ifaceop(Type *tl, Node *n, int op)
|
|||||||
r = list(a, r);
|
r = list(a, r);
|
||||||
|
|
||||||
if(!eqtype(n->left->type, n->right->type))
|
if(!eqtype(n->left->type, n->right->type))
|
||||||
fatal("ifaceop %O %T %T", op, n->left->type, n->right->type);
|
fatal("ifaceop %O %T %T", n->op, n->left->type, n->right->type);
|
||||||
if(isnilinter(n->left->type))
|
if(isnilinter(n->left->type))
|
||||||
on = syslook("efaceeq", 1);
|
on = syslook("efaceeq", 1);
|
||||||
else
|
else
|
||||||
@ -3106,7 +3121,7 @@ ifaceop(Type *tl, Node *n, int op)
|
|||||||
argtype(on, n->left->type);
|
argtype(on, n->left->type);
|
||||||
|
|
||||||
r = nod(OCALL, on, r);
|
r = nod(OCALL, on, r);
|
||||||
if(op == ONE)
|
if(n->op == ONE)
|
||||||
r = nod(ONOT, r, N);
|
r = nod(ONOT, r, N);
|
||||||
|
|
||||||
walktype(r, Erv);
|
walktype(r, Erv);
|
||||||
@ -3158,7 +3173,7 @@ convas(Node *n)
|
|||||||
|
|
||||||
et = ifaceas(lt, rt, 0);
|
et = ifaceas(lt, rt, 0);
|
||||||
if(et != Inone) {
|
if(et != Inone) {
|
||||||
n->right = ifaceop(lt, r, et);
|
n->right = ifacecvt(lt, r, et);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user