1985 } |
1985 } |
1986 WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass); |
1986 WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass); |
1987 WKID indy_group_end = WK_KLASS_ENUM_NAME(Dynamic_klass); |
1987 WKID indy_group_end = WK_KLASS_ENUM_NAME(Dynamic_klass); |
1988 initialize_wk_klasses_until(indy_group_start, scan, CHECK); |
1988 initialize_wk_klasses_until(indy_group_start, scan, CHECK); |
1989 if (EnableInvokeDynamic) { |
1989 if (EnableInvokeDynamic) { |
1990 initialize_wk_klasses_through(indy_group_start, scan, CHECK); |
1990 initialize_wk_klasses_through(indy_group_end, scan, CHECK); |
1991 } |
1991 } |
1992 if (_well_known_klasses[indy_group_start] == NULL) { |
1992 if (_well_known_klasses[indy_group_start] == NULL) { |
1993 // Skip the rest of the dynamic typing classes, if Linkage is not loaded. |
1993 // Skip the rest of the dynamic typing classes, if Linkage is not loaded. |
1994 scan = WKID(indy_group_end+1); |
1994 scan = WKID(indy_group_end+1); |
1995 } |
1995 } |
2416 int caller_bci, |
2416 int caller_bci, |
2417 symbolHandle name, |
2417 symbolHandle name, |
2418 methodHandle mh_invdyn, |
2418 methodHandle mh_invdyn, |
2419 TRAPS) { |
2419 TRAPS) { |
2420 Handle empty; |
2420 Handle empty; |
2421 // call sun.dyn.CallSiteImpl::makeSite(caller, name, mtype, cmid, cbci) |
2421 // call java.dyn.CallSite::makeSite(caller, name, mtype, cmid, cbci) |
2422 oop name_str_oop = StringTable::intern(name(), CHECK_(empty)); // not a handle! |
2422 oop name_str_oop = StringTable::intern(name(), CHECK_(empty)); // not a handle! |
2423 JavaCallArguments args(Handle(THREAD, caller->java_mirror())); |
2423 JavaCallArguments args(Handle(THREAD, caller->java_mirror())); |
2424 args.push_oop(name_str_oop); |
2424 args.push_oop(name_str_oop); |
2425 args.push_oop(mh_invdyn->method_handle_type()); |
2425 args.push_oop(mh_invdyn->method_handle_type()); |
2426 args.push_int(caller_method_idnum); |
2426 args.push_int(caller_method_idnum); |
2427 args.push_int(caller_bci); |
2427 args.push_int(caller_bci); |
2428 JavaValue result(T_OBJECT); |
2428 JavaValue result(T_OBJECT); |
2429 JavaCalls::call_static(&result, |
2429 JavaCalls::call_static(&result, |
2430 SystemDictionary::CallSiteImpl_klass(), |
2430 SystemDictionary::CallSite_klass(), |
2431 vmSymbols::makeSite_name(), vmSymbols::makeSite_signature(), |
2431 vmSymbols::makeSite_name(), vmSymbols::makeSite_signature(), |
2432 &args, CHECK_(empty)); |
2432 &args, CHECK_(empty)); |
2433 oop call_site_oop = (oop) result.get_jobject(); |
2433 oop call_site_oop = (oop) result.get_jobject(); |
2434 assert(call_site_oop->is_oop() |
2434 assert(call_site_oop->is_oop() |
2435 /*&& sun_dyn_CallSiteImpl::is_instance(call_site_oop)*/, "must be sane"); |
2435 /*&& java_dyn_CallSite::is_instance(call_site_oop)*/, "must be sane"); |
2436 sun_dyn_CallSiteImpl::set_vmmethod(call_site_oop, mh_invdyn()); |
2436 java_dyn_CallSite::set_vmmethod(call_site_oop, mh_invdyn()); |
2437 if (TraceMethodHandles) { |
2437 if (TraceMethodHandles) { |
|
2438 #ifndef PRODUCT |
2438 tty->print_cr("Linked invokedynamic bci=%d site="INTPTR_FORMAT":", caller_bci, call_site_oop); |
2439 tty->print_cr("Linked invokedynamic bci=%d site="INTPTR_FORMAT":", caller_bci, call_site_oop); |
2439 call_site_oop->print(); |
2440 call_site_oop->print(); |
2440 tty->cr(); |
2441 tty->cr(); |
|
2442 #endif //PRODUCT |
2441 } |
2443 } |
2442 return call_site_oop; |
2444 return call_site_oop; |
2443 } |
2445 } |
2444 |
2446 |
2445 Handle SystemDictionary::find_bootstrap_method(KlassHandle caller, |
2447 Handle SystemDictionary::find_bootstrap_method(KlassHandle caller, |
2448 Handle empty; |
2450 Handle empty; |
2449 if (!caller->oop_is_instance()) return empty; |
2451 if (!caller->oop_is_instance()) return empty; |
2450 |
2452 |
2451 instanceKlassHandle ik(THREAD, caller()); |
2453 instanceKlassHandle ik(THREAD, caller()); |
2452 |
2454 |
2453 if (ik->bootstrap_method() != NULL) { |
2455 oop boot_method_oop = ik->bootstrap_method(); |
2454 return Handle(THREAD, ik->bootstrap_method()); |
2456 if (boot_method_oop != NULL) { |
2455 } |
2457 if (TraceMethodHandles) { |
|
2458 tty->print_cr("bootstrap method for "PTR_FORMAT" cached as "PTR_FORMAT":", ik(), boot_method_oop); |
|
2459 } |
|
2460 NOT_PRODUCT(if (!boot_method_oop->is_oop()) { tty->print_cr("*** boot MH of "PTR_FORMAT" = "PTR_FORMAT, ik(), boot_method_oop); ik()->print(); }); |
|
2461 assert(boot_method_oop->is_oop() |
|
2462 && java_dyn_MethodHandle::is_instance(boot_method_oop), "must be sane"); |
|
2463 return Handle(THREAD, boot_method_oop); |
|
2464 } |
|
2465 boot_method_oop = NULL; // GC safety |
2456 |
2466 |
2457 // call java.dyn.Linkage::findBootstrapMethod(caller, sbk) |
2467 // call java.dyn.Linkage::findBootstrapMethod(caller, sbk) |
2458 JavaCallArguments args(Handle(THREAD, ik->java_mirror())); |
2468 JavaCallArguments args(Handle(THREAD, ik->java_mirror())); |
2459 if (search_bootstrap_klass.is_null()) |
2469 if (search_bootstrap_klass.is_null()) |
2460 args.push_oop(Handle()); |
2470 args.push_oop(Handle()); |
2464 JavaCalls::call_static(&result, |
2474 JavaCalls::call_static(&result, |
2465 SystemDictionary::Linkage_klass(), |
2475 SystemDictionary::Linkage_klass(), |
2466 vmSymbols::findBootstrapMethod_name(), |
2476 vmSymbols::findBootstrapMethod_name(), |
2467 vmSymbols::findBootstrapMethod_signature(), |
2477 vmSymbols::findBootstrapMethod_signature(), |
2468 &args, CHECK_(empty)); |
2478 &args, CHECK_(empty)); |
2469 oop boot_method_oop = (oop) result.get_jobject(); |
2479 boot_method_oop = (oop) result.get_jobject(); |
2470 |
2480 |
2471 if (boot_method_oop != NULL) { |
2481 if (boot_method_oop != NULL) { |
|
2482 if (TraceMethodHandles) { |
|
2483 #ifndef PRODUCT |
|
2484 tty->print_cr("--------"); |
|
2485 tty->print_cr("bootstrap method for "PTR_FORMAT" computed as "PTR_FORMAT":", ik(), boot_method_oop); |
|
2486 ik()->print(); |
|
2487 boot_method_oop->print(); |
|
2488 tty->print_cr("========"); |
|
2489 #endif //PRODUCT |
|
2490 } |
2472 assert(boot_method_oop->is_oop() |
2491 assert(boot_method_oop->is_oop() |
2473 && java_dyn_MethodHandle::is_instance(boot_method_oop), "must be sane"); |
2492 && java_dyn_MethodHandle::is_instance(boot_method_oop), "must be sane"); |
2474 // probably no race conditions, but let's be careful: |
2493 // probably no race conditions, but let's be careful: |
2475 if (Atomic::cmpxchg_ptr(boot_method_oop, ik->adr_bootstrap_method(), NULL) == NULL) |
2494 if (Atomic::cmpxchg_ptr(boot_method_oop, ik->adr_bootstrap_method(), NULL) == NULL) |
2476 ik->set_bootstrap_method(boot_method_oop); |
2495 ik->set_bootstrap_method(boot_method_oop); |
2477 else |
2496 else |
2478 boot_method_oop = ik->bootstrap_method(); |
2497 boot_method_oop = ik->bootstrap_method(); |
2479 } else { |
2498 } else { |
|
2499 if (TraceMethodHandles) { |
|
2500 #ifndef PRODUCT |
|
2501 tty->print_cr("--------"); |
|
2502 tty->print_cr("bootstrap method for "PTR_FORMAT" computed as NULL:", ik()); |
|
2503 ik()->print(); |
|
2504 tty->print_cr("========"); |
|
2505 #endif //PRODUCT |
|
2506 } |
2480 boot_method_oop = ik->bootstrap_method(); |
2507 boot_method_oop = ik->bootstrap_method(); |
2481 } |
2508 } |
2482 |
2509 |
2483 return Handle(THREAD, boot_method_oop); |
2510 return Handle(THREAD, boot_method_oop); |
2484 } |
2511 } |