forked from lei.chen/myxce
fix: correct SEL_NUM bit-cast in gc test; assert n1 swept; add recompact to protocol comment
This commit is contained in:
parent
9a19a8f932
commit
4e177047c9
2 changed files with 12 additions and 3 deletions
|
|
@ -123,7 +123,7 @@ extern void recompact_node_ids(void);
|
|||
|
||||
/* GC mark primitives — called by scheduler to implement the mark phase.
|
||||
* Protocol: gc_clear_marks() → gc_mark_select_tree(root) per live node
|
||||
* → gc_sweep_select_nodes(NULL, 0) */
|
||||
* → gc_sweep_select_nodes(NULL, 0) → recompact_node_ids() */
|
||||
extern void gc_clear_marks(void);
|
||||
extern void gc_mark_select_tree(xce_select_node_t* node);
|
||||
|
||||
|
|
|
|||
|
|
@ -2193,8 +2193,12 @@ test_gc_clear_marks_exported(void)
|
|||
sel_optimize_set(1);
|
||||
sel_node_table_init();
|
||||
|
||||
xce_select_node_t* n1 = makeSelectNode(SEL_NUM, (uintptr_t)1.0, 0);
|
||||
xce_select_node_t* n2 = makeSelectNode(SEL_NUM, (uintptr_t)2.0, 0);
|
||||
double d1 = 1.0, d2 = 2.0;
|
||||
uintptr_t b1, b2;
|
||||
memcpy(&b1, &d1, sizeof(b1));
|
||||
memcpy(&b2, &d2, sizeof(b2));
|
||||
xce_select_node_t* n1 = makeSelectNode(SEL_NUM, b1, 0);
|
||||
xce_select_node_t* n2 = makeSelectNode(SEL_NUM, b2, 0);
|
||||
TEST_ASSERT_NOT_NULL(n1);
|
||||
TEST_ASSERT_NOT_NULL(n2);
|
||||
|
||||
|
|
@ -2213,6 +2217,11 @@ test_gc_clear_marks_exported(void)
|
|||
gc_sweep_select_nodes(NULL, 0);
|
||||
TEST_ASSERT_EQUAL_INT(1, n2->gc_mark);
|
||||
|
||||
/* verify n1 was swept — re-interning gives a fresh allocation */
|
||||
xce_select_node_t* n1_again = makeSelectNode(SEL_NUM, b1, 0);
|
||||
TEST_ASSERT_NOT_NULL(n1_again);
|
||||
TEST_ASSERT_NOT_EQUAL(n1, n1_again); /* different pointer = n1 was freed */
|
||||
|
||||
sel_node_table_fini();
|
||||
sel_optimize_test_reset();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue