compiler.tree.escape-analysis: fix bug that comes up when inheritance is used
parent
daab7f8fc0
commit
b963d56aac
|
@ -329,3 +329,18 @@ TUPLE: empty-tuple ;
|
||||||
[ { vector } declare length>> ]
|
[ { vector } declare length>> ]
|
||||||
count-unboxed-allocations
|
count-unboxed-allocations
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
! Bug found while tweaking benchmark.raytracer-simd
|
||||||
|
|
||||||
|
TUPLE: point-2d { x read-only } { y read-only } ;
|
||||||
|
TUPLE: point-3d < point-2d { z read-only } ;
|
||||||
|
|
||||||
|
[ 0 ] [
|
||||||
|
[ { point-2d } declare dup point-3d? [ z>> ] [ x>> ] if ]
|
||||||
|
count-unboxed-allocations
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
[ 0 ] [
|
||||||
|
[ point-2d boa dup point-3d? [ z>> ] [ x>> ] if ]
|
||||||
|
count-unboxed-allocations
|
||||||
|
] unit-test
|
||||||
|
|
|
@ -61,22 +61,28 @@ M: #push escape-analysis*
|
||||||
|
|
||||||
: record-tuple-allocation ( #call -- )
|
: record-tuple-allocation ( #call -- )
|
||||||
dup immutable-tuple-boa?
|
dup immutable-tuple-boa?
|
||||||
[ [ in-d>> but-last ] [ out-d>> first ] bi record-allocation ]
|
[ [ in-d>> but-last { } like ] [ out-d>> first ] bi record-allocation ]
|
||||||
[ record-unknown-allocation ]
|
[ record-unknown-allocation ]
|
||||||
if ;
|
if ;
|
||||||
|
|
||||||
: slot-offset ( #call -- n/f )
|
: slot-offset ( #call -- n/f )
|
||||||
dup in-d>>
|
dup in-d>> second node-value-info literal>> dup [ 2 - ] when ;
|
||||||
[ second node-value-info literal>> ]
|
|
||||||
[ first node-value-info class>> ] 2bi
|
: valid-slot-offset? ( slot# in -- ? )
|
||||||
2dup [ fixnum? ] [ tuple class<= ] bi* and [
|
over [
|
||||||
over 2 >= [ drop 2 - ] [ 2drop f ] if
|
allocation dup [
|
||||||
|
dup array? [ bounds-check? ] [ 2drop f ] if
|
||||||
|
] [ 2drop t ] if
|
||||||
] [ 2drop f ] if ;
|
] [ 2drop f ] if ;
|
||||||
|
|
||||||
|
: unknown-slot-call ( out slot# in -- )
|
||||||
|
[ unknown-allocation ] [ drop ] [ add-escaping-value ] tri* ;
|
||||||
|
|
||||||
: record-slot-call ( #call -- )
|
: record-slot-call ( #call -- )
|
||||||
[ out-d>> first ] [ slot-offset ] [ in-d>> first ] tri over
|
[ out-d>> first ] [ slot-offset ] [ in-d>> first ] tri
|
||||||
|
2dup valid-slot-offset?
|
||||||
[ [ record-slot-access ] [ copy-slot-value ] 3bi ]
|
[ [ record-slot-access ] [ copy-slot-value ] 3bi ]
|
||||||
[ [ unknown-allocation ] [ drop ] [ add-escaping-value ] tri* ]
|
[ unknown-slot-call ]
|
||||||
if ;
|
if ;
|
||||||
|
|
||||||
M: #call escape-analysis*
|
M: #call escape-analysis*
|
||||||
|
|
Loading…
Reference in New Issue