Functions | |
static __inline void | tm_write_barrier_node (tm_node *n) |
Must be called after any ptrs within the tm_node n are mutated. | |
void | __tm_write_barrier_ignore (void *ptr) |
Write barrier for nothing. |
void __tm_write_barrier_ignore | ( | void * | ptr | ) |
static __inline void tm_write_barrier_node | ( | tm_node * | n | ) | [static] |
Must be called after any ptrs within the tm_node n are mutated.
If node is tm_ECRU, It has not been reached yet.
If node is tm_GREY, it is already marked for scanning.
If this node is already being scanned, resume scanning on another node.
This should be very rare.
See _tm_node_scan_some().
If node is tm_BLACK, The node has already been marked and scanned. The mutator may have introduced new pointers to ECRU nodes.
Reschedule it to be scanned.
Definition at line 41 of file barrier.c.
References tm_data::node_color_iter, tm_node_iterator::scan_node, tm, tm_abort(), tm_BLACK, tm_ECRU, tm_GREY, tm_msg(), tm_node_color, tm_node_set_color(), tm_node_to_block(), tm_time_stat_begin(), tm_time_stat_end(), tm_data::trigger_full_gc, and tm_data::ts_barrier_black.
Referenced by __tm_write_barrier(), and __tm_write_barrier_pure().
00042 { 00043 switch ( tm_node_color(n) ) { 00044 case tm_ECRU: 00045 /** 00046 * If node is tm_ECRU, 00047 * It has not been reached yet. 00048 */ 00049 break; 00050 00051 case tm_GREY: 00052 /** 00053 * If node is tm_GREY, 00054 * it is already marked for scanning. 00055 */ 00056 00057 /** 00058 * If this node is already being scanned, 00059 * resume scanning on another node. 00060 * 00061 * This should be very rare. 00062 * 00063 * See _tm_node_scan_some(). 00064 */ 00065 if ( tm.node_color_iter[tm_GREY].scan_node == n ) { 00066 // tm_abort(); 00067 #if 0 00068 fprintf(stderr, "*"); 00069 fflush(stderr); 00070 #endif 00071 tm.trigger_full_gc = 1; 00072 } 00073 break; 00074 00075 case tm_BLACK: 00076 /** 00077 * If node is tm_BLACK, 00078 * The node has already been marked and scanned. 00079 * The mutator may have introduced new pointers 00080 * to ECRU nodes. 00081 * 00082 * Reschedule it to be scanned. 00083 */ 00084 #if tm_TIME_STAT 00085 tm_time_stat_begin(&tm.ts_barrier_black); 00086 #endif 00087 00088 tm_node_set_color(n, tm_node_to_block(n), tm_GREY); 00089 00090 #if 0 00091 fprintf(stderr, "G"); 00092 fflush(stderr); 00093 #endif 00094 00095 #if tm_TIME_STAT 00096 tm_time_stat_end(&tm.ts_barrier_black); 00097 #endif 00098 #if 0 00099 tm_msg("w b n%p\n", n); 00100 #endif 00101 break; 00102 00103 default: 00104 tm_abort(); 00105 break; 00106 } 00107 }