Slightly more space-efficient dispatch table representation
parent
b86a419b6e
commit
0b7eee6e61
|
@ -163,7 +163,7 @@ M: hi-tag-dispatch-engine compile-engine
|
||||||
|
|
||||||
: build-fast-hash ( methods -- buckets )
|
: build-fast-hash ( methods -- buckets )
|
||||||
>alist V{ } clone [ hashcode 1array ] distribute-buckets
|
>alist V{ } clone [ hashcode 1array ] distribute-buckets
|
||||||
[ compile-engines* >alist >array ] map ;
|
[ compile-engines* >alist { } join ] map ;
|
||||||
|
|
||||||
M: echelon-dispatch-engine compile-engine
|
M: echelon-dispatch-engine compile-engine
|
||||||
dup n>> 0 = [
|
dup n>> 0 = [
|
||||||
|
|
|
@ -8,15 +8,14 @@ cell megamorphic_cache_misses;
|
||||||
|
|
||||||
static cell search_lookup_alist(cell table, cell klass)
|
static cell search_lookup_alist(cell table, cell klass)
|
||||||
{
|
{
|
||||||
array *pairs = untag<array>(table);
|
array *elements = untag<array>(table);
|
||||||
fixnum index = array_capacity(pairs) - 1;
|
fixnum index = array_capacity(elements) - 2;
|
||||||
while(index >= 0)
|
while(index >= 0)
|
||||||
{
|
{
|
||||||
array *pair = untag<array>(array_nth(pairs,index));
|
if(array_nth(elements,index) == klass)
|
||||||
if(array_nth(pair,0) == klass)
|
return array_nth(elements,index + 1);
|
||||||
return array_nth(pair,1);
|
|
||||||
else
|
else
|
||||||
index--;
|
index -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return F;
|
return F;
|
||||||
|
|
Loading…
Reference in New Issue