aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/nif_SUITE.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2016-02-18 13:52:54 +0100
committerLukas Larsson <[email protected]>2016-04-07 09:54:14 +0200
commit57551877d85ad7659201235e27498be42809fefb (patch)
treed510785967a851f39150331f81da2b3b33b4b87f /erts/emulator/test/nif_SUITE.erl
parent3f190b62031783ad4fc9bb1fb91703a1b1b40ad7 (diff)
downloadotp-57551877d85ad7659201235e27498be42809fefb.tar.gz
otp-57551877d85ad7659201235e27498be42809fefb.tar.bz2
otp-57551877d85ad7659201235e27498be42809fefb.zip
erts: Add enif_send with NULL as msg env
This is an optimization for reducing the number of heap fragments allocated when sending a message where the majority of the message payload is on the sending process' heap.
Diffstat (limited to 'erts/emulator/test/nif_SUITE.erl')
-rw-r--r--erts/emulator/test/nif_SUITE.erl13
1 files changed, 11 insertions, 2 deletions
diff --git a/erts/emulator/test/nif_SUITE.erl b/erts/emulator/test/nif_SUITE.erl
index a185b72341..aa512b2360 100644
--- a/erts/emulator/test/nif_SUITE.erl
+++ b/erts/emulator/test/nif_SUITE.erl
@@ -1282,9 +1282,10 @@ send3_make_blob() ->
repeat(N bsr 1,
fun(_) -> grow_blob(MsgEnv,other_term(),rand:uniform(1 bsl 20))
end, void),
- case (N band 1) of
+ case (N band 3) of
0 -> {term,copy_blob(MsgEnv)};
- 1 -> {msgenv,MsgEnv}
+ 1 -> {copy,copy_blob(MsgEnv)};
+ _ -> {msgenv,MsgEnv}
end
end.
@@ -1297,6 +1298,9 @@ send3_send(Pid, Msg) ->
send3_send_nif(Pid, {term,Blob}) ->
%%io:format("~p send term nif\n",[self()]),
send_term(Pid, {blob, Blob}) =:= 1;
+send3_send_nif(Pid, {copy,Blob}) ->
+ %%io:format("~p send term nif\n",[self()]),
+ send_copy_term(Pid, {blob, Blob}) =:= 1;
send3_send_nif(Pid, {msgenv,MsgEnv}) ->
%%io:format("~p send blob nif\n",[self()]),
send3_blob(MsgEnv, Pid, blob) =:= 1.
@@ -1305,6 +1309,10 @@ send3_send_bang(Pid, {term,Blob}) ->
%%io:format("~p send term bang\n",[self()]),
Pid ! {blob, Blob},
true;
+send3_send_bang(Pid, {copy,Blob}) ->
+ %%io:format("~p send term bang\n",[self()]),
+ Pid ! {blob, Blob},
+ true;
send3_send_bang(Pid, {msgenv,MsgEnv}) ->
%%io:format("~p send blob bang\n",[self()]),
Pid ! {blob, copy_blob(MsgEnv)},
@@ -2062,6 +2070,7 @@ send_blob_thread(_,_,_) -> ?nif_stub.
join_send_thread(_) -> ?nif_stub.
copy_blob(_) -> ?nif_stub.
send_term(_,_) -> ?nif_stub.
+send_copy_term(_,_) -> ?nif_stub.
reverse_list(_) -> ?nif_stub.
echo_int(_) -> ?nif_stub.
type_sizes() -> ?nif_stub.