< prev index next >

src/hotspot/share/interpreter/templateInterpreter.cpp

Print this page




 266   return entry;
 267 }
 268 
 269 //------------------------------------------------------------------------------------------------------------------------
 270 // Suport for invokes
 271 
 272 int TemplateInterpreter::TosState_as_index(TosState state) {
 273   assert( state < number_of_states , "Invalid state in TosState_as_index");
 274   assert(0 <= (int)state && (int)state < TemplateInterpreter::number_of_return_addrs, "index out of bounds");
 275   return (int)state;
 276 }
 277 
 278 
 279 //------------------------------------------------------------------------------------------------------------------------
 280 // Safepoint support
 281 
 282 static inline void copy_table(address* from, address* to, int size) {
 283   // Copy non-overlapping tables.
 284   if (SafepointSynchronize::is_at_safepoint()) {
 285     // Nothing is using the table at a safepoint so skip atomic word copy.
 286     while (size-- > 0) *to++ = *from++;
 287   } else {
 288     // Use atomic word copy when not at a safepoint for safety.
 289     Copy::disjoint_words_atomic((HeapWord*)from, (HeapWord*)to, (size_t)size);
 290   }
 291 }
 292 
 293 void TemplateInterpreter::notice_safepoints() {
 294   if (!_notice_safepoints) {
 295     log_debug(interpreter, safepoint)("switching active_table to safept_table.");
 296     // switch to safepoint dispatch table
 297     _notice_safepoints = true;
 298     copy_table((address*)&_safept_table, (address*)&_active_table, sizeof(_active_table) / sizeof(address));
 299   } else {
 300     log_debug(interpreter, safepoint)("active_table is already safept_table; "
 301                                       "notice_safepoints() call is no-op.");
 302   }
 303 }
 304 
 305 // switch from the dispatch table which notices safepoints back to the
 306 // normal dispatch table.  So that we can notice single stepping points,




 266   return entry;
 267 }
 268 
 269 //------------------------------------------------------------------------------------------------------------------------
 270 // Suport for invokes
 271 
 272 int TemplateInterpreter::TosState_as_index(TosState state) {
 273   assert( state < number_of_states , "Invalid state in TosState_as_index");
 274   assert(0 <= (int)state && (int)state < TemplateInterpreter::number_of_return_addrs, "index out of bounds");
 275   return (int)state;
 276 }
 277 
 278 
 279 //------------------------------------------------------------------------------------------------------------------------
 280 // Safepoint support
 281 
 282 static inline void copy_table(address* from, address* to, int size) {
 283   // Copy non-overlapping tables.
 284   if (SafepointSynchronize::is_at_safepoint()) {
 285     // Nothing is using the table at a safepoint so skip atomic word copy.
 286     Copy::disjoint_words((HeapWord*)from, (HeapWord*)to, (size_t)size);
 287   } else {
 288     // Use atomic word copy when not at a safepoint for safety.
 289     Copy::disjoint_words_atomic((HeapWord*)from, (HeapWord*)to, (size_t)size);
 290   }
 291 }
 292 
 293 void TemplateInterpreter::notice_safepoints() {
 294   if (!_notice_safepoints) {
 295     log_debug(interpreter, safepoint)("switching active_table to safept_table.");
 296     // switch to safepoint dispatch table
 297     _notice_safepoints = true;
 298     copy_table((address*)&_safept_table, (address*)&_active_table, sizeof(_active_table) / sizeof(address));
 299   } else {
 300     log_debug(interpreter, safepoint)("active_table is already safept_table; "
 301                                       "notice_safepoints() call is no-op.");
 302   }
 303 }
 304 
 305 // switch from the dispatch table which notices safepoints back to the
 306 // normal dispatch table.  So that we can notice single stepping points,


< prev index next >