diff options
author | Björn Gustavsson <[email protected]> | 2018-09-05 13:25:28 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2018-09-05 13:25:28 +0200 |
commit | 66b797b4aeca486f515d96c1677cc633ce12a5d3 (patch) | |
tree | 1d5d55a26a42a97b1f052fa87cfe772e212b6775 /lib/compiler/src/beam_disasm.erl | |
parent | 092f4847f489cba0381676a6a389ddbfc2af4f1e (diff) | |
parent | 47a2ff39ac75c69b41f90f05a63fd9a2e6c0b36a (diff) | |
download | otp-66b797b4aeca486f515d96c1677cc633ce12a5d3.tar.gz otp-66b797b4aeca486f515d96c1677cc633ce12a5d3.tar.bz2 otp-66b797b4aeca486f515d96c1677cc633ce12a5d3.zip |
Merge pull request #1947 from bjorng/bjorn/opt-put-tuple
Introduce a put_tuple2 instruction
Diffstat (limited to 'lib/compiler/src/beam_disasm.erl')
-rw-r--r-- | lib/compiler/src/beam_disasm.erl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_disasm.erl b/lib/compiler/src/beam_disasm.erl index 6cee9acae4..d0be39f520 100644 --- a/lib/compiler/src/beam_disasm.erl +++ b/lib/compiler/src/beam_disasm.erl @@ -373,6 +373,8 @@ disasm_instr(B, Bs, Atoms, Literals) -> disasm_map_inst(get_map_elements, Arity, Bs, Atoms, Literals); has_map_fields -> disasm_map_inst(has_map_fields, Arity, Bs, Atoms, Literals); + put_tuple2 -> + disasm_put_tuple2(Bs, Atoms, Literals); _ -> try decode_n_args(Arity, Bs, Atoms, Literals) of {Args, RestBs} -> @@ -413,6 +415,14 @@ disasm_map_inst(Inst, Arity, Bs0, Atoms, Literals) -> {List, RestBs} = decode_n_args(Len, Bs2, Atoms, Literals), {{Inst, Args ++ [{Z,U,List}]}, RestBs}. +disasm_put_tuple2(Bs, Atoms, Literals) -> + {X, Bs1} = decode_arg(Bs, Atoms, Literals), + {Z, Bs2} = decode_arg(Bs1, Atoms, Literals), + {U, Bs3} = decode_arg(Bs2, Atoms, Literals), + {u, Len} = U, + {List, RestBs} = decode_n_args(Len, Bs3, Atoms, Literals), + {{put_tuple2, [X,{Z,U,List}]}, RestBs}. + %%----------------------------------------------------------------------- %% decode_arg([Byte]) -> {Arg, [Byte]} %% @@ -1096,6 +1106,13 @@ resolve_inst({get_tl,[Src,Dst]},_,_,_) -> {get_tl,Src,Dst}; %% +%% OTP 22. +%% +resolve_inst({put_tuple2,[Dst,{{z,1},{u,_},List0}]},_,_,_) -> + List = resolve_args(List0), + {put_tuple2,Dst,{list,List}}; + +%% %% Catches instructions that are not yet handled. %% resolve_inst(X,_,_,_) -> ?exit({resolve_inst,X}). |