hints: fix regression with declarations
parent
09eb06ad94
commit
c0abb9ce95
|
@ -4,6 +4,7 @@ compiler.tree.optimizer compiler.cfg.builder compiler.cfg.debugger
|
||||||
compiler.cfg.optimizer compiler.cfg.predecessors compiler.cfg.checker
|
compiler.cfg.optimizer compiler.cfg.predecessors compiler.cfg.checker
|
||||||
compiler.cfg arrays locals byte-arrays kernel.private math
|
compiler.cfg arrays locals byte-arrays kernel.private math
|
||||||
slots.private vectors sbufs strings math.partial-dispatch
|
slots.private vectors sbufs strings math.partial-dispatch
|
||||||
|
hashtables assocs combinators.short-circuit
|
||||||
strings.private accessors compiler.cfg.instructions ;
|
strings.private accessors compiler.cfg.instructions ;
|
||||||
IN: compiler.cfg.builder.tests
|
IN: compiler.cfg.builder.tests
|
||||||
|
|
||||||
|
@ -205,3 +206,6 @@ IN: compiler.cfg.builder.tests
|
||||||
[ [ ##box-float? ] contains-insn? ] bi
|
[ [ ##box-float? ] contains-insn? ] bi
|
||||||
] unit-test
|
] unit-test
|
||||||
] when
|
] when
|
||||||
|
|
||||||
|
! Regression. Make sure everything is inlined correctly
|
||||||
|
[ f ] [ M\ hashtable set-at [ { [ ##call? ] [ word>> \ set-slot eq? ] } 1&& ] contains-insn? ] unit-test
|
|
@ -0,0 +1,12 @@
|
||||||
|
USING: math hashtables accessors kernel words hints
|
||||||
|
compiler.tree.debugger tools.test ;
|
||||||
|
IN: hints.tests
|
||||||
|
|
||||||
|
! Regression
|
||||||
|
GENERIC: blahblah ( a b c -- )
|
||||||
|
|
||||||
|
M: hashtable blahblah 2nip [ 1 + ] change-count drop ;
|
||||||
|
|
||||||
|
HINTS: M\ hashtable blahblah { object fixnum object } { object word object } ;
|
||||||
|
|
||||||
|
[ t ] [ M\ hashtable blahblah { count>> (>>count) } inlined? ] unit-test
|
|
@ -37,8 +37,8 @@ M: object specializer-declaration class ;
|
||||||
[ [ specializer-declaration ] map swap '[ _ declare @ ] ] 2bi
|
[ [ specializer-declaration ] map swap '[ _ declare @ ] ] 2bi
|
||||||
] with { } map>assoc ;
|
] with { } map>assoc ;
|
||||||
|
|
||||||
: specialize-quot ( quot word specializer -- quot' )
|
: specialize-quot ( quot specializer -- quot' )
|
||||||
[ drop nip def>> ] [ nip specializer-cases ] 3bi alist>quot ;
|
[ drop ] [ specializer-cases ] 2bi alist>quot ;
|
||||||
|
|
||||||
! compiler.tree.propagation.inlining sets this to f
|
! compiler.tree.propagation.inlining sets this to f
|
||||||
SYMBOL: specialize-method?
|
SYMBOL: specialize-method?
|
||||||
|
@ -52,8 +52,8 @@ t specialize-method? set-global
|
||||||
|
|
||||||
: specialize-method ( quot method -- quot' )
|
: specialize-method ( quot method -- quot' )
|
||||||
[ specialize-method? get [ method-declaration prepend ] [ drop ] if ]
|
[ specialize-method? get [ method-declaration prepend ] [ drop ] if ]
|
||||||
[ dup "method-generic" word-prop specializer ] bi
|
[ "method-generic" word-prop ] bi
|
||||||
[ specialize-quot ] [ drop ] if* ;
|
specializer [ specialize-quot ] when* ;
|
||||||
|
|
||||||
: standard-method? ( method -- ? )
|
: standard-method? ( method -- ? )
|
||||||
dup method-body? [
|
dup method-body? [
|
||||||
|
@ -64,7 +64,7 @@ t specialize-method? set-global
|
||||||
[ def>> ] keep
|
[ def>> ] keep
|
||||||
dup generic? [ drop ] [
|
dup generic? [ drop ] [
|
||||||
[ dup standard-method? [ specialize-method ] [ drop ] if ]
|
[ dup standard-method? [ specialize-method ] [ drop ] if ]
|
||||||
[ dup specializer [ specialize-quot ] [ drop ] if* ]
|
[ specializer [ specialize-quot ] when* ]
|
||||||
bi
|
bi
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue