aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_disasm.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-01-28 10:51:11 +0100
committerBjörn Gustavsson <[email protected]>2013-01-31 11:11:35 +0100
commit9cfd4261240fffc51ca5aa7d1df5a29a30f42a38 (patch)
tree90ef3cc303a0b02bee31b954f3e02542c60bf2ad /lib/compiler/src/beam_disasm.erl
parent68b804f34d4ec420d86953e3f519179a40fbee8f (diff)
downloadotp-9cfd4261240fffc51ca5aa7d1df5a29a30f42a38.tar.gz
otp-9cfd4261240fffc51ca5aa7d1df5a29a30f42a38.tar.bz2
otp-9cfd4261240fffc51ca5aa7d1df5a29a30f42a38.zip
compiler: Use the literal pool for floating point constants
The BEAM loader will put floating point constants into the literal pools for the module, but it will not check for duplicates. We can do much better by having the compiler use the literal pool for floating point constants.
Diffstat (limited to 'lib/compiler/src/beam_disasm.erl')
-rw-r--r--lib/compiler/src/beam_disasm.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_disasm.erl b/lib/compiler/src/beam_disasm.erl
index 62bdc74cc8..67d756c45c 100644
--- a/lib/compiler/src/beam_disasm.erl
+++ b/lib/compiler/src/beam_disasm.erl
@@ -512,7 +512,12 @@ decode_z_tagged(Tag,B,Bs,Literals) when (B band 16#08) =:= 0 ->
decode_alloc_list(Bs, Literals);
4 -> % literal
{{u,LitIndex},RestBs} = decode_arg(Bs),
- {{literal,gb_trees:get(LitIndex, Literals)},RestBs};
+ case gb_trees:get(LitIndex, Literals) of
+ Float when is_float(Float) ->
+ {{float,Float},RestBs};
+ Literal ->
+ {{literal,Literal},RestBs}
+ end;
_ ->
?exit({decode_z_tagged,{invalid_extended_tag,N}})
end;