mirror of
https://github.com/golang/go
synced 2024-11-19 14:34:42 -07:00
for loops in hashmap.
a few missing FLUSH. R=ken OCL=16221 CL=16221
This commit is contained in:
parent
a05c59fe91
commit
1f1ae404f8
@ -131,44 +131,34 @@ hashmap(Sigi *si, Sigt *st)
|
|||||||
m->sigi = si;
|
m->sigi = si;
|
||||||
m->sigt = st;
|
m->sigt = st;
|
||||||
|
|
||||||
ni = 1; // skip first word
|
|
||||||
nt = 0;
|
nt = 0;
|
||||||
|
for(ni=1; (iname=si[ni].name) != nil; ni++) { // ni=1: skip first word
|
||||||
|
// pick up next name from
|
||||||
|
// interface signature
|
||||||
|
ihash = si[ni].hash;
|
||||||
|
|
||||||
loop1:
|
for(;; nt++) {
|
||||||
// pick up next name from
|
// pick up and compare next name
|
||||||
// interface signature
|
// from structure signature
|
||||||
iname = si[ni].name;
|
sname = st[nt].name;
|
||||||
if(iname == nil) {
|
if(sname == nil) {
|
||||||
m->link = hash[h];
|
prints((int8*)iname);
|
||||||
hash[h] = m;
|
prints(": ");
|
||||||
// prints("new hashmap\n");
|
throw("hashmap: failed to find method");
|
||||||
return m;
|
m->bad = 1;
|
||||||
|
m->link = hash[h];
|
||||||
|
hash[h] = m;
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
if(ihash == st[nt].hash && strcmp(sname, iname) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m->fun[si[ni].perm] = st[nt].fun;
|
||||||
}
|
}
|
||||||
ihash = si[ni].hash;
|
m->link = hash[h];
|
||||||
|
hash[h] = m;
|
||||||
loop2:
|
// prints("new hashmap\n");
|
||||||
// pick up and comapre next name
|
return m;
|
||||||
// from structure signature
|
|
||||||
sname = st[nt].name;
|
|
||||||
if(sname == nil) {
|
|
||||||
prints((int8*)iname);
|
|
||||||
prints(": ");
|
|
||||||
throw("hashmap: failed to find method");
|
|
||||||
m->bad = 1;
|
|
||||||
m->link = hash[h];
|
|
||||||
hash[h] = m;
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ihash != st[nt].hash ||
|
|
||||||
strcmp(sname, iname) != 0) {
|
|
||||||
nt++;
|
|
||||||
goto loop2;
|
|
||||||
}
|
|
||||||
|
|
||||||
m->fun[si[ni].perm] = st[nt].fun;
|
|
||||||
ni++;
|
|
||||||
goto loop1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ifaceT2I(sigi *byte, sigt *byte, elem any) (ret any);
|
// ifaceT2I(sigi *byte, sigt *byte, elem any) (ret any);
|
||||||
@ -196,6 +186,7 @@ sys·ifaceT2I(Sigi *si, Sigt *st, void *elem, Map *retim, void *retit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FLUSH(&retim);
|
FLUSH(&retim);
|
||||||
|
FLUSH(&retit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ifaceI2T(sigt *byte, iface any) (ret any);
|
// ifaceI2T(sigt *byte, iface any) (ret any);
|
||||||
@ -257,6 +248,7 @@ sys·ifaceI2I(Sigi *si, Map *im, void *it, Map *retim, void *retit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FLUSH(&retim);
|
FLUSH(&retim);
|
||||||
|
FLUSH(&retit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user