1948 initialize_wk_klasses_through(meth_group_start, scan, CHECK); |
1948 initialize_wk_klasses_through(meth_group_start, scan, CHECK); |
1949 } |
1949 } |
1950 if (_well_known_klasses[meth_group_start] == NULL) { |
1950 if (_well_known_klasses[meth_group_start] == NULL) { |
1951 // Skip the rest of the method handle classes, if MethodHandle is not loaded. |
1951 // Skip the rest of the method handle classes, if MethodHandle is not loaded. |
1952 scan = WKID(meth_group_end+1); |
1952 scan = WKID(meth_group_end+1); |
|
1953 } |
|
1954 WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass); |
|
1955 WKID indy_group_end = WK_KLASS_ENUM_NAME(Dynamic_klass); |
|
1956 initialize_wk_klasses_until(indy_group_start, scan, CHECK); |
|
1957 if (EnableInvokeDynamic) { |
|
1958 initialize_wk_klasses_through(indy_group_start, scan, CHECK); |
|
1959 } |
|
1960 if (_well_known_klasses[indy_group_start] == NULL) { |
|
1961 // Skip the rest of the dynamic typing classes, if Linkage is not loaded. |
|
1962 scan = WKID(indy_group_end+1); |
1953 } |
1963 } |
1954 |
1964 |
1955 initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK); |
1965 initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK); |
1956 |
1966 |
1957 _box_klasses[T_BOOLEAN] = WK_KLASS(boolean_klass); |
1967 _box_klasses[T_BOOLEAN] = WK_KLASS(boolean_klass); |
2365 &args, CHECK_(empty)); |
2375 &args, CHECK_(empty)); |
2366 return Handle(THREAD, (oop) result.get_jobject()); |
2376 return Handle(THREAD, (oop) result.get_jobject()); |
2367 } |
2377 } |
2368 |
2378 |
2369 |
2379 |
|
2380 // Ask Java code to find or construct a java.dyn.CallSite for the given |
|
2381 // name and signature, as interpreted relative to the given class loader. |
|
2382 Handle SystemDictionary::make_dynamic_call_site(KlassHandle caller, |
|
2383 int caller_method_idnum, |
|
2384 int caller_bci, |
|
2385 symbolHandle name, |
|
2386 methodHandle mh_invdyn, |
|
2387 TRAPS) { |
|
2388 Handle empty; |
|
2389 // call sun.dyn.CallSiteImpl::makeSite(caller, name, mtype, cmid, cbci) |
|
2390 oop name_str_oop = StringTable::intern(name(), CHECK_(empty)); // not a handle! |
|
2391 JavaCallArguments args(Handle(THREAD, caller->java_mirror())); |
|
2392 args.push_oop(name_str_oop); |
|
2393 args.push_oop(mh_invdyn->method_handle_type()); |
|
2394 args.push_int(caller_method_idnum); |
|
2395 args.push_int(caller_bci); |
|
2396 JavaValue result(T_OBJECT); |
|
2397 JavaCalls::call_static(&result, |
|
2398 SystemDictionary::CallSiteImpl_klass(), |
|
2399 vmSymbols::makeSite_name(), vmSymbols::makeSite_signature(), |
|
2400 &args, CHECK_(empty)); |
|
2401 oop call_site_oop = (oop) result.get_jobject(); |
|
2402 sun_dyn_CallSiteImpl::set_vmmethod(call_site_oop, mh_invdyn()); |
|
2403 if (TraceMethodHandles) { |
|
2404 tty->print_cr("Linked invokedynamic bci=%d site="INTPTR_FORMAT":", caller_bci, call_site_oop); |
|
2405 call_site_oop->print(); |
|
2406 tty->cr(); |
|
2407 } |
|
2408 return call_site_oop; |
|
2409 } |
|
2410 |
|
2411 Handle SystemDictionary::find_bootstrap_method(KlassHandle caller, |
|
2412 KlassHandle search_bootstrap_klass, |
|
2413 TRAPS) { |
|
2414 Handle empty; |
|
2415 if (!caller->oop_is_instance()) return empty; |
|
2416 |
|
2417 instanceKlassHandle ik(THREAD, caller()); |
|
2418 |
|
2419 if (ik->bootstrap_method() != NULL) { |
|
2420 return Handle(THREAD, ik->bootstrap_method()); |
|
2421 } |
|
2422 |
|
2423 // call java.dyn.Linkage::findBootstrapMethod(caller, sbk) |
|
2424 JavaCallArguments args(Handle(THREAD, ik->java_mirror())); |
|
2425 if (search_bootstrap_klass.is_null()) |
|
2426 args.push_oop(Handle()); |
|
2427 else |
|
2428 args.push_oop(search_bootstrap_klass->java_mirror()); |
|
2429 JavaValue result(T_OBJECT); |
|
2430 JavaCalls::call_static(&result, |
|
2431 SystemDictionary::Linkage_klass(), |
|
2432 vmSymbols::findBootstrapMethod_name(), |
|
2433 vmSymbols::findBootstrapMethod_signature(), |
|
2434 &args, CHECK_(empty)); |
|
2435 oop boot_method_oop = (oop) result.get_jobject(); |
|
2436 |
|
2437 if (boot_method_oop != NULL) { |
|
2438 // probably no race conditions, but let's be careful: |
|
2439 if (Atomic::cmpxchg_ptr(boot_method_oop, ik->adr_bootstrap_method(), NULL) == NULL) |
|
2440 ik->set_bootstrap_method(boot_method_oop); |
|
2441 else |
|
2442 boot_method_oop = ik->bootstrap_method(); |
|
2443 } else { |
|
2444 boot_method_oop = ik->bootstrap_method(); |
|
2445 } |
|
2446 |
|
2447 return Handle(THREAD, boot_method_oop); |
|
2448 } |
|
2449 |
2370 // Since the identity hash code for symbols changes when the symbols are |
2450 // Since the identity hash code for symbols changes when the symbols are |
2371 // moved from the regular perm gen (hash in the mark word) to the shared |
2451 // moved from the regular perm gen (hash in the mark word) to the shared |
2372 // spaces (hash is the address), the classes loaded into the dictionary |
2452 // spaces (hash is the address), the classes loaded into the dictionary |
2373 // may be in the wrong buckets. |
2453 // may be in the wrong buckets. |
2374 |
2454 |