aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_disasm.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-01-29 11:15:46 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-01-29 11:15:46 +0100
commitcb50354a9d3463cf07b830ecf28260adc5b361c0 (patch)
tree4794bac549046c2b1039ec0ac559b955ad3b31fc /lib/compiler/src/beam_disasm.erl
parentd960d54f75c51b81a99a1c5cf40c19f2e9d55068 (diff)
parentcf5bc2e917dbcb2c2841bf07b995efe105bea4be (diff)
downloadotp-cb50354a9d3463cf07b830ecf28260adc5b361c0.tar.gz
otp-cb50354a9d3463cf07b830ecf28260adc5b361c0.tar.bz2
otp-cb50354a9d3463cf07b830ecf28260adc5b361c0.zip
Merge branch 'egil/maps/OTP-11616'
* egil/maps/OTP-11616: (112 commits) compiler: Add core compile test for maps compiler: Fix core parse for Maps compiler: Fixup #map_pair{} spec erts: Strengthen map_SUITE tests erts: Update maps_fold test to respect maps:fold/3 stdlib: Make maps:fold/3 order-independent erts: Fixup enif_make_map_put on windows erts: Update preloaded erts_internal.beam hipe: Fixup update cerl pretty printer erts: Add map construction to driver API dialyzer: Add maps tests dialyzer: Remove dead code dialyzer: Reflect map_pair core changes in dialyzer hipe: Update cerl pretty printer compiler: Update inliner tests compiler: Squash #c_map_pair_*{} to #c_map_pair{} compiler: Squash #k_map_pair_*{} to #k_map_pair{} preloaded: Fixup export cmp_term in erts_internal erts: Change 'size' argument of enif_get_map_size from int* to size_t* erts: Fix compile error for halfword emulator ...
Diffstat (limited to 'lib/compiler/src/beam_disasm.erl')
-rw-r--r--lib/compiler/src/beam_disasm.erl38
1 files changed, 37 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_disasm.erl b/lib/compiler/src/beam_disasm.erl
index 1a8bbcee22..e0d0d0fd1d 100644
--- a/lib/compiler/src/beam_disasm.erl
+++ b/lib/compiler/src/beam_disasm.erl
@@ -365,6 +365,10 @@ disasm_instr(B, Bs, Atoms, Literals) ->
disasm_select_inst(select_val, Bs, Atoms, Literals);
select_tuple_arity ->
disasm_select_inst(select_tuple_arity, Bs, Atoms, Literals);
+ put_map_assoc ->
+ disasm_map_inst(put_map_assoc, Bs, Atoms, Literals);
+ put_map_exact ->
+ disasm_map_inst(put_map_exact, Bs, Atoms, Literals);
_ ->
try decode_n_args(Arity, Bs, Atoms, Literals) of
{Args, RestBs} ->
@@ -395,6 +399,17 @@ disasm_select_inst(Inst, Bs, Atoms, Literals) ->
{List, RestBs} = decode_n_args(Len, Bs4, Atoms, Literals),
{{Inst, [X,F,{Z,U,List}]}, RestBs}.
+disasm_map_inst(Inst, Bs0, Atoms, Literals) ->
+ {F, Bs1} = decode_arg(Bs0, Atoms, Literals),
+ {S, Bs2} = decode_arg(Bs1, Atoms, Literals),
+ {X, Bs3} = decode_arg(Bs2, Atoms, Literals),
+ {N, Bs4} = decode_arg(Bs3, Atoms, Literals),
+ {Z, Bs5} = decode_arg(Bs4, Atoms, Literals),
+ {U, Bs6} = decode_arg(Bs5, Atoms, Literals),
+ {u, Len} = U,
+ {List, RestBs} = decode_n_args(Len, Bs6, Atoms, Literals),
+ {{Inst, [F,S,X,N,{Z,U,List}]}, RestBs}.
+
%%-----------------------------------------------------------------------
%% decode_arg([Byte]) -> {Arg, [Byte]}
%%
@@ -421,7 +436,7 @@ decode_arg([B|Bs]) ->
decode_arg([B|Bs0], Atoms, Literals) ->
Tag = decode_tag(B band 2#111),
- ?NO_DEBUG('Tag = ~p, B = ~p, Bs = ~p~n', [Tag, B, Bs]),
+ ?NO_DEBUG('Tag = ~p, B = ~p, Bs = ~p~n', [Tag, B, Bs0]),
case Tag of
z ->
decode_z_tagged(Tag, B, Bs0, Literals);
@@ -1119,6 +1134,27 @@ resolve_inst({line,[Index]},_,_,_) ->
{line,resolve_arg(Index)};
%%
+%% R17A.
+%%
+resolve_inst({put_map_assoc,Args},_,_,_) ->
+ [FLbl,Src,Dst,{u,N},{{z,1},{u,_Len},List0}] = Args,
+ List = resolve_args(List0),
+ {put_map_assoc,FLbl,Src,Dst,N,{list,List}};
+
+resolve_inst({put_map_exact,Args},_,_,_) ->
+ [FLbl,Src,Dst,{u,N},{{z,1},{u,_Len},List0}] = Args,
+ List = resolve_args(List0),
+ {put_map_exact,FLbl,Src,Dst,N,{list,List}};
+
+resolve_inst({is_map,Args0},_,_,_) ->
+ [FLbl|Args] = resolve_args(Args0),
+ {test, is_map, FLbl, Args};
+
+resolve_inst({get_map_element,Args},_,_,_) ->
+ [FLbl,Src,Key,Dst] = resolve_args(Args),
+ {get_map_element,FLbl,Src,Key,Dst};
+
+%%
%% Catches instructions that are not yet handled.
%%
resolve_inst(X,_,_,_) -> ?exit({resolve_inst,X}).