Only generate cold call entry points for standard generics and not hooks
parent
dfcbd206b6
commit
dbc1a8e1a3
|
@ -245,11 +245,12 @@ M: f compile-engine ;
|
||||||
generic-word get "methods" word-prop
|
generic-word get "methods" word-prop
|
||||||
assoc-size 2 * next-power-of-2 f <array> ;
|
assoc-size 2 * next-power-of-2 f <array> ;
|
||||||
|
|
||||||
|
HOOK: cold-call-def combination ( word -- quot/f )
|
||||||
|
|
||||||
|
M: single-combination cold-call-def drop f ;
|
||||||
|
|
||||||
: define-cold-call ( word -- )
|
: define-cold-call ( word -- )
|
||||||
#! Direct calls to the generic word (not tail calls or indirect calls)
|
dup cold-call-def >>direct-entry-def drop ;
|
||||||
#! will jump to the inline cache entry point instead of the megamorphic
|
|
||||||
#! dispatch entry point.
|
|
||||||
dup [ f inline-cache-miss ] curry [ ] like >>direct-entry-def drop ;
|
|
||||||
|
|
||||||
M: single-combination perform-combination
|
M: single-combination perform-combination
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
! Copyright (C) 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors definitions generic generic.single kernel
|
USING: accessors definitions generic generic.single kernel
|
||||||
namespaces words math math.order combinators sequences ;
|
namespaces words math math.order combinators sequences
|
||||||
|
generic.single.private ;
|
||||||
IN: generic.standard
|
IN: generic.standard
|
||||||
|
|
||||||
TUPLE: standard-combination < single-combination # ;
|
TUPLE: standard-combination < single-combination # ;
|
||||||
|
@ -37,6 +38,12 @@ M: standard-generic effective-method
|
||||||
[ datastack ] dip [ "combination" word-prop #>> swap <reversed> nth ] keep
|
[ datastack ] dip [ "combination" word-prop #>> swap <reversed> nth ] keep
|
||||||
(effective-method) ;
|
(effective-method) ;
|
||||||
|
|
||||||
|
M: standard-combination cold-call-def
|
||||||
|
#! Direct calls to the generic word (not tail calls or indirect calls)
|
||||||
|
#! will jump to the inline cache entry point instead of the megamorphic
|
||||||
|
#! dispatch entry point.
|
||||||
|
[ f inline-cache-miss ] curry picker prepend ;
|
||||||
|
|
||||||
M: standard-generic definer drop \ GENERIC# f ;
|
M: standard-generic definer drop \ GENERIC# f ;
|
||||||
|
|
||||||
M: simple-generic definer drop \ GENERIC: f ;
|
M: simple-generic definer drop \ GENERIC: f ;
|
||||||
|
|
Loading…
Reference in New Issue