Skip to content

Commit

Permalink
Introduce the new recv_mark/1 and recv_mark/1 instructions
Browse files Browse the repository at this point in the history
Make the recv_mark/1 and recv_mark/1 instructions known to the
compiler and run-time system. For the moment, make the loader ignore
any occurrences of those instructions in BEAM files.

Also update hipe_beam_to_icode to ignore those instructions.
  • Loading branch information
bjorng committed May 11, 2010
1 parent ea0f50d commit d60f055
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions erts/emulator/beam/ops.tab
Original file line number Diff line number Diff line change
Expand Up @@ -1421,3 +1421,9 @@ i_gc_bif1 j I s I d
# R13B03
#
on_load

#
# R14A.
#
recv_mark Lbl =>
recv_set Lbl =>
8 changes: 8 additions & 0 deletions lib/compiler/src/beam_disasm.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,14 @@ resolve_inst({bs_put_utf32=I,[Lbl,{u,U},Arg3]},_,_,_) ->
resolve_inst({on_load,[]},_,_,_) ->
on_load;

%%
%% R14A.
%%
resolve_inst({recv_mark,[Lbl]},_,_,_) ->
{recv_mark,Lbl};
resolve_inst({recv_set,[Lbl]},_,_,_) ->
{recv_set,Lbl};

%%
%% Catches instructions that are not yet handled.
%%
Expand Down
5 changes: 5 additions & 0 deletions lib/compiler/src/beam_validator.erl
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ valfun_1({put,Src}, Vst) ->
valfun_1({put_string,Sz,_,Dst}, Vst0) when is_integer(Sz) ->
Vst = eat_heap(2*Sz, Vst0),
set_type_reg(cons, Dst, Vst);
%% Instructions for optimization of selective receives.
valfun_1({recv_mark,{f,Fail}}, Vst) when is_integer(Fail) ->
Vst;
valfun_1({recv_set,{f,Fail}}, Vst) when is_integer(Fail) ->
Vst;
%% Misc.
valfun_1({'%live',Live}, Vst) ->
verify_live(Live, Vst),
Expand Down
5 changes: 5 additions & 0 deletions lib/compiler/src/genop.tab
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,8 @@ BEAM_FORMAT_NUMBER=0
# R13B03

149: on_load/0

# R14A

150: recv_mark/1
151: recv_set/1
5 changes: 5 additions & 0 deletions lib/hipe/icode/hipe_beam_to_icode.erl
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ trans_fun([{wait_timeout,{_,Lbl},Reg}|Instructions], Env) ->
SuspTmout = hipe_icode:mk_if(suspend_msg_timeout,[],
map_label(Lbl),hipe_icode:label_name(DoneLbl)),
Movs ++ [SetTmout, SuspTmout, DoneLbl | trans_fun(Instructions,Env1)];
%%--- mark_recv/1 & mark_set/1 ---
trans_fun([{mark_recv,{f,_}}|Instructions], Env) ->
trans_fun(Instructions,Env);
trans_fun([{mark_set,{f,_}}|Instructions], Env) ->
trans_fun(Instructions,Env);
%%--------------------------------------------------------------------
%%--- Translation of arithmetics {bif,ArithOp, ...} ---
%%--------------------------------------------------------------------
Expand Down

0 comments on commit d60f055

Please sign in to comment.