Skip to content

Commit 9bb8f4b

Browse files
committed
Remove the HAS_MOVED_GIVTBL bit
We no longer use the HAS_MOVED_GIVTBL bit in the hidden header. Now when we try to get the givtbl of a potentially moved object, we first look up the global general_iv_tbl_ and, if not found, look up the RubyBinding::moved_givtbl table in the Rust part of the binding.
1 parent a38a525 commit 9bb8f4b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

internal/mmtk.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ typedef uint32_t MMTk_AllocationSemantics;
2929

3030
#define MMTK_GC_THREAD_KIND_WORKER 1
3131

32-
#define MMTK_HAS_MOVED_GIVTBL 9223372036854775808ull
33-
3432
#define MMTK_HIDDEN_SIZE_MASK 281474976710655
3533

3634
typedef struct st_table st_table;
@@ -271,4 +269,6 @@ void mmtk_object_reference_write_post(MMTk_Mutator *mutator, MMTk_ObjectReferenc
271269
*/
272270
void mmtk_enumerate_objects(void (*callback)(MMTk_ObjectReference, void*), void *data);
273271

272+
bool mmtk_hidden_header_is_sane(const struct MMTk_HiddenHeader *hidden_header);
273+
274274
#endif /* MMTK_H */

mmtk_support.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ rb_mmtk_init_hidden_header(VALUE object, size_t payload_size)
404404

405405
struct MMTk_HiddenHeader *hidden_header = (struct MMTk_HiddenHeader*)(object - MMTK_OBJREF_OFFSET);
406406
hidden_header->prefix = payload_size;
407+
408+
RUBY_ASSERT(mmtk_hidden_header_is_sane(hidden_header),
409+
"Hidden header is not sane on construction. Object: %p, prefix: %zx",
410+
(void*) object, hidden_header->prefix);
407411
}
408412

409413
size_t
@@ -412,8 +416,9 @@ rb_mmtk_get_payload_size(VALUE object)
412416
struct MMTk_HiddenHeader *hidden_header = (struct MMTk_HiddenHeader*)(object - MMTK_OBJREF_OFFSET);
413417
size_t prefix = hidden_header->prefix;
414418

415-
RUBY_ASSERT((prefix & ~(MMTK_HIDDEN_SIZE_MASK | MMTK_HAS_MOVED_GIVTBL)) == 0,
416-
"Hidden field is corrupted. Object: %p, prefix: %zx", (void*) object, prefix);
419+
RUBY_ASSERT(mmtk_hidden_header_is_sane(hidden_header),
420+
"Hidden header is corrupted. Object: %p, prefix: %zx",
421+
(void*) object, prefix);
417422

418423
return prefix & MMTK_HIDDEN_SIZE_MASK;
419424
}

0 commit comments

Comments
 (0)