diff options
author | Rickard Green <[email protected]> | 2017-02-02 18:19:49 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2017-02-03 14:57:11 +0100 |
commit | 7eff21e2b0b86f798cce29835cd85a414d3d1be5 (patch) | |
tree | a0440443435c04b6814fe0676371def7459c6b73 /erts/emulator | |
parent | 51faafa9a20c4afa7944b8089b26f22c774bed19 (diff) | |
download | otp-7eff21e2b0b86f798cce29835cd85a414d3d1be5.tar.gz otp-7eff21e2b0b86f798cce29835cd85a414d3d1be5.tar.bz2 otp-7eff21e2b0b86f798cce29835cd85a414d3d1be5.zip |
Use a hole-marker that cannot be mistaken for a valid term on the heap
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/beam/erl_init.c | 5 | ||||
-rw-r--r-- | erts/emulator/beam/erl_vm.h | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c index 2fd97208cc..6c744553c3 100644 --- a/erts/emulator/beam/erl_init.c +++ b/erts/emulator/beam/erl_init.c @@ -117,6 +117,11 @@ const int etp_big_endian = 1; const int etp_big_endian = 0; #endif const Eterm etp_the_non_value = THE_NON_VALUE; +#ifdef ERTS_HOLE_MARKER +const Eterm etp_hole_marker = ERTS_HOLE_MARKER; +#else +const Eterm etp_hole_marker = 0; +#endif /* * Note about VxWorks: All variables must be initialized by executable code, diff --git a/erts/emulator/beam/erl_vm.h b/erts/emulator/beam/erl_vm.h index f97716d030..899e2a275a 100644 --- a/erts/emulator/beam/erl_vm.h +++ b/erts/emulator/beam/erl_vm.h @@ -110,8 +110,21 @@ #define HeapWordsLeft(p) (HEAP_LIMIT(p) - HEAP_TOP(p)) #if defined(DEBUG) || defined(CHECK_FOR_HOLES) -# define ERTS_HOLE_MARKER (((0xdeadbeef << 24) << 8) | 0xdeadbeef) -#endif /* egil: 32-bit ? */ + +/* + * ERTS_HOLE_MARKER must *not* be mistaken for a valid term + * on the heap... + */ +# ifdef ARCH_64 +# define ERTS_HOLE_MARKER \ + make_catch(UWORD_CONSTANT(0xdeadbeaf00000000) >> _TAG_IMMED2_SIZE) +/* Will (at the time of writing) appear as 0xdeadbeaf0000001b */ +# else +# define ERTS_HOLE_MARKER \ + make_catch(UWORD_CONSTANT(0xdead0000) >> _TAG_IMMED2_SIZE) +/* Will (at the time of writing) appear as 0xdead001b */ +# endif +#endif /* * Allocate heap memory on the ordinary heap, NEVER in a heap |