aboutsummaryrefslogtreecommitdiffstats
path: root/otp_patch_apply
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-01-22 16:27:33 +0100
committerBjörn Gustavsson <[email protected]>2018-01-24 05:49:35 +0100
commitab6ac37e0c40331a2debd90f753ec2f4531e4701 (patch)
tree0dbe34e7630116c9874934d1f1013ba0571e1f8b /otp_patch_apply
parent25fa1aadc987f4c3abb8b39ae5fa090a9a103daa (diff)
downloadotp-ab6ac37e0c40331a2debd90f753ec2f4531e4701.tar.gz
otp-ab6ac37e0c40331a2debd90f753ec2f4531e4701.tar.bz2
otp-ab6ac37e0c40331a2debd90f753ec2f4531e4701.zip
Correct unsafe optimizations in beam_block
When attempting to eliminate the move/2 instruction in the following code: {bif,self,{f,0},[],{x,0}}. {move,{x,0},{x,1}}. . . . {put_tuple,2,{x,1}}. {put,{atom,ok}}. {put,{x,0}}. beam_block would produce the following unsafe code: {bif,self,{f,0},[],{x,1}}. . . . {put_tuple,2,{x,1}}. {put,{atom,ok}}. {put,{x,1}}. It is unsafe because the tuple is self-referential. The following code: {put_list,{y,6},nil,{x,4}}. {move,{x,4},{x,5}}. {put_list,{y,1},{x,5},{x,5}}. . . . {put_tuple,2,{x,6}}. {put,{x,4}}. {put,{x,5}}. would be incorrectly transformed to: {put_list,{y,6},nil,{x,5}}. {put_list,{y,1},{x,5},{x,5}}. . . . {put_tuple,2,{x,6}}. {put,{x,5}}. {put,{x,5}}. (Both elements in the built tuple get the same value.)
Diffstat (limited to 'otp_patch_apply')
0 files changed, 0 insertions, 0 deletions