4
%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
4
%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
9
9
%% Erlang Public License along with this software. If not, it can be
10
10
%% retrieved online at http://www.erlang.org/.
12
12
%% Software distributed under the License is distributed on an "AS IS"
13
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
%% the License for the specific language governing rights and limitations
15
15
%% under the License.
18
18
%%=======================================================================
623
623
%% New make_fun2/4 instruction added in August 2001 (R8).
624
%% New put_literal/2 instruction added in Feb 2006 R11B-4.
625
%% We handle them specially here to avoid adding an argument to
624
%% We handle it specially here to avoid adding an argument to
626
625
%% the clause for every instruction.
631
630
{OldIndex,{F,A,_Lbl,_Index,NumFree,OldUniq}} =
632
631
lists:keyfind(OldIndex, 1, Lambdas),
633
632
{make_fun2,{M,F,A},OldIndex,OldUniq,NumFree};
634
resolve_inst({put_literal,[{u,Index},Dst]},_,_,_,_,Literals,_) ->
635
{put_literal,{literal,gb_trees:get(Index, Literals)},Dst};
636
633
resolve_inst(Instr, Imports, Str, Lbls, _Lambdas, _Literals, _M) ->
637
634
%% io:format(?MODULE_STRING":resolve_inst ~p.~n", [Instr]),
638
635
resolve_inst(Instr, Imports, Str, Lbls).
1004
1001
[F,Live,Bif,A1,A2,Reg] = resolve_args(Args),
1005
1002
{extfunc,_Mod,BifName,_Arity} = lookup(Bif+1,Imports),
1006
1003
{gc_bif,BifName,F,Live,[A1,A2],Reg};
1005
%% New instruction in R14, gc_bif with 3 arguments
1007
resolve_inst({gc_bif3,Args},Imports,_,_) ->
1008
[F,Live,Bif,A1,A2,A3,Reg] = resolve_args(Args),
1009
{extfunc,_Mod,BifName,_Arity} = lookup(Bif+1,Imports),
1010
{gc_bif,BifName,F,Live,[A1,A2,A3],Reg};
1009
1013
%% New instructions for creating non-byte aligned binaries.
1011
resolve_inst({bs_bits_to_bytes2,[_Arg2,_Arg3]=Args},_,_,_) ->
1012
[A2,A3] = resolve_args(Args),
1013
{bs_bits_to_bytes2,A2,A3};
1014
1015
resolve_inst({bs_final2,[X,Y]},_,_,_) ->
1015
1016
{bs_final2,X,Y};
1102
resolve_inst({recv_mark,[Lbl]},_,_,_) ->
1104
resolve_inst({recv_set,[Lbl]},_,_,_) ->
1099
1108
%% Catches instructions that are not yet handled.
1101
1110
resolve_inst(X,_,_,_) -> ?exit({resolve_inst,X}).