compiler.cfg.linear-scan: extend lifetime intervals of base pointers correctly (reported by Anton Gorenko)

db4
Slava Pestov 2010-09-30 20:48:52 -07:00
parent e6de81706b
commit b052aa61cb
2 changed files with 22 additions and 3 deletions

View File

@ -132,17 +132,30 @@ M: vreg-insn compute-live-intervals* ( insn -- )
[ [ temp-vregs ] dip '[ _ record-temp ] each ]
2tri ;
! Extend lifetime intervals of base pointers, so that their
! values are available even if the base pointer is never used
! again.
GENERIC: uses-vregs* ( insn -- seq )
M: gc-map-insn uses-vregs* ( insn -- )
[ uses-vregs ] [ gc-map>> derived-roots>> values ] bi append ;
M: vreg-insn uses-vregs* uses-vregs ;
M: insn uses-vregs* drop f ;
M: clobber-insn compute-live-intervals* ( insn -- )
dup insn#>>
[ [ defs-vregs ] dip '[ _ f record-def ] each ]
[ [ uses-vregs ] dip '[ _ t record-use ] each ]
[ [ uses-vregs* ] dip '[ _ t record-use ] each ]
[ [ temp-vregs ] dip '[ _ record-temp ] each ]
2tri ;
M: hairy-clobber-insn compute-live-intervals* ( insn -- )
dup insn#>>
[ [ defs-vregs ] dip '[ _ t record-def ] each ]
[ [ uses-vregs ] dip '[ _ t record-use ] each ]
[ [ uses-vregs* ] dip '[ _ t record-use ] each ]
[ [ temp-vregs ] dip '[ _ record-temp ] each ]
2tri ;

View File

@ -6,7 +6,7 @@ math memory namespaces namespaces.private parser
quotations sequences specialized-arrays stack-checker
stack-checker.errors system threads tools.test words
alien.complex concurrency.promises alien.data
byte-arrays classes compiler.test ;
byte-arrays classes compiler.test libc ;
FROM: alien.c-types => float short ;
SPECIALIZED-ARRAY: float
SPECIALIZED-ARRAY: char
@ -823,3 +823,9 @@ TUPLE: some-tuple x ;
aa-indirect-1 >>x
] compile-call
] unit-test
! GC maps regression
: anton's-regression ( -- )
f (free) f (free) ;
[ ] [ anton's-regression ] unit-test