src/share/vm/opto/runtime.cpp

Print this page
rev 1122 : refactored to check all 3 can_post_exception bits and other Dan comments


 793     if (!(exception->is_a(SystemDictionary::throwable_klass()))) {
 794       // should throw an exception here
 795       ShouldNotReachHere();
 796     }
 797   #endif
 798 
 799 
 800   // new exception handling: this method is entered only from adapters
 801   // exceptions from compiled java methods are handled in compiled code
 802   // using rethrow node
 803 
 804   address pc = thread->exception_pc();
 805   nm = CodeCache::find_nmethod(pc);
 806   assert(nm != NULL, "No NMethod found");
 807   if (nm->is_native_method()) {
 808     fatal("Native mathod should not have path to exception handling");
 809   } else {
 810     // we are switching to old paradigm: search for exception handler in caller_frame
 811     // instead in exception handler of caller_frame.sender()
 812 
 813     if (JvmtiExport::can_post_exceptions()) {

 814       // "Full-speed catching" is not necessary here,
 815       // since we're notifying the VM on every catch.
 816       // Force deoptimization and the rest of the lookup
 817       // will be fine.
 818       deoptimize_caller_frame(thread, true);
 819     }
 820 
 821     // Check the stack guard pages.  If enabled, look for handler in this frame;
 822     // otherwise, forcibly unwind the frame.
 823     //
 824     // 4826555: use default current sp for reguard_stack instead of &nm: it's more accurate.
 825     bool force_unwind = !thread->reguard_stack();
 826     bool deopting = false;
 827     if (nm->is_deopt_pc(pc)) {
 828       deopting = true;
 829       RegisterMap map(thread, false);
 830       frame deoptee = thread->last_frame().sender(&map);
 831       assert(deoptee.is_deoptimized_frame(), "must be deopted");
 832       // Adjust the pc back to the original throwing pc
 833       pc = deoptee.pc();


1191   }
1192   warning("no frame found to zap in zap_dead_Java_locals_C");
1193 }
1194 
1195 JRT_LEAF(void, OptoRuntime::zap_dead_Java_locals_C(JavaThread* thread))
1196   zap_dead_java_or_native_locals(thread, is_java_frame);
1197 JRT_END
1198 
1199 // The following does not work because for one thing, the
1200 // thread state is wrong; it expects java, but it is native.
1201 // Also, the invariants in a native stub are different and
1202 // I'm not sure it is safe to have a MachCalRuntimeDirectNode
1203 // in there.
1204 // So for now, we do not zap in native stubs.
1205 
1206 JRT_LEAF(void, OptoRuntime::zap_dead_native_locals_C(JavaThread* thread))
1207   zap_dead_java_or_native_locals(thread, is_native_frame);
1208 JRT_END
1209 
1210 # endif



 793     if (!(exception->is_a(SystemDictionary::throwable_klass()))) {
 794       // should throw an exception here
 795       ShouldNotReachHere();
 796     }
 797   #endif
 798 
 799 
 800   // new exception handling: this method is entered only from adapters
 801   // exceptions from compiled java methods are handled in compiled code
 802   // using rethrow node
 803 
 804   address pc = thread->exception_pc();
 805   nm = CodeCache::find_nmethod(pc);
 806   assert(nm != NULL, "No NMethod found");
 807   if (nm->is_native_method()) {
 808     fatal("Native mathod should not have path to exception handling");
 809   } else {
 810     // we are switching to old paradigm: search for exception handler in caller_frame
 811     // instead in exception handler of caller_frame.sender()
 812 
 813     // We only need to deoptimize if we exceptions can really cause some event notification
 814     if (thread->should_post_on_exceptions_flag()) {
 815       // "Full-speed catching" is not necessary here,
 816       // since we're notifying the VM on every catch.
 817       // Force deoptimization and the rest of the lookup
 818       // will be fine.
 819       deoptimize_caller_frame(thread, true);
 820     }
 821 
 822     // Check the stack guard pages.  If enabled, look for handler in this frame;
 823     // otherwise, forcibly unwind the frame.
 824     //
 825     // 4826555: use default current sp for reguard_stack instead of &nm: it's more accurate.
 826     bool force_unwind = !thread->reguard_stack();
 827     bool deopting = false;
 828     if (nm->is_deopt_pc(pc)) {
 829       deopting = true;
 830       RegisterMap map(thread, false);
 831       frame deoptee = thread->last_frame().sender(&map);
 832       assert(deoptee.is_deoptimized_frame(), "must be deopted");
 833       // Adjust the pc back to the original throwing pc
 834       pc = deoptee.pc();


1192   }
1193   warning("no frame found to zap in zap_dead_Java_locals_C");
1194 }
1195 
1196 JRT_LEAF(void, OptoRuntime::zap_dead_Java_locals_C(JavaThread* thread))
1197   zap_dead_java_or_native_locals(thread, is_java_frame);
1198 JRT_END
1199 
1200 // The following does not work because for one thing, the
1201 // thread state is wrong; it expects java, but it is native.
1202 // Also, the invariants in a native stub are different and
1203 // I'm not sure it is safe to have a MachCalRuntimeDirectNode
1204 // in there.
1205 // So for now, we do not zap in native stubs.
1206 
1207 JRT_LEAF(void, OptoRuntime::zap_dead_native_locals_C(JavaThread* thread))
1208   zap_dead_java_or_native_locals(thread, is_native_frame);
1209 JRT_END
1210 
1211 # endif
1212