Commit e2e8aa0e authored by Ken Thompson's avatar Ken Thompson

interface equality (strings specifically)

R=r
OCL=17134
CL=17134
parent edb1412c
......@@ -2572,9 +2572,7 @@ ifaceop(Type *tl, Node *n, int op)
if(op == ONE)
r = nod(ONOT, r, N);
dump("bef", r);
walktype(r, Erv);
dump("aft", r);
return r;
}
......
......@@ -13,8 +13,8 @@ typedef struct Map Map;
struct Sigt
{
byte* name;
uint32 hash;
uint32 offset; // offset of substruct
uint32 hash; // hash of type // first is alg
uint32 offset; // offset of substruct // first is width
void (*fun)(void);
};
......@@ -265,6 +265,8 @@ sys·ifaceI2I(Sigi *si, Map *im, void *it, Map *retim, void *retit)
void
sys·ifaceeq(Map *im1, void *it1, Map *im2, void *it2, byte ret)
{
int32 alg, wid;
if(debug) {
prints("Ieq i1=");
printiface(im1, it1);
......@@ -284,18 +286,17 @@ sys·ifaceeq(Map *im1, void *it1, Map *im2, void *it2, byte ret)
if(im2 == nil)
goto no;
// values
if(it1 != it2)
// value
alg = im1->sigt->hash;
if(alg != im2->sigt->hash)
goto no;
// types
if(im1 == im2)
goto yes;
if(im1->sigt == im2->sigt)
goto yes;
if(im1->sigt->hash != im2->sigt->hash)
wid = im1->sigt->offset;
if(wid != im2->sigt->offset)
goto no;
if(!algarray[alg].equal(wid, &it1, &it2))
goto no;
yes:
ret = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment