< prev index next >

src/hotspot/share/oops/method.cpp

Print this page




 216 void Method::mask_for(int bci, InterpreterOopMap* mask) {
 217   methodHandle h_this(Thread::current(), this);
 218   // Only GC uses the OopMapCache during thread stack root scanning
 219   // any other uses generate an oopmap but do not save it in the cache.
 220   if (Universe::heap()->is_gc_active()) {
 221     method_holder()->mask_for(h_this, bci, mask);
 222   } else {
 223     OopMapCache::compute_one_oop_map(h_this, bci, mask);
 224   }
 225   return;
 226 }
 227 
 228 
 229 int Method::bci_from(address bcp) const {
 230   if (is_native() && bcp == 0) {
 231     return 0;
 232   }
 233 #ifdef ASSERT
 234   {
 235     ResourceMark rm;



 236     assert(is_native() && bcp == code_base() || contains(bcp) || VMError::is_error_reported(),
 237            "bcp doesn't belong to this method: bcp: " INTPTR_FORMAT ", method: %s",
 238            p2i(bcp), name_and_sig_as_C_string());
 239   }
 240 #endif
 241   return bcp - code_base();
 242 }
 243 
 244 
 245 int Method::validate_bci(int bci) const {
 246   return (bci == 0 || bci < code_size()) ? bci : -1;
 247 }
 248 
 249 // Return bci if it appears to be a valid bcp
 250 // Return -1 otherwise.
 251 // Used by profiling code, when invalid data is a possibility.
 252 // The caller is responsible for validating the Method* itself.
 253 int Method::validate_bci_from_bcp(address bcp) const {
 254   // keep bci as -1 if not a valid bci
 255   int bci = -1;




 216 void Method::mask_for(int bci, InterpreterOopMap* mask) {
 217   methodHandle h_this(Thread::current(), this);
 218   // Only GC uses the OopMapCache during thread stack root scanning
 219   // any other uses generate an oopmap but do not save it in the cache.
 220   if (Universe::heap()->is_gc_active()) {
 221     method_holder()->mask_for(h_this, bci, mask);
 222   } else {
 223     OopMapCache::compute_one_oop_map(h_this, bci, mask);
 224   }
 225   return;
 226 }
 227 
 228 
 229 int Method::bci_from(address bcp) const {
 230   if (is_native() && bcp == 0) {
 231     return 0;
 232   }
 233 #ifdef ASSERT
 234   {
 235     ResourceMark rm;
 236     if (!((is_native() && bcp == code_base()) || contains(bcp) || VMError::is_error_reported())) {
 237       tty->print("ouch!\n");
 238     }
 239     assert(is_native() && bcp == code_base() || contains(bcp) || VMError::is_error_reported(),
 240            "bcp doesn't belong to this method: bcp: " INTPTR_FORMAT ", method: %s",
 241            p2i(bcp), name_and_sig_as_C_string());
 242   }
 243 #endif
 244   return bcp - code_base();
 245 }
 246 
 247 
 248 int Method::validate_bci(int bci) const {
 249   return (bci == 0 || bci < code_size()) ? bci : -1;
 250 }
 251 
 252 // Return bci if it appears to be a valid bcp
 253 // Return -1 otherwise.
 254 // Used by profiling code, when invalid data is a possibility.
 255 // The caller is responsible for validating the Method* itself.
 256 int Method::validate_bci_from_bcp(address bcp) const {
 257   // keep bci as -1 if not a valid bci
 258   int bci = -1;


< prev index next >