aboutsummaryrefslogtreecommitdiffstats
path: root/lib/percept/priv
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-10-12 10:08:18 +0200
committerBjörn Gustavsson <[email protected]>2010-10-12 14:15:36 +0200
commitf6a2fb81fd87e671ceed85261a1c28a6082f010c (patch)
treefaf8abfab935ac33adcb3fece584fd6d1017a341 /lib/percept/priv
parent499082d25170aa7edf922a6aee0465a7ffb144d4 (diff)
downloadotp-f6a2fb81fd87e671ceed85261a1c28a6082f010c.tar.gz
otp-f6a2fb81fd87e671ceed85261a1c28a6082f010c.tar.bz2
otp-f6a2fb81fd87e671ceed85261a1c28a6082f010c.zip
beam_block: Do optimizations in the safe order
Moving of allocation instructions upwards in the instruction stream (in order to enable further optimizations) in beam_block, is implemented with the assumption that if a register {x,X} contains a valid term, then all other x register with lower numbers than X also contain valid terms. That assumption is true after code generation. The beam_utils:live_opt/1 optimization, however, may invalidate that assumption. For instance, if a receive statement exports a variable that is used, but the return value of the receive statement is not used, then {x,1} but not {x,0} contains a valid term at the end of the receive statement. If the receive statement is followed by {bif,self,{f,0},[],{x,0}}. {test_heap,NumberOfWords,2}. moving the allocation upwards will produce {test_heap,NumberOfWords,2}. {bif,self,{f,0},[],{x,0}}. which will cause the beam_validator pass to scream loudly that {x,0} is not live at the test_heap instruction. Fix the problem by doing the optimizations in reverse order. Reported-by: Jim Engquist
Diffstat (limited to 'lib/percept/priv')
0 files changed, 0 insertions, 0 deletions