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

src/share/vm/runtime/frame.cpp

Print this page




1094   }
1095 }
1096 
1097 void frame::nmethods_do(CodeBlobClosure* cf) {
1098   if (_cb != NULL && _cb->is_nmethod()) {
1099     cf->do_code_blob(_cb);
1100   }
1101 }
1102 
1103 
1104 // call f() on the interpreted Method*s in the stack.
1105 // Have to walk the entire code cache for the compiled frames Yuck.
1106 void frame::metadata_do(void f(Metadata*)) {
1107   if (is_interpreted_frame()) {
1108     Method* m = this->interpreter_frame_method();
1109     assert(m != NULL, "expecting a method in this frame");
1110     f(m);
1111   }
1112 }
1113 
1114 # ifdef ENABLE_ZAP_DEAD_LOCALS
1115 
1116 void frame::CheckValueClosure::do_oop(oop* p) {
1117   if (CheckOopishValues && Universe::heap()->is_in_reserved(*p)) {
1118     warning("value @ " INTPTR_FORMAT " looks oopish (" INTPTR_FORMAT ") (thread = " INTPTR_FORMAT ")", p, (address)*p, Thread::current());
1119   }
1120 }
1121 frame::CheckValueClosure frame::_check_value;
1122 
1123 
1124 void frame::CheckOopClosure::do_oop(oop* p) {
1125   if (*p != NULL && !(*p)->is_oop()) {
1126     warning("value @ " INTPTR_FORMAT " should be an oop (" INTPTR_FORMAT ") (thread = " INTPTR_FORMAT ")", p, (address)*p, Thread::current());
1127  }
1128 }
1129 frame::CheckOopClosure frame::_check_oop;
1130 
1131 void frame::check_derived_oop(oop* base, oop* derived) {
1132   _check_oop.do_oop(base);
1133 }
1134 
1135 
1136 void frame::ZapDeadClosure::do_oop(oop* p) {
1137   if (TraceZapDeadLocals) tty->print_cr("zapping @ " INTPTR_FORMAT " containing " INTPTR_FORMAT, p, (address)*p);
1138   *p = cast_to_oop<intptr_t>(0xbabebabe);
1139 }
1140 frame::ZapDeadClosure frame::_zap_dead;
1141 
1142 void frame::zap_dead_locals(JavaThread* thread, const RegisterMap* map) {
1143   assert(thread == Thread::current(), "need to synchronize to do this to another thread");
1144   // Tracing - part 1
1145   if (TraceZapDeadLocals) {
1146     ResourceMark rm(thread);
1147     tty->print_cr("--------------------------------------------------------------------------------");
1148     tty->print("Zapping dead locals in ");
1149     print_on(tty);
1150     tty->cr();
1151   }
1152   // Zapping
1153        if (is_entry_frame      ()) zap_dead_entry_locals      (thread, map);
1154   else if (is_interpreted_frame()) zap_dead_interpreted_locals(thread, map);
1155   else if (is_compiled_frame()) zap_dead_compiled_locals   (thread, map);
1156 
1157   else
1158     // could be is_runtime_frame
1159     // so remove error: ShouldNotReachHere();
1160     ;
1161   // Tracing - part 2
1162   if (TraceZapDeadLocals) {
1163     tty->cr();
1164   }
1165 }
1166 
1167 
1168 void frame::zap_dead_interpreted_locals(JavaThread *thread, const RegisterMap* map) {
1169   // get current interpreter 'pc'
1170   assert(is_interpreted_frame(), "Not an interpreted frame");
1171   Method* m   = interpreter_frame_method();
1172   int       bci = interpreter_frame_bci();
1173 
1174   int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
1175 
1176   // process dynamic part
1177   InterpreterFrameClosure value_blk(this, max_locals, m->max_stack(),
1178                                     &_check_value);
1179   InterpreterFrameClosure   oop_blk(this, max_locals, m->max_stack(),
1180                                     &_check_oop  );
1181   InterpreterFrameClosure  dead_blk(this, max_locals, m->max_stack(),
1182                                     &_zap_dead   );
1183 
1184   // get frame map
1185   InterpreterOopMap mask;
1186   m->mask_for(bci, &mask);
1187   mask.iterate_all( &oop_blk, &value_blk, &dead_blk);
1188 }
1189 
1190 
1191 void frame::zap_dead_compiled_locals(JavaThread* thread, const RegisterMap* reg_map) {
1192 
1193   ResourceMark rm(thread);
1194   assert(_cb != NULL, "sanity check");
1195   if (_cb->oop_maps() != NULL) {
1196     OopMapSet::all_do(this, reg_map, &_check_oop, check_derived_oop, &_check_value);
1197   }
1198 }
1199 
1200 
1201 void frame::zap_dead_entry_locals(JavaThread*, const RegisterMap*) {
1202   if (TraceZapDeadLocals) warning("frame::zap_dead_entry_locals unimplemented");
1203 }
1204 
1205 
1206 void frame::zap_dead_deoptimized_locals(JavaThread*, const RegisterMap*) {
1207   if (TraceZapDeadLocals) warning("frame::zap_dead_deoptimized_locals unimplemented");
1208 }
1209 
1210 # endif // ENABLE_ZAP_DEAD_LOCALS
1211 
1212 void frame::verify(const RegisterMap* map) {
1213   // for now make sure receiver type is correct
1214   if (is_interpreted_frame()) {
1215     Method* method = interpreter_frame_method();
1216     guarantee(method->is_method(), "method is wrong in frame::verify");
1217     if (!method->is_static()) {
1218       // fetch the receiver
1219       oop* p = (oop*) interpreter_frame_local_at(0);
1220       // make sure we have the right receiver type
1221     }
1222   }
1223   COMPILER2_PRESENT(assert(DerivedPointerTable::is_empty(), "must be empty before verify");)
1224   oops_do_internal(&VerifyOopClosure::verify_oop, NULL, NULL, (RegisterMap*)map, false);
1225 }
1226 
1227 
1228 #ifdef ASSERT
1229 bool frame::verify_return_pc(address x) {
1230   if (StubRoutines::returns_to_call_stub(x)) {
1231     return true;




1094   }
1095 }
1096 
1097 void frame::nmethods_do(CodeBlobClosure* cf) {
1098   if (_cb != NULL && _cb->is_nmethod()) {
1099     cf->do_code_blob(_cb);
1100   }
1101 }
1102 
1103 
1104 // call f() on the interpreted Method*s in the stack.
1105 // Have to walk the entire code cache for the compiled frames Yuck.
1106 void frame::metadata_do(void f(Metadata*)) {
1107   if (is_interpreted_frame()) {
1108     Method* m = this->interpreter_frame_method();
1109     assert(m != NULL, "expecting a method in this frame");
1110     f(m);
1111   }
1112 }
1113 


































































































1114 void frame::verify(const RegisterMap* map) {
1115   // for now make sure receiver type is correct
1116   if (is_interpreted_frame()) {
1117     Method* method = interpreter_frame_method();
1118     guarantee(method->is_method(), "method is wrong in frame::verify");
1119     if (!method->is_static()) {
1120       // fetch the receiver
1121       oop* p = (oop*) interpreter_frame_local_at(0);
1122       // make sure we have the right receiver type
1123     }
1124   }
1125   COMPILER2_PRESENT(assert(DerivedPointerTable::is_empty(), "must be empty before verify");)
1126   oops_do_internal(&VerifyOopClosure::verify_oop, NULL, NULL, (RegisterMap*)map, false);
1127 }
1128 
1129 
1130 #ifdef ASSERT
1131 bool frame::verify_return_pc(address x) {
1132   if (StubRoutines::returns_to_call_stub(x)) {
1133     return true;


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