diff options
author | Anthony Ramine <[email protected]> | 2013-11-18 11:49:58 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2013-12-13 12:52:05 +0100 |
commit | 51c7e590e470cb2aa8d09ac8f56a659e272d88b4 (patch) | |
tree | e2ee987c985c908d6a27734b65584b67abf4ae17 | |
parent | fa6407f35c12156a9ed2eb25fb131e1ef5c7f0e4 (diff) | |
download | otp-51c7e590e470cb2aa8d09ac8f56a659e272d88b4.tar.gz otp-51c7e590e470cb2aa8d09ac8f56a659e272d88b4.tar.bz2 otp-51c7e590e470cb2aa8d09ac8f56a659e272d88b4.zip |
Properly let floating-point instructions through in the BEAM compiler
The compiler shouldn't crash when fed an already-optimised BEAM assembly file.
-rw-r--r-- | lib/compiler/src/beam_block.erl | 4 | ||||
-rw-r--r-- | lib/compiler/src/beam_type.erl | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_block.erl b/lib/compiler/src/beam_block.erl index cf5244e1ce..ea984a6afb 100644 --- a/lib/compiler/src/beam_block.erl +++ b/lib/compiler/src/beam_block.erl @@ -144,6 +144,10 @@ collect({set_tuple_element,S,D,I}) -> {set,[],[S,D],{set_tuple_element,I}}; collect({get_list,S,D1,D2}) -> {set,[D1,D2],[S],get_list}; collect(remove_message) -> {set,[],[],remove_message}; collect({'catch',R,L}) -> {set,[R],[],{'catch',L}}; +collect(fclearerror) -> {set,[],[],fclearerror}; +collect({fcheckerror,{f,0}}) -> {set,[],[],fcheckerror}; +collect({fmove,S,D}) -> {set,[D],[S],fmove}; +collect({fconv,S,D}) -> {set,[D],[S],fconv}; collect(_) -> error. %% embed_lines([Instruction]) -> [Instruction] diff --git a/lib/compiler/src/beam_type.erl b/lib/compiler/src/beam_type.erl index 3ec57a67da..58c0f765ae 100644 --- a/lib/compiler/src/beam_type.erl +++ b/lib/compiler/src/beam_type.erl @@ -142,6 +142,12 @@ simplify_float(Is0, Ts0) -> throw:not_possible -> not_possible end. +simplify_float_1([{set,[],[],fclearerror}|Is], Ts, Rs, Acc) -> + simplify_float_1(Is, Ts, Rs, clearerror(Acc)); +simplify_float_1([{set,[],[],fcheckerror}|Is], Ts, Rs, Acc) -> + simplify_float_1(Is, Ts, Rs, checkerror(Acc)); +simplify_float_1([{set,[{fr,_}],_,_}=I|Is], Ts, Rs, Acc) -> + simplify_float_1(Is, Ts, Rs, [I|Acc]); simplify_float_1([{set,[D0],[A0],{alloc,_,{gc_bif,'-',{f,0}}}}=I|Is]=Is0, Ts0, Rs0, Acc0) -> case tdb_find(A0, Ts0) of |