src/share/vm/runtime/frame.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8004128_2 Sdiff src/share/vm/runtime

src/share/vm/runtime/frame.cpp

Print this page




 395 // Interpreter frames
 396 
 397 
 398 void frame::interpreter_frame_set_locals(intptr_t* locs)  {
 399   assert(is_interpreted_frame(), "Not an interpreted frame");
 400   *interpreter_frame_locals_addr() = locs;
 401 }
 402 
 403 Method* frame::interpreter_frame_method() const {
 404   assert(is_interpreted_frame(), "interpreted frame expected");
 405   Method* m = *interpreter_frame_method_addr();
 406   assert(m->is_method(), "not a Method*");
 407   return m;
 408 }
 409 
 410 void frame::interpreter_frame_set_method(Method* method) {
 411   assert(is_interpreted_frame(), "interpreted frame expected");
 412   *interpreter_frame_method_addr() = method;
 413 }
 414 
 415 void frame::interpreter_frame_set_bcx(intptr_t bcx) {
 416   assert(is_interpreted_frame(), "Not an interpreted frame");
 417   if (ProfileInterpreter) {
 418     bool formerly_bci = is_bci(interpreter_frame_bcx());
 419     bool is_now_bci = is_bci(bcx);
 420     *interpreter_frame_bcx_addr() = bcx;
 421 
 422     intptr_t mdx = interpreter_frame_mdx();
 423 
 424     if (mdx != 0) {
 425       if (formerly_bci) {
 426         if (!is_now_bci) {
 427           // The bcx was just converted from bci to bcp.
 428           // Convert the mdx in parallel.
 429           MethodData* mdo = interpreter_frame_method()->method_data();
 430           assert(mdo != NULL, "");
 431           int mdi = mdx - 1; // We distinguish valid mdi from zero by adding one.
 432           address mdp = mdo->di_to_dp(mdi);
 433           interpreter_frame_set_mdx((intptr_t)mdp);
 434         }
 435       } else {
 436         if (is_now_bci) {
 437           // The bcx was just converted from bcp to bci.
 438           // Convert the mdx in parallel.
 439           MethodData* mdo = interpreter_frame_method()->method_data();
 440           assert(mdo != NULL, "");
 441           int mdi = mdo->dp_to_di((address)mdx);
 442           interpreter_frame_set_mdx((intptr_t)mdi + 1); // distinguish valid from 0.
 443         }
 444       }
 445     }
 446   } else {
 447     *interpreter_frame_bcx_addr() = bcx;
 448   }
 449 }
 450 
 451 jint frame::interpreter_frame_bci() const {
 452   assert(is_interpreted_frame(), "interpreted frame expected");
 453   intptr_t bcx = interpreter_frame_bcx();
 454   return is_bci(bcx) ? bcx : interpreter_frame_method()->bci_from((address)bcx);
 455 }
 456 
 457 void frame::interpreter_frame_set_bci(jint bci) {
 458   assert(is_interpreted_frame(), "interpreted frame expected");
 459   assert(!is_bci(interpreter_frame_bcx()), "should not set bci during GC");
 460   interpreter_frame_set_bcx((intptr_t)interpreter_frame_method()->bcp_from(bci));
 461 }
 462 
 463 address frame::interpreter_frame_bcp() const {
 464   assert(is_interpreted_frame(), "interpreted frame expected");
 465   intptr_t bcx = interpreter_frame_bcx();
 466   return is_bci(bcx) ? interpreter_frame_method()->bcp_from(bcx) : (address)bcx;
 467 }
 468 
 469 void frame::interpreter_frame_set_bcp(address bcp) {
 470   assert(is_interpreted_frame(), "interpreted frame expected");
 471   assert(!is_bci(interpreter_frame_bcx()), "should not set bcp during GC");
 472   interpreter_frame_set_bcx((intptr_t)bcp);
 473 }
 474 
 475 void frame::interpreter_frame_set_mdx(intptr_t mdx) {
 476   assert(is_interpreted_frame(), "Not an interpreted frame");
 477   assert(ProfileInterpreter, "must be profiling interpreter");
 478   *interpreter_frame_mdx_addr() = mdx;
 479 }
 480 
 481 address frame::interpreter_frame_mdp() const {
 482   assert(ProfileInterpreter, "must be profiling interpreter");
 483   assert(is_interpreted_frame(), "interpreted frame expected");
 484   intptr_t bcx = interpreter_frame_bcx();
 485   intptr_t mdx = interpreter_frame_mdx();
 486 
 487   assert(!is_bci(bcx), "should not access mdp during GC");
 488   return (address)mdx;
 489 }
 490 
 491 void frame::interpreter_frame_set_mdp(address mdp) {
 492   assert(is_interpreted_frame(), "interpreted frame expected");
 493   if (mdp == NULL) {
 494     // Always allow the mdp to be cleared.
 495     interpreter_frame_set_mdx((intptr_t)mdp);
 496   }
 497   intptr_t bcx = interpreter_frame_bcx();
 498   assert(!is_bci(bcx), "should not set mdp during GC");
 499   interpreter_frame_set_mdx((intptr_t)mdp);
 500 }
 501 
 502 BasicObjectLock* frame::next_monitor_in_interpreter_frame(BasicObjectLock* current) const {
 503   assert(is_interpreted_frame(), "Not an interpreted frame");
 504 #ifdef ASSERT
 505   interpreter_frame_verify_monitor(current);
 506 #endif
 507   BasicObjectLock* next = (BasicObjectLock*) (((intptr_t*) current) + interpreter_frame_monitor_size());
 508   return next;
 509 }
 510 
 511 BasicObjectLock* frame::previous_monitor_in_interpreter_frame(BasicObjectLock* current) const {
 512   assert(is_interpreted_frame(), "Not an interpreted frame");
 513 #ifdef ASSERT
 514 //   // This verification needs to be checked before being enabled
 515 //   interpreter_frame_verify_monitor(current);
 516 #endif
 517   BasicObjectLock* previous = (BasicObjectLock*) (((intptr_t*) current) - interpreter_frame_monitor_size());
 518   return previous;
 519 }


1164     ShouldNotReachHere();
1165   }
1166 }
1167 
1168 void frame::nmethods_do(CodeBlobClosure* cf) {
1169   if (_cb != NULL && _cb->is_nmethod()) {
1170     cf->do_code_blob(_cb);
1171   }
1172 }
1173 
1174 
1175 // call f() on the interpreted Method*s in the stack.
1176 // Have to walk the entire code cache for the compiled frames Yuck.
1177 void frame::metadata_do(void f(Metadata*)) {
1178   if (_cb != NULL && Interpreter::contains(pc())) {
1179     Method* m = this->interpreter_frame_method();
1180     assert(m != NULL, "huh?");
1181     f(m);
1182   }
1183 }
1184 
1185 void frame::gc_prologue() {
1186   if (is_interpreted_frame()) {
1187     // set bcx to bci to become Method* position independent during GC
1188     interpreter_frame_set_bcx(interpreter_frame_bci());
1189   }
1190 }
1191 
1192 
1193 void frame::gc_epilogue() {
1194   if (is_interpreted_frame()) {
1195     // set bcx back to bcp for interpreter
1196     interpreter_frame_set_bcx((intptr_t)interpreter_frame_bcp());
1197   }
1198   // call processor specific epilog function
1199   pd_gc_epilog();
1200 }
1201 
1202 
1203 # ifdef ENABLE_ZAP_DEAD_LOCALS
1204 
1205 void frame::CheckValueClosure::do_oop(oop* p) {
1206   if (CheckOopishValues && Universe::heap()->is_in_reserved(*p)) {
1207     warning("value @ " INTPTR_FORMAT " looks oopish (" INTPTR_FORMAT ") (thread = " INTPTR_FORMAT ")", p, (address)*p, Thread::current());
1208   }
1209 }
1210 frame::CheckValueClosure frame::_check_value;
1211 
1212 
1213 void frame::CheckOopClosure::do_oop(oop* p) {
1214   if (*p != NULL && !(*p)->is_oop()) {
1215     warning("value @ " INTPTR_FORMAT " should be an oop (" INTPTR_FORMAT ") (thread = " INTPTR_FORMAT ")", p, (address)*p, Thread::current());
1216  }
1217 }
1218 frame::CheckOopClosure frame::_check_oop;
1219 
1220 void frame::check_derived_oop(oop* base, oop* derived) {
1221   _check_oop.do_oop(base);




 395 // Interpreter frames
 396 
 397 
 398 void frame::interpreter_frame_set_locals(intptr_t* locs)  {
 399   assert(is_interpreted_frame(), "Not an interpreted frame");
 400   *interpreter_frame_locals_addr() = locs;
 401 }
 402 
 403 Method* frame::interpreter_frame_method() const {
 404   assert(is_interpreted_frame(), "interpreted frame expected");
 405   Method* m = *interpreter_frame_method_addr();
 406   assert(m->is_method(), "not a Method*");
 407   return m;
 408 }
 409 
 410 void frame::interpreter_frame_set_method(Method* method) {
 411   assert(is_interpreted_frame(), "interpreted frame expected");
 412   *interpreter_frame_method_addr() = method;
 413 }
 414 




































 415 jint frame::interpreter_frame_bci() const {
 416   assert(is_interpreted_frame(), "interpreted frame expected");
 417   address bcp = interpreter_frame_bcp();
 418   return interpreter_frame_method()->bci_from(bcp);






 419 }
 420 
 421 address frame::interpreter_frame_bcp() const {
 422   assert(is_interpreted_frame(), "interpreted frame expected");
 423   return (address)*interpreter_frame_bcp_addr();

 424 }
 425 
 426 void frame::interpreter_frame_set_bcp(address bcp) {
 427   assert(is_interpreted_frame(), "interpreted frame expected");
 428   *interpreter_frame_bcp_addr() = (intptr_t)bcp;







 429 }
 430 
 431 address frame::interpreter_frame_mdp() const {
 432   assert(ProfileInterpreter, "must be profiling interpreter");
 433   assert(is_interpreted_frame(), "interpreted frame expected");
 434   return (address)*interpreter_frame_mdp_addr();




 435 }
 436 
 437 void frame::interpreter_frame_set_mdp(address mdp) {
 438   assert(is_interpreted_frame(), "interpreted frame expected");
 439   assert(ProfileInterpreter, "must be profiling interpreter");
 440   *interpreter_frame_mdp_addr() = (intptr_t)mdp;





 441 }
 442 
 443 BasicObjectLock* frame::next_monitor_in_interpreter_frame(BasicObjectLock* current) const {
 444   assert(is_interpreted_frame(), "Not an interpreted frame");
 445 #ifdef ASSERT
 446   interpreter_frame_verify_monitor(current);
 447 #endif
 448   BasicObjectLock* next = (BasicObjectLock*) (((intptr_t*) current) + interpreter_frame_monitor_size());
 449   return next;
 450 }
 451 
 452 BasicObjectLock* frame::previous_monitor_in_interpreter_frame(BasicObjectLock* current) const {
 453   assert(is_interpreted_frame(), "Not an interpreted frame");
 454 #ifdef ASSERT
 455 //   // This verification needs to be checked before being enabled
 456 //   interpreter_frame_verify_monitor(current);
 457 #endif
 458   BasicObjectLock* previous = (BasicObjectLock*) (((intptr_t*) current) - interpreter_frame_monitor_size());
 459   return previous;
 460 }


1105     ShouldNotReachHere();
1106   }
1107 }
1108 
1109 void frame::nmethods_do(CodeBlobClosure* cf) {
1110   if (_cb != NULL && _cb->is_nmethod()) {
1111     cf->do_code_blob(_cb);
1112   }
1113 }
1114 
1115 
1116 // call f() on the interpreted Method*s in the stack.
1117 // Have to walk the entire code cache for the compiled frames Yuck.
1118 void frame::metadata_do(void f(Metadata*)) {
1119   if (_cb != NULL && Interpreter::contains(pc())) {
1120     Method* m = this->interpreter_frame_method();
1121     assert(m != NULL, "huh?");
1122     f(m);
1123   }
1124 }


















1125 
1126 # ifdef ENABLE_ZAP_DEAD_LOCALS
1127 
1128 void frame::CheckValueClosure::do_oop(oop* p) {
1129   if (CheckOopishValues && Universe::heap()->is_in_reserved(*p)) {
1130     warning("value @ " INTPTR_FORMAT " looks oopish (" INTPTR_FORMAT ") (thread = " INTPTR_FORMAT ")", p, (address)*p, Thread::current());
1131   }
1132 }
1133 frame::CheckValueClosure frame::_check_value;
1134 
1135 
1136 void frame::CheckOopClosure::do_oop(oop* p) {
1137   if (*p != NULL && !(*p)->is_oop()) {
1138     warning("value @ " INTPTR_FORMAT " should be an oop (" INTPTR_FORMAT ") (thread = " INTPTR_FORMAT ")", p, (address)*p, Thread::current());
1139  }
1140 }
1141 frame::CheckOopClosure frame::_check_oop;
1142 
1143 void frame::check_derived_oop(oop* base, oop* derived) {
1144   _check_oop.do_oop(base);


src/share/vm/runtime/frame.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File