comparison src/share/vm/jvmci/jvmciCompiler.cpp @ 22703:f190cf6fb28e

Don't abort if exceptions occur during JVMCI compilation
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 22 Oct 2015 11:26:30 -0700
parents a269bc93625b
children 24fd08e99b35
comparison
equal deleted inserted replaced
22702:15013021dbfa 22703:f190cf6fb28e
131 HandleMark hm; 131 HandleMark hm;
132 ResourceMark rm; 132 ResourceMark rm;
133 Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT); 133 Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT);
134 134
135 JavaValue method_result(T_OBJECT); 135 JavaValue method_result(T_OBJECT);
136 { 136 JavaCallArguments args;
137 args.push_long((jlong) (address) method());
138 JavaCalls::call_static(&method_result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(),
139 vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, THREAD);
140
141 if (!HAS_PENDING_EXCEPTION) {
142 JavaValue result(T_VOID);
137 JavaCallArguments args; 143 JavaCallArguments args;
138 args.push_long((jlong) (address) method()); 144 args.push_oop(receiver);
139 JavaCalls::call_static(&method_result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, CHECK_ABORT); 145 args.push_oop((oop)method_result.get_jobject());
146 args.push_int(entry_bci);
147 args.push_long((jlong) (address) env);
148 args.push_int(env->task()->compile_id());
149 JavaCalls::call_special(&result, receiver->klass(),
150 vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
140 } 151 }
141 152
142 JavaValue result(T_VOID); 153 // An uncaught exception was thrown during compilation. Generally these
143 JavaCallArguments args; 154 // should be handled by the Java code in some useful way but if they leak
144 args.push_oop(receiver); 155 // through to here report them instead of dying or silently ignoring them.
145 args.push_oop((oop)method_result.get_jobject()); 156 if (HAS_PENDING_EXCEPTION) {
146 args.push_int(entry_bci); 157 Handle throwable = PENDING_EXCEPTION;
147 args.push_long((jlong) (address) env); 158 CLEAR_PENDING_EXCEPTION;
148 args.push_int(env->task()->compile_id());
149 JavaCalls::call_special(&result, receiver->klass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, CHECK_ABORT);
150 159
151 _methodsCompiled++; 160 JVMCIRuntime::call_printStackTrace(throwable, THREAD);
161 if (HAS_PENDING_EXCEPTION) {
162 CLEAR_PENDING_EXCEPTION;
163 }
164
165 // Something went wrong so disable compilation at this level
166 method->set_not_compilable(CompLevel_full_optimization);
167 } else {
168 _methodsCompiled++;
169 }
152 } 170 }
153 171
154 172
155 // Compilation entry point for methods 173 // Compilation entry point for methods
156 void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) { 174 void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {