< prev index next >

src/hotspot/share/prims/universalUpcallHandler.cpp

Print this page

157   return handler;
158 }
159 
160 ProgrammableUpcallHandler::ProgrammableUpcallHandler() {
161   JavaThread* THREAD = JavaThread::current(); // For exception macros.
162   ResourceMark rm(THREAD);
163   Symbol* sym = SymbolTable::new_symbol(FOREIGN_ABI "ProgrammableUpcallHandler");
164   Klass* k = SystemDictionary::resolve_or_null(sym, Handle(), Handle(), CATCH);
165   k->initialize(CATCH);
166 
167   upcall_method.klass = k;
168   upcall_method.name = SymbolTable::new_symbol("invoke");
169   upcall_method.sig = SymbolTable::new_symbol("(Ljava/lang/invoke/MethodHandle;J)V");
170 
171   assert(upcall_method.klass->lookup_method(upcall_method.name, upcall_method.sig) != nullptr,
172     "Could not find upcall method: %s.%s%s", upcall_method.klass->external_name(),
173     upcall_method.name->as_C_string(), upcall_method.sig->as_C_string());
174 }
175 
176 void ProgrammableUpcallHandler::handle_uncaught_exception(oop exception) {

177   // Based on CATCH macro
178   tty->print_cr("Uncaught exception:");
179   exception->print();
180   ShouldNotReachHere();
181 }
182 
183 JVM_ENTRY(jlong, PUH_AllocateUpcallStub(JNIEnv *env, jclass unused, jobject rec, jobject abi, jobject buffer_layout))
184   Handle receiver(THREAD, JNIHandles::resolve(rec));
185   jobject global_rec = JNIHandles::make_global(receiver);
186   return (jlong) ProgrammableUpcallHandler::generate_upcall_stub(global_rec, abi, buffer_layout);
187 JNI_END
188 
189 JVM_ENTRY(jlong, PUH_AllocateOptimizedUpcallStub(JNIEnv *env, jclass unused, jobject mh, jobject abi, jobject conv))
190   Handle mh_h(THREAD, JNIHandles::resolve(mh));
191   jobject mh_j = JNIHandles::make_global(mh_h);
192 
193   oop lform = java_lang_invoke_MethodHandle::form(mh_h());
194   oop vmentry = java_lang_invoke_LambdaForm::vmentry(lform);
195   Method* entry = java_lang_invoke_MemberName::vmtarget(vmentry);
196   const methodHandle mh_entry(THREAD, entry);

157   return handler;
158 }
159 
160 ProgrammableUpcallHandler::ProgrammableUpcallHandler() {
161   JavaThread* THREAD = JavaThread::current(); // For exception macros.
162   ResourceMark rm(THREAD);
163   Symbol* sym = SymbolTable::new_symbol(FOREIGN_ABI "ProgrammableUpcallHandler");
164   Klass* k = SystemDictionary::resolve_or_null(sym, Handle(), Handle(), CATCH);
165   k->initialize(CATCH);
166 
167   upcall_method.klass = k;
168   upcall_method.name = SymbolTable::new_symbol("invoke");
169   upcall_method.sig = SymbolTable::new_symbol("(Ljava/lang/invoke/MethodHandle;J)V");
170 
171   assert(upcall_method.klass->lookup_method(upcall_method.name, upcall_method.sig) != nullptr,
172     "Could not find upcall method: %s.%s%s", upcall_method.klass->external_name(),
173     upcall_method.name->as_C_string(), upcall_method.sig->as_C_string());
174 }
175 
176 void ProgrammableUpcallHandler::handle_uncaught_exception(oop exception) {
177   ResourceMark rm;
178   // Based on CATCH macro
179   tty->print_cr("Uncaught exception:");
180   exception->print();
181   ShouldNotReachHere();
182 }
183 
184 JVM_ENTRY(jlong, PUH_AllocateUpcallStub(JNIEnv *env, jclass unused, jobject rec, jobject abi, jobject buffer_layout))
185   Handle receiver(THREAD, JNIHandles::resolve(rec));
186   jobject global_rec = JNIHandles::make_global(receiver);
187   return (jlong) ProgrammableUpcallHandler::generate_upcall_stub(global_rec, abi, buffer_layout);
188 JNI_END
189 
190 JVM_ENTRY(jlong, PUH_AllocateOptimizedUpcallStub(JNIEnv *env, jclass unused, jobject mh, jobject abi, jobject conv))
191   Handle mh_h(THREAD, JNIHandles::resolve(mh));
192   jobject mh_j = JNIHandles::make_global(mh_h);
193 
194   oop lform = java_lang_invoke_MethodHandle::form(mh_h());
195   oop vmentry = java_lang_invoke_LambdaForm::vmentry(lform);
196   Method* entry = java_lang_invoke_MemberName::vmtarget(vmentry);
197   const methodHandle mh_entry(THREAD, entry);
< prev index next >