diff options
author | Nikolaos S. Papaspyrou <[email protected]> | 2014-03-14 11:32:46 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-11-17 14:45:45 +0100 |
commit | 8d02ad60c88aa060ff83ff3179bc8c0ab66868ee (patch) | |
tree | 3368a591afaa2d23c9d7b38d70f80dc42785ccbb /erts/emulator/beam/copy.c | |
parent | 7141fa8e4534ab7e4dcc3cad6c46872efa0e6e66 (diff) | |
download | otp-8d02ad60c88aa060ff83ff3179bc8c0ab66868ee.tar.gz otp-8d02ad60c88aa060ff83ff3179bc8c0ab66868ee.tar.bz2 otp-8d02ad60c88aa060ff83ff3179bc8c0ab66868ee.zip |
Add machinery to enable SHCOPY dynamically
This commit is just for debugging purposes, will probably be reverted.
It comes with a the erts_debug:copy_shared/1 BIF. If SHCOPY_DISABLE
is defined, SHCOPY starts disabled and is dynamically enabled the first
time that the BIF is called.
Diffstat (limited to 'erts/emulator/beam/copy.c')
-rw-r--r-- | erts/emulator/beam/copy.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/erts/emulator/beam/copy.c b/erts/emulator/beam/copy.c index b31e043f08..2566707717 100644 --- a/erts/emulator/beam/copy.c +++ b/erts/emulator/beam/copy.c @@ -901,6 +901,10 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap) * Using an ESTACK but not very transparently; consider refactoring */ +#ifdef SHCOPY_DISABLE +int disable_copy_shared = ERTS_SHCOPY_FLG_NONE; +#endif + #define DECLARE_SHTABLE(s) \ DECLARE_ESTACK(s); \ Uint ESTK_CONCAT(s,_offset) = 0 @@ -1028,6 +1032,10 @@ Uint copy_shared_calculate(Eterm obj, shcopy_info *info, unsigned flags) if (IS_CONST(obj)) return 0; +#ifdef SHCOPY_DISABLE + flags |= disable_copy_shared; +#endif + myself = erts_get_current_process(); if (myself == NULL || (flags & ERTS_SHCOPY_FLG_NONE)) return size_object(obj); @@ -1276,6 +1284,10 @@ Uint copy_shared_perform(Eterm obj, Uint size, shcopy_info *info, Eterm** hpp, E if (IS_CONST(obj)) return obj; +#ifdef SHCOPY_DISABLE + flags |= disable_copy_shared; +#endif + myself = erts_get_current_process(); if (myself == NULL || (flags & ERTS_SHCOPY_FLG_NONE)) return copy_struct(obj, size, hpp, off_heap); |