src/share/vm/opto/runtime.cpp

Print this page
rev 1178 : merge with cd37471eaecc from http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot


 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();


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


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