Write Barrier: General

Functions

void __tm_write_barrier (void *ptr)
 Write barrier for general references.

Function Documentation

void __tm_write_barrier ( void *  ptr  ) 

Write barrier for general references.

Begin time stats.

If the ptr is a reference to a stack allocated object, do nothing, because the stack will be marked before the sweep phase.

Otherwise, if the ptr is a reference to a node, schedule it for remarking if it has already been marked.

If it is not a reference to a node, It must be a reference to a statically allocated object. This means the data root set has (probably) been mutated. Must flag the roots for remarking before the sweep phase.

End time stats.

Definition at line 223 of file barrier.c.

References tm_data::data_mutations, tm_root::h, RETURN, tm_data::roots, tm_data::stack_mutations, tm, tm_msg(), tm_ptr_to_node(), tm_time_stat_begin(), tm_time_stat_end(), tm_write_barrier_node(), and tm_data::ts_barrier.

Referenced by tm_init().

00224 {
00225   tm_node *n;
00226 
00227   /*! Begin time stats. */
00228 #if tm_TIME_STAT
00229   tm_time_stat_begin(&tm.ts_barrier);
00230 #endif
00231 
00232   /**
00233    * If the ptr is a reference to a stack allocated object,
00234    * do nothing, because the stack will be marked before
00235    * the sweep phase.
00236    */
00237   if ( (void*) &ptr <= ptr && ptr <= tm.roots[1].h ) {
00238     ++ tm.stack_mutations; 
00239     // tm_msg("w s p%p\n", ptr);
00240     RETURN;
00241   }
00242 
00243   /**
00244    * Otherwise,
00245    * if the ptr is a reference to a node,
00246    * schedule it for remarking if it has already been marked.
00247    *
00248    * If it is not a reference to a node,
00249    * It must be a reference to a statically allocated object.
00250    * This means the data root set has (probably) been mutated.
00251    * Must flag the roots for remarking before the sweep phase.
00252    */
00253   if ( (n = tm_ptr_to_node(ptr)) ) {
00254     tm_write_barrier_node(n);
00255   } else {
00256     ++ tm.data_mutations;
00257 #if 0
00258     tm_msg("w r p%p\n", ptr);
00259 #endif
00260   }
00261 
00262  _return:
00263   (void) 0;
00264 
00265   /*! End time stats. */
00266 #if tm_TIME_STAT
00267   tm_time_stat_end(&tm.ts_barrier);
00268 #endif
00269 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Mon Jan 25 06:33:12 2010 for TM(tredmill) by  doxygen 1.6.1