Age | Commit message (Collapse) | Author | |
---|---|---|---|
2017-05-04 | Update copyright year | Raimo Niskanen | |
2017-02-20 | Ensure prim_eval:'receive' wont clobber def_arg_reg[0] | Rickard Green | |
def_arg_reg[0] is used for storage of timeout instruction when a 'receive after' is executed. When a process was scheduled out inside prim_eval:'receive'/0 due to a function call, def_arg_reg[0] was overwritten due to storage of live registers. prim_eval:'receive'/2 now calls arg_reg_alloc/0 which bumps all reductions and then calls arg_reg_alloc/7 which will cause an allocation of a new arg_reg array since def_arg_reg only can hold 6 values. This ensures that the timeout instruction in def_arg_reg[0] used for the timeout wont be overwritten. | |||
2016-03-15 | update copyright-year | Henrik Nord | |
2015-06-18 | Change license text to APLv2 | Bruce Yinhe | |
2013-05-28 | Fix receive support in erl_eval with a BEAM module | Anthony Ramine | |
Using the low-level BEAM instructions, we can loop over each message in the process queue and removes the first message that matches, without receiving them all to later send them back to itself. The function prim_eval:'receive'/2 is equivalent to the following pseudo-code: 'receive'(F, T) -> RESET MESSAGE QUEUE POINTER, LOOP: case PEEK CURRENT MESSAGE WITH TIMEOUT T of {ok,Msg} -> case F(Msg) of nomatch -> DECREMENT TIMEOUT T, ADVANCE MESSAGE QUEUE POINTER, GOTO LOOP; Result -> RESET MESSAGE QUEUE POINTER, Result end; timeout -> RESET MESSAGE QUEUE POINTER, timeout end. To not break Dialyzer and other tools, we use a stub Erlang module which abstract code is forcefully inserted into prim_inet.erl afterwards compilation. |