Fixing bug in dependency tracking for guarded method inlining
parent
0d055060ad
commit
4d5b7fe883
|
@ -53,6 +53,7 @@ ERROR: bad-splitting class generic ;
|
||||||
:: split-code ( class generic -- quot/f )
|
:: split-code ( class generic -- quot/f )
|
||||||
class generic method :> my-method
|
class generic method :> my-method
|
||||||
my-method [ class generic bad-splitting ] unless
|
my-method [ class generic bad-splitting ] unless
|
||||||
|
class generic my-method depends-on-method-is
|
||||||
generic dispatch# (picker) :> picker
|
generic dispatch# (picker) :> picker
|
||||||
[
|
[
|
||||||
picker call class instance?
|
picker call class instance?
|
||||||
|
@ -62,8 +63,8 @@ ERROR: bad-splitting class generic ;
|
||||||
|
|
||||||
:: split-method-call ( class generic -- quot/f )
|
:: split-method-call ( class generic -- quot/f )
|
||||||
class generic subclass-with-only-method [
|
class generic subclass-with-only-method [
|
||||||
class generic depends-on-single-method
|
[ class generic depends-on-single-method ]
|
||||||
generic split-code
|
[ generic split-code ] bi
|
||||||
] [ f ] if* ;
|
] [ f ] if* ;
|
||||||
|
|
||||||
: inlining-standard-method ( #call word -- class/f method/f )
|
: inlining-standard-method ( #call word -- class/f method/f )
|
||||||
|
|
|
@ -9,7 +9,7 @@ compiler.tree.debugger compiler.tree.checker slots.private words
|
||||||
hashtables classes assocs locals specialized-arrays system
|
hashtables classes assocs locals specialized-arrays system
|
||||||
sorting math.libm math.floats.private math.integers.private
|
sorting math.libm math.floats.private math.integers.private
|
||||||
math.intervals quotations effects alien alien.data sets
|
math.intervals quotations effects alien alien.data sets
|
||||||
strings.private classes.tuple ;
|
strings.private classes.tuple eval ;
|
||||||
FROM: math => float ;
|
FROM: math => float ;
|
||||||
SPECIALIZED-ARRAY: double
|
SPECIALIZED-ARRAY: double
|
||||||
SPECIALIZED-ARRAY: void*
|
SPECIALIZED-ARRAY: void*
|
||||||
|
@ -999,3 +999,19 @@ UNION: ?fixnum fixnum POSTPONE: f ;
|
||||||
[ f ] [ [ { integer } declare >fixnum ] { >fixnum } inlined? ] unit-test
|
[ f ] [ [ { integer } declare >fixnum ] { >fixnum } inlined? ] unit-test
|
||||||
|
|
||||||
[ f ] [ [ { word } declare parent-word ] { parent-word } inlined? ] unit-test
|
[ f ] [ [ { word } declare parent-word ] { parent-word } inlined? ] unit-test
|
||||||
|
|
||||||
|
! Make sure guarded method inlining installs the right dependencies
|
||||||
|
|
||||||
|
[ ] [
|
||||||
|
"IN: compiler.tree.propagation.tests
|
||||||
|
USING: kernel.private accessors ;
|
||||||
|
TUPLE: foo bar ;
|
||||||
|
UNION: ?foo foo POSTPONE: f ;
|
||||||
|
: baz ( ?foo -- bar ) { ?foo } declare bar>> ;" eval( -- )
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
[ 3 ] [ "USE: kernel IN: compiler.tree.propagation.tests 3 foo boa baz" eval( -- x ) ] unit-test
|
||||||
|
|
||||||
|
[ ] [ "IN: compiler.tree.propagation.tests TUPLE: foo baz bar ;" eval( -- ) ] unit-test
|
||||||
|
|
||||||
|
[ 3 ] [ "USE: kernel IN: compiler.tree.propagation.tests 2 3 foo boa baz" eval( -- x ) ] unit-test
|
||||||
|
|
|
@ -145,11 +145,11 @@ TUPLE: depends-on-final class ;
|
||||||
M: depends-on-final satisfied?
|
M: depends-on-final satisfied?
|
||||||
class>> { [ class? ] [ final-class? ] } 1&& ;
|
class>> { [ class? ] [ final-class? ] } 1&& ;
|
||||||
|
|
||||||
TUPLE: depends-on-single-method class generic ;
|
TUPLE: depends-on-single-method method-class object-class generic ;
|
||||||
|
|
||||||
: depends-on-single-method ( class generic -- )
|
: depends-on-single-method ( method-class object-class generic -- )
|
||||||
[ nip depends-on-conditionally ]
|
[ nip [ depends-on-conditionally ] bi@ ]
|
||||||
[ \ depends-on-single-method add-conditional-dependency ] 2bi ;
|
[ \ depends-on-single-method add-conditional-dependency ] 3bi ;
|
||||||
|
|
||||||
:: subclass-with-only-method ( class generic -- subclass/f )
|
:: subclass-with-only-method ( class generic -- subclass/f )
|
||||||
generic method-classes [ f ] [
|
generic method-classes [ f ] [
|
||||||
|
@ -161,7 +161,17 @@ TUPLE: depends-on-single-method class generic ;
|
||||||
] if-empty ;
|
] if-empty ;
|
||||||
|
|
||||||
M: depends-on-single-method satisfied?
|
M: depends-on-single-method satisfied?
|
||||||
[ class>> ] [ generic>> ] bi subclass-with-only-method >boolean ;
|
[ method-class>> ] [ object-class>> ] [ generic>> ] tri
|
||||||
|
subclass-with-only-method = ;
|
||||||
|
|
||||||
|
TUPLE: depends-on-method-is class generic method ;
|
||||||
|
|
||||||
|
: depends-on-method-is ( class generic method -- )
|
||||||
|
[ [ depends-on-conditionally ] tri@ ]
|
||||||
|
[ \ depends-on-method-is add-conditional-dependency ] 3bi ;
|
||||||
|
|
||||||
|
M: depends-on-method-is satisfied?
|
||||||
|
[ class>> ] [ generic>> method ] [ method>> ] tri = ;
|
||||||
|
|
||||||
: init-dependencies ( -- )
|
: init-dependencies ( -- )
|
||||||
H{ } clone dependencies set
|
H{ } clone dependencies set
|
||||||
|
|
Loading…
Reference in New Issue