@@ -1515,20 +1515,20 @@ check_rvalue_consistency_force(const VALUE obj, int terminate)
15151515#if USE_MMTK
15161516 if (!rb_mmtk_enabled_p ()) {
15171517#endif
1518- /* check if it is in tomb_pages */
1519- struct heap_page * page = NULL ;
1520- for (int i = 0 ; i < SIZE_POOL_COUNT ; i ++ ) {
1521- rb_size_pool_t * size_pool = & size_pools [i ];
1522- ccan_list_for_each (& size_pool -> tomb_heap .pages , page , page_node ) {
1523- if (page -> start <= (uintptr_t )obj &&
1524- (uintptr_t )obj < (page -> start + (page -> total_slots * size_pool -> slot_size ))) {
1525- fprintf (stderr , "check_rvalue_consistency: %p is in a tomb_heap (%p).\n" ,
1526- (void * )obj , (void * )page );
1527- err ++ ;
1528- goto skip ;
1529- }
1518+ /* check if it is in tomb_pages */
1519+ struct heap_page * page = NULL ;
1520+ for (int i = 0 ; i < SIZE_POOL_COUNT ; i ++ ) {
1521+ rb_size_pool_t * size_pool = & size_pools [i ];
1522+ ccan_list_for_each (& size_pool -> tomb_heap .pages , page , page_node ) {
1523+ if (page -> start <= (uintptr_t )obj &&
1524+ (uintptr_t )obj < (page -> start + (page -> total_slots * size_pool -> slot_size ))) {
1525+ fprintf (stderr , "check_rvalue_consistency: %p is in a tomb_heap (%p).\n" ,
1526+ (void * )obj , (void * )page );
1527+ err ++ ;
1528+ goto skip ;
15301529 }
15311530 }
1531+ }
15321532#if USE_MMTK
15331533 }
15341534#endif
@@ -1578,46 +1578,46 @@ check_rvalue_consistency_force(const VALUE obj, int terminate)
15781578#if USE_MMTK
15791579 if (!mmtk_enabled_local ) {
15801580#endif
1581- /* check generation
1582- *
1583- * OLD == age == 3 && old-bitmap && mark-bit (except incremental marking)
1584- */
1585- if (age > 0 && wb_unprotected_bit ) {
1586- fprintf (stderr , "check_rvalue_consistency: %s is not WB protected, but age is %d > 0.\n" , obj_info (obj ), age );
1587- err ++ ;
1588- }
1581+ /* check generation
1582+ *
1583+ * OLD == age == 3 && old-bitmap && mark-bit (except incremental marking)
1584+ */
1585+ if (age > 0 && wb_unprotected_bit ) {
1586+ fprintf (stderr , "check_rvalue_consistency: %s is not WB protected, but age is %d > 0.\n" , obj_info (obj ), age );
1587+ err ++ ;
1588+ }
15891589
1590- if (!is_marking (objspace ) && uncollectible_bit && !mark_bit ) {
1591- fprintf (stderr , "check_rvalue_consistency: %s is uncollectible, but is not marked while !gc.\n" , obj_info (obj ));
1590+ if (!is_marking (objspace ) && uncollectible_bit && !mark_bit ) {
1591+ fprintf (stderr , "check_rvalue_consistency: %s is uncollectible, but is not marked while !gc.\n" , obj_info (obj ));
1592+ err ++ ;
1593+ }
1594+
1595+ if (!is_full_marking (objspace )) {
1596+ if (uncollectible_bit && age != RVALUE_OLD_AGE && !wb_unprotected_bit ) {
1597+ fprintf (stderr , "check_rvalue_consistency: %s is uncollectible, but not old (age: %d) and not WB unprotected.\n" ,
1598+ obj_info (obj ), age );
15921599 err ++ ;
15931600 }
1594-
1595- if (!is_full_marking (objspace )) {
1596- if (uncollectible_bit && age != RVALUE_OLD_AGE && !wb_unprotected_bit ) {
1597- fprintf (stderr , "check_rvalue_consistency: %s is uncollectible, but not old (age: %d) and not WB unprotected.\n" ,
1598- obj_info (obj ), age );
1599- err ++ ;
1600- }
1601- if (remembered_bit && age != RVALUE_OLD_AGE ) {
1602- fprintf (stderr , "check_rvalue_consistency: %s is remembered, but not old (age: %d).\n" ,
1603- obj_info (obj ), age );
1604- err ++ ;
1605- }
1601+ if (remembered_bit && age != RVALUE_OLD_AGE ) {
1602+ fprintf (stderr , "check_rvalue_consistency: %s is remembered, but not old (age: %d).\n" ,
1603+ obj_info (obj ), age );
1604+ err ++ ;
16061605 }
1606+ }
16071607
1608- /*
1609- * check coloring
1610- *
1611- * marking:false marking:true
1612- * marked:false white *invalid*
1613- * marked:true black grey
1614- */
1615- if (is_incremental_marking (objspace ) && marking_bit ) {
1616- if (!is_marking (objspace ) && !mark_bit ) {
1617- fprintf (stderr , "check_rvalue_consistency: %s is marking, but not marked.\n" , obj_info (obj ));
1618- err ++ ;
1619- }
1608+ /*
1609+ * check coloring
1610+ *
1611+ * marking:false marking:true
1612+ * marked:false white *invalid*
1613+ * marked:true black grey
1614+ */
1615+ if (is_incremental_marking (objspace ) && marking_bit ) {
1616+ if (!is_marking (objspace ) && !mark_bit ) {
1617+ fprintf (stderr , "check_rvalue_consistency: %s is marking, but not marked.\n" , obj_info (obj ));
1618+ err ++ ;
16201619 }
1620+ }
16211621#if USE_MMTK
16221622 }
16231623#endif
@@ -2593,10 +2593,10 @@ newobj_init(VALUE klass, VALUE flags, int wb_protected, rb_objspace_t *objspace,
25932593#if USE_MMTK
25942594 if (!rb_mmtk_enabled_p ()) {
25952595#endif
2596- if (UNLIKELY (wb_protected == FALSE)) {
2597- ASSERT_vm_locking ();
2598- MARK_IN_BITMAP (GET_HEAP_WB_UNPROTECTED_BITS (obj ), obj );
2599- }
2596+ if (UNLIKELY (wb_protected == FALSE)) {
2597+ ASSERT_vm_locking ();
2598+ MARK_IN_BITMAP (GET_HEAP_WB_UNPROTECTED_BITS (obj ), obj );
2599+ }
26002600#if USE_MMTK
26012601 }
26022602#endif
@@ -3556,9 +3556,9 @@ make_zombie(rb_objspace_t *objspace, VALUE obj, void (*dfree)(void *), void *dat
35563556 // With MMTk, we decouple deferred jobs from memory management.
35573557 if (!rb_mmtk_enabled_p ()) {
35583558#endif
3559- struct heap_page * page = GET_HEAP_PAGE (obj );
3560- page -> final_slots ++ ;
3561- heap_pages_final_slots ++ ;
3559+ struct heap_page * page = GET_HEAP_PAGE (obj );
3560+ page -> final_slots ++ ;
3561+ heap_pages_final_slots ++ ;
35623562#if USE_MMTK
35633563 }
35643564#endif
@@ -3620,7 +3620,7 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
36203620#if USE_MMTK
36213621 if (!rb_mmtk_enabled_p ()) {
36223622#endif
3623- if (RVALUE_WB_UNPROTECTED (obj )) CLEAR_IN_BITMAP (GET_HEAP_WB_UNPROTECTED_BITS (obj ), obj );
3623+ if (RVALUE_WB_UNPROTECTED (obj )) CLEAR_IN_BITMAP (GET_HEAP_WB_UNPROTECTED_BITS (obj ), obj );
36243624#if USE_MMTK
36253625 }
36263626#endif
@@ -4001,20 +4001,20 @@ Init_heap(void)
40014001 if (!rb_mmtk_enabled_p ()) {
40024002#endif
40034003#if RGENGC_ESTIMATE_OLDMALLOC
4004- objspace -> rgengc .oldmalloc_increase_limit = gc_params .oldmalloc_limit_min ;
4004+ objspace -> rgengc .oldmalloc_increase_limit = gc_params .oldmalloc_limit_min ;
40054005#endif
40064006
4007- heap_add_pages (objspace , & size_pools [0 ], SIZE_POOL_EDEN_HEAP (& size_pools [0 ]), gc_params .heap_init_slots / HEAP_PAGE_OBJ_LIMIT );
4007+ heap_add_pages (objspace , & size_pools [0 ], SIZE_POOL_EDEN_HEAP (& size_pools [0 ]), gc_params .heap_init_slots / HEAP_PAGE_OBJ_LIMIT );
40084008
4009- /* Give other size pools allocatable pages. */
4010- for (int i = 1 ; i < SIZE_POOL_COUNT ; i ++ ) {
4011- rb_size_pool_t * size_pool = & size_pools [i ];
4012- int multiple = size_pool -> slot_size / BASE_SLOT_SIZE ;
4013- size_pool -> allocatable_pages = gc_params .heap_init_slots * multiple / HEAP_PAGE_OBJ_LIMIT ;
4014- }
4015- heap_pages_expand_sorted (objspace );
4009+ /* Give other size pools allocatable pages. */
4010+ for (int i = 1 ; i < SIZE_POOL_COUNT ; i ++ ) {
4011+ rb_size_pool_t * size_pool = & size_pools [i ];
4012+ int multiple = size_pool -> slot_size / BASE_SLOT_SIZE ;
4013+ size_pool -> allocatable_pages = gc_params .heap_init_slots * multiple / HEAP_PAGE_OBJ_LIMIT ;
4014+ }
4015+ heap_pages_expand_sorted (objspace );
40164016
4017- init_mark_stack (& objspace -> mark_stack );
4017+ init_mark_stack (& objspace -> mark_stack );
40184018#if USE_MMTK
40194019 }
40204020#endif
@@ -4609,20 +4609,20 @@ finalize_list(rb_objspace_t *objspace, VALUE zombie)
46094609#if USE_MMTK
46104610 if (!mmtk_enabled_local ) {
46114611#endif
4612- // TODO: will probably need to re-enable this section when we
4613- // implement object/ID bijective mappings
4614- GC_ASSERT (BUILTIN_TYPE (zombie ) == T_ZOMBIE );
4615- if (FL_TEST (zombie , FL_SEEN_OBJ_ID )) {
4616- obj_free_object_id (objspace , zombie );
4617- }
4612+ // TODO: will probably need to re-enable this section when we
4613+ // implement object/ID bijective mappings
4614+ GC_ASSERT (BUILTIN_TYPE (zombie ) == T_ZOMBIE );
4615+ if (FL_TEST (zombie , FL_SEEN_OBJ_ID )) {
4616+ obj_free_object_id (objspace , zombie );
4617+ }
46184618
4619- GC_ASSERT (heap_pages_final_slots > 0 );
4620- GC_ASSERT (page -> final_slots > 0 );
4619+ GC_ASSERT (heap_pages_final_slots > 0 );
4620+ GC_ASSERT (page -> final_slots > 0 );
46214621
4622- heap_pages_final_slots -- ;
4623- page -> final_slots -- ;
4624- page -> free_slots ++ ;
4625- heap_page_add_freeobj (objspace , page , zombie );
4622+ heap_pages_final_slots -- ;
4623+ page -> final_slots -- ;
4624+ page -> free_slots ++ ;
4625+ heap_page_add_freeobj (objspace , page , zombie );
46264626#if USE_MMTK
46274627 }
46284628#endif
@@ -4723,19 +4723,19 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
47234723 // We need mmtk-core to support PhantomReference.
47244724 if (!rb_mmtk_enabled_p ()) {
47254725#endif
4726- /* force to run finalizer */
4727- while (finalizer_table -> num_entries ) {
4728- struct force_finalize_list * list = 0 ;
4729- st_foreach (finalizer_table , force_chain_object , (st_data_t )& list );
4730- while (list ) {
4731- struct force_finalize_list * curr = list ;
4732- st_data_t obj = (st_data_t )curr -> obj ;
4733- run_finalizer (objspace , curr -> obj , curr -> table );
4734- st_delete (finalizer_table , & obj , 0 );
4735- list = curr -> next ;
4736- xfree (curr );
4737- }
4726+ /* force to run finalizer */
4727+ while (finalizer_table -> num_entries ) {
4728+ struct force_finalize_list * list = 0 ;
4729+ st_foreach (finalizer_table , force_chain_object , (st_data_t )& list );
4730+ while (list ) {
4731+ struct force_finalize_list * curr = list ;
4732+ st_data_t obj = (st_data_t )curr -> obj ;
4733+ run_finalizer (objspace , curr -> obj , curr -> table );
4734+ st_delete (finalizer_table , & obj , 0 );
4735+ list = curr -> next ;
4736+ xfree (curr );
47384737 }
4738+ }
47394739#if USE_MMTK
47404740 }
47414741#endif
@@ -7845,9 +7845,9 @@ gc_mark_roots(rb_objspace_t *objspace, const char **categoryp)
78457845#if USE_MMTK
78467846 if (!mmtk_enabled_local ) {
78477847#endif
7848- // When using MMTk, the current thread is a GC worker. Mutators are scanned separately.
7849- MARK_CHECKPOINT ("machine_context" );
7850- mark_current_machine_context (objspace , ec );
7848+ // When using MMTk, the current thread is a GC worker. Mutators are scanned separately.
7849+ MARK_CHECKPOINT ("machine_context" );
7850+ mark_current_machine_context (objspace , ec );
78517851#if USE_MMTK
78527852 }
78537853#endif
@@ -11558,8 +11558,8 @@ gc_stat_internal(VALUE hash_or_sym)
1155811558#if USE_MMTK
1155911559 if (!rb_mmtk_enabled_p ()) {
1156011560#endif
11561- SET (count , objspace -> profile .count );
11562- SET (time , (size_t ) (objspace -> profile .total_time_ns / (1000 * 1000 ) /* ns -> ms */ )); // TODO: UINT64T2NUM
11561+ SET (count , objspace -> profile .count );
11562+ SET (time , (size_t ) (objspace -> profile .total_time_ns / (1000 * 1000 ) /* ns -> ms */ )); // TODO: UINT64T2NUM
1156311563#if USE_MMTK
1156411564 }
1156511565#endif
0 commit comments