diff --git a/core/generic/single/single.factor b/core/generic/single/single.factor index 8154942c16..9d958b36f3 100644 --- a/core/generic/single/single.factor +++ b/core/generic/single/single.factor @@ -245,11 +245,12 @@ M: f compile-engine ; generic-word get "methods" word-prop assoc-size 2 * next-power-of-2 f ; +HOOK: cold-call-def combination ( word -- quot/f ) + +M: single-combination cold-call-def drop f ; + : define-cold-call ( word -- ) - #! 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. - dup [ f inline-cache-miss ] curry [ ] like >>direct-entry-def drop ; + dup cold-call-def >>direct-entry-def drop ; M: single-combination perform-combination [ diff --git a/core/generic/standard/standard.factor b/core/generic/standard/standard.factor index 6e2c80a2ce..499495cdc0 100644 --- a/core/generic/standard/standard.factor +++ b/core/generic/standard/standard.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. 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 TUPLE: standard-combination < single-combination # ; @@ -37,6 +38,12 @@ M: standard-generic effective-method [ datastack ] dip [ "combination" word-prop #>> swap nth ] keep (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: simple-generic definer drop \ GENERIC: f ;