aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-11-18 18:47:55 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-11-18 18:47:55 +0100
commit8b93e77a6d3df65e45a3ca3e2ec9dd4c52464f63 (patch)
tree659ca0b135d368f317a53459eb848233c0930909 /erts/emulator
parent5d764f988ab09326d24e39a172083b09ab364c6c (diff)
downloadotp-8b93e77a6d3df65e45a3ca3e2ec9dd4c52464f63.tar.gz
otp-8b93e77a6d3df65e45a3ca3e2ec9dd4c52464f63.tar.bz2
otp-8b93e77a6d3df65e45a3ca3e2ec9dd4c52464f63.zip
Use sharing preserving copy in enif_make_copy
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/erl_nif.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index a37cda93ef..2ff509e6d0 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -379,9 +379,19 @@ ERL_NIF_TERM enif_make_copy(ErlNifEnv* dst_env, ERL_NIF_TERM src_term)
{
Uint sz;
Eterm* hp;
+#ifdef SHCOPY
+ erts_shcopy_t info;
+ INITIALIZE_SHCOPY(info);
+ sz = copy_shared_calculate(src_term, &info);
+ hp = alloc_heap(dst_env, sz);
+ src_term = copy_shared_perform(src_term, sz, &info, &hp, &MSO(dst_env->proc));
+ DESTROY_SHCOPY(info);
+ return src_term;
+#else
sz = size_object(src_term);
hp = alloc_heap(dst_env, sz);
return copy_struct(src_term, sz, &hp, &MSO(dst_env->proc));
+#endif
}