diff options
author | Lukas Larsson <[email protected]> | 2016-02-18 13:52:54 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-04-07 09:54:14 +0200 |
commit | 57551877d85ad7659201235e27498be42809fefb (patch) | |
tree | d510785967a851f39150331f81da2b3b33b4b87f /erts/emulator/test/nif_SUITE_data | |
parent | 3f190b62031783ad4fc9bb1fb91703a1b1b40ad7 (diff) | |
download | otp-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_data')
-rw-r--r-- | erts/emulator/test/nif_SUITE_data/nif_SUITE.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c index b3c6cc5ba3..e369fb3386 100644 --- a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c +++ b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c @@ -1466,6 +1466,18 @@ static ERL_NIF_TERM send_term(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[ return enif_make_int(env, ret); } +static ERL_NIF_TERM send_copy_term(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) +{ + ErlNifEnv* menv; + ErlNifPid pid; + int ret; + if (!enif_get_local_pid(env, argv[0], &pid)) { + return enif_make_badarg(env); + } + ret = enif_send(env, &pid, NULL, argv[1]); + return enif_make_int(env, ret); +} + static ERL_NIF_TERM reverse_list(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { ERL_NIF_TERM rev_list; @@ -2142,6 +2154,7 @@ static ErlNifFunc nif_funcs[] = {"join_send_thread", 1, join_send_thread}, {"copy_blob", 1, copy_blob}, {"send_term", 2, send_term}, + {"send_copy_term", 2, send_copy_term}, {"reverse_list",1, reverse_list}, {"echo_int", 1, echo_int}, {"type_sizes", 0, type_sizes}, |