diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-10-24 01:50:14 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-10-24 01:50:14 +0300 |
commit | 753cec25f5641d904797e96998a0ec34b3bb4fed (patch) | |
tree | 5bd18e79d720745ced410c175ee0f059bbad8fdd | |
parent | 5533d1c7c7d96950b8bec9d38c4a452d4b104689 (diff) | |
download | bdwgc-753cec25f5641d904797e96998a0ec34b3bb4fed.tar.gz |
Add I_HOLD_LOCK assertion to expand_hp_inner and related functions
(code refactoring)
* alloc.c (GC_expand_hp_inner, GC_collect_or_expand): Add
GC_ASSERT(I_HOLD_LOCK()) at the beginning of the function.
* obj_map.c (GC_register_displacement_inner): Likewise.
-rw-r--r-- | alloc.c | 2 | ||||
-rw-r--r-- | obj_map.c | 1 |
2 files changed, 3 insertions, 0 deletions
@@ -1340,6 +1340,7 @@ GC_INNER GC_bool GC_expand_hp_inner(word n) word expansion_slop; /* Number of bytes by which we expect the */ /* heap to expand soon. */ + GC_ASSERT(I_HOLD_LOCK()); if (n < MINHINCR) n = MINHINCR; bytes = ROUNDUP_PAGESIZE((size_t)n * HBLKSIZE); if (GC_max_heapsize != 0 @@ -1433,6 +1434,7 @@ GC_INNER GC_bool GC_collect_or_expand(word needed_blocks, word blocks_to_get; IF_CANCEL(int cancel_state;) + GC_ASSERT(I_HOLD_LOCK()); DISABLE_CANCEL(cancel_state); if (!GC_incremental && !GC_dont_gc && ((GC_dont_expand && GC_bytes_allocd > 0) @@ -35,6 +35,7 @@ GC_API void GC_CALL GC_register_displacement(size_t offset) GC_INNER void GC_register_displacement_inner(size_t offset) { + GC_ASSERT(I_HOLD_LOCK()); if (offset >= VALID_OFFSET_SZ) { ABORT("Bad argument to GC_register_displacement"); } |