compiler.cfg.stacks.*: use insn# as the key in the stack-record instead of the insn tuple itself
parent
d19869f906
commit
3c1f223d90
|
@ -1,6 +1,6 @@
|
|||
USING: accessors arrays assocs combinators compiler.cfg.dataflow-analysis
|
||||
compiler.cfg.instructions compiler.cfg.registers fry kernel math math.order
|
||||
namespaces sequences ;
|
||||
compiler.cfg.instructions compiler.cfg.linearization compiler.cfg.registers fry
|
||||
kernel math math.order namespaces sequences ;
|
||||
QUALIFIED: sets
|
||||
IN: compiler.cfg.stacks.map
|
||||
|
||||
|
@ -61,9 +61,12 @@ FORWARD-ANALYSIS: map
|
|||
|
||||
SYMBOL: stack-record
|
||||
|
||||
: register-stack-state ( state insn -- )
|
||||
insn#>> stack-record get 2dup at f assert= set-at ;
|
||||
|
||||
M: map-analysis transfer-set ( in-set bb dfa -- out-set )
|
||||
drop instructions>> swap [
|
||||
[ stack-record get set-at ] [ visit-insn ] 2bi
|
||||
[ register-stack-state ] [ visit-insn ] 2bi
|
||||
] reduce ;
|
||||
|
||||
M: map-analysis ignore-block? ( bb dfa -- ? )
|
||||
|
@ -73,5 +76,10 @@ M: map-analysis ignore-block? ( bb dfa -- ? )
|
|||
M: map-analysis join-sets ( sets bb dfa -- set )
|
||||
2drop [ initial-state ] [ first ] if-empty ;
|
||||
|
||||
: uniquely-number-instructions ( cfg -- )
|
||||
cfg>insns [ swap insn#<< ] each-index ;
|
||||
|
||||
: trace-stack-state ( cfg -- assoc )
|
||||
H{ } clone stack-record set compute-map-sets stack-record get ;
|
||||
H{ } clone stack-record set
|
||||
[ uniquely-number-instructions ] [ compute-map-sets ] bi
|
||||
stack-record get ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
USING: accessors arrays assocs compiler.cfg.instructions
|
||||
compiler.cfg.stacks.map fry kernel math sequences ;
|
||||
compiler.cfg.linearization compiler.cfg.stacks.map fry kernel math sequences ;
|
||||
IN: compiler.cfg.stacks.vacant
|
||||
|
||||
! ! Utils
|
||||
|
@ -31,5 +31,5 @@ IN: compiler.cfg.stacks.vacant
|
|||
{ >>scrub-d >>check-d >>scrub-r >>check-r } write-slots ;
|
||||
|
||||
: fill-gc-maps ( cfg -- )
|
||||
trace-stack-state [ drop gc-map-insn? ] assoc-filter
|
||||
[ swap gc-map>> set-gc-map ] assoc-each ;
|
||||
[ trace-stack-state ] [ cfg>insns [ gc-map-insn? ] filter ] bi
|
||||
[ [ insn#>> of ] [ gc-map>> ] bi set-gc-map ] with each ;
|
||||
|
|
Loading…
Reference in New Issue