Functions | |
void | __tm_write_barrier_root (void *ptr) |
Write barrier for root or stack pointers. |
void __tm_write_barrier_root | ( | void * | ptr | ) |
Write barrier for root or stack pointers.
Don't know if this root has been marked yet or not.
Begin time stats.
If the ptr is a reference to a stack allocated object, do nothing, because the stack will be scanned atomically before the sweep phase.
Otherwise, If the ptr is a reference to the heap. Do nothing, because we haven't started marking yet.
Otherwise, ptr must be a pointer to statically allocated (root) object. Mark the roots as being mutated.
End time stats.
Definition at line 159 of file barrier.c.
References _tm_page_in_use(), tm_data::data_mutations, tm_root::h, RETURN, tm_data::roots, tm_data::stack_mutations, tm, tm_msg(), tm_ptr_h, tm_ptr_l, tm_time_stat_begin(), tm_time_stat_end(), and tm_data::ts_barrier_root.
Referenced by tm_init().
00160 { 00161 /*! Begin time stats. */ 00162 #if tm_TIME_STAT 00163 tm_time_stat_begin(&tm.ts_barrier_root); 00164 #endif 00165 00166 /** 00167 * If the ptr is a reference to a stack allocated object, 00168 * do nothing, because the stack will be scanned atomically before 00169 * the sweep phase. 00170 */ 00171 if ( (void*) &ptr <= ptr && ptr <= tm.roots[1].h ) { 00172 ++ tm.stack_mutations; 00173 #if 0 00174 tm_msg("w s p%p\n", ptr); 00175 #endif 00176 RETURN; 00177 } 00178 00179 /** 00180 * Otherwise, 00181 * If the ptr is a reference to the heap. 00182 * Do nothing, because we haven't started marking yet. 00183 */ 00184 #if 1 00185 if ( _tm_page_in_use(ptr) ) 00186 RETURN; 00187 #else 00188 if ( tm_ptr_l <= ptr && ptr <= tm_ptr_h ) 00189 RETURN; 00190 #endif 00191 00192 /** 00193 * Otherwise, ptr must be a pointer to statically allocated (root) object. 00194 * Mark the roots as being mutated. 00195 */ 00196 ++ tm.data_mutations; 00197 #if 0 00198 tm_msg("w r p%p\n", ptr); 00199 #endif 00200 00201 _return: 00202 (void) 0; 00203 00204 /*! End time stats. */ 00205 #if tm_TIME_STAT 00206 tm_time_stat_end(&tm.ts_barrier_root); 00207 #endif 00208 }