Skip to content
Browse files

Introduce the new recv_mark/1 and recv_mark/1 instructions

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...
1 parent ea0f50d commit d60f055697cfe8e7f94be4d291d49bb00a66bc52 @bjorng bjorng committed
View
6 erts/emulator/beam/ops.tab
@@ -1421,3 +1421,9 @@ i_gc_bif1 j I s I d
# R13B03
#
on_load
+
+#
+# R14A.
+#
+recv_mark Lbl =>
+recv_set Lbl =>
View
8 lib/compiler/src/beam_disasm.erl
@@ -1096,6 +1096,14 @@ 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.
%%
resolve_inst(X,_,_,_) -> ?exit({resolve_inst,X}).
View
5 lib/compiler/src/beam_validator.erl
@@ -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),
View
5 lib/compiler/src/genop.tab
@@ -274,3 +274,8 @@ BEAM_FORMAT_NUMBER=0
# R13B03
149: on_load/0
+
+# R14A
+
+150: recv_mark/1
+151: recv_set/1
View
5 lib/hipe/icode/hipe_beam_to_icode.erl
@@ -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, ...} ---
%%--------------------------------------------------------------------

0 comments on commit d60f055

Please sign in to comment.
Something went wrong with that request. Please try again.