1015 SystemDictionary_lock->notify_all(); |
1015 SystemDictionary_lock->notify_all(); |
1016 } |
1016 } |
1017 } |
1017 } |
1018 |
1018 |
1019 if (host_klass.not_null() && k.not_null()) { |
1019 if (host_klass.not_null() && k.not_null()) { |
1020 assert(AnonymousClasses, ""); |
1020 assert(EnableInvokeDynamic, ""); |
1021 // If it's anonymous, initialize it now, since nobody else will. |
1021 // If it's anonymous, initialize it now, since nobody else will. |
1022 k->set_host_klass(host_klass()); |
1022 k->set_host_klass(host_klass()); |
1023 |
1023 |
1024 { |
1024 { |
1025 MutexLocker mu_r(Compile_lock, THREAD); |
1025 MutexLocker mu_r(Compile_lock, THREAD); |
1938 try_load = false; |
1938 try_load = false; |
1939 #endif //KERNEL |
1939 #endif //KERNEL |
1940 } |
1940 } |
1941 Symbol* backup_symbol = NULL; // symbol to try if the current symbol fails |
1941 Symbol* backup_symbol = NULL; // symbol to try if the current symbol fails |
1942 if (init_opt == SystemDictionary::Pre_JSR292) { |
1942 if (init_opt == SystemDictionary::Pre_JSR292) { |
1943 if (!EnableMethodHandles) try_load = false; // do not bother to load such classes |
1943 if (!EnableInvokeDynamic) try_load = false; // do not bother to load such classes |
1944 if (AllowTransitionalJSR292) { |
1944 if (AllowTransitionalJSR292) { |
1945 backup_symbol = find_backup_class_name(symbol); |
1945 backup_symbol = find_backup_class_name(symbol); |
1946 if (try_load && PreferTransitionalJSR292) { |
1946 if (try_load && PreferTransitionalJSR292) { |
1947 while (backup_symbol != NULL) { |
1947 while (backup_symbol != NULL) { |
1948 (*klassp) = resolve_or_null(backup_symbol, CHECK_0); // try backup early |
1948 (*klassp) = resolve_or_null(backup_symbol, CHECK_0); // try backup early |
2036 instanceKlass::cast(WK_KLASS(SoftReference_klass))->set_reference_type(REF_SOFT); |
2036 instanceKlass::cast(WK_KLASS(SoftReference_klass))->set_reference_type(REF_SOFT); |
2037 instanceKlass::cast(WK_KLASS(WeakReference_klass))->set_reference_type(REF_WEAK); |
2037 instanceKlass::cast(WK_KLASS(WeakReference_klass))->set_reference_type(REF_WEAK); |
2038 instanceKlass::cast(WK_KLASS(FinalReference_klass))->set_reference_type(REF_FINAL); |
2038 instanceKlass::cast(WK_KLASS(FinalReference_klass))->set_reference_type(REF_FINAL); |
2039 instanceKlass::cast(WK_KLASS(PhantomReference_klass))->set_reference_type(REF_PHANTOM); |
2039 instanceKlass::cast(WK_KLASS(PhantomReference_klass))->set_reference_type(REF_PHANTOM); |
2040 |
2040 |
2041 WKID meth_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass); |
2041 // JSR 292 classes |
2042 WKID meth_group_end = WK_KLASS_ENUM_NAME(WrongMethodTypeException_klass); |
2042 WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass); |
2043 initialize_wk_klasses_until(meth_group_start, scan, CHECK); |
2043 WKID jsr292_group_end = WK_KLASS_ENUM_NAME(CallSite_klass); |
2044 if (EnableMethodHandles) { |
2044 initialize_wk_klasses_until(jsr292_group_start, scan, CHECK); |
2045 initialize_wk_klasses_through(meth_group_end, scan, CHECK); |
|
2046 } |
|
2047 if (_well_known_klasses[meth_group_start] == NULL) { |
|
2048 // Skip the rest of the method handle classes, if MethodHandle is not loaded. |
|
2049 scan = WKID(meth_group_end+1); |
|
2050 } |
|
2051 WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass); |
|
2052 WKID indy_group_end = WK_KLASS_ENUM_NAME(CallSite_klass); |
|
2053 initialize_wk_klasses_until(indy_group_start, scan, CHECK); |
|
2054 if (EnableInvokeDynamic) { |
2045 if (EnableInvokeDynamic) { |
2055 initialize_wk_klasses_through(indy_group_end, scan, CHECK); |
2046 initialize_wk_klasses_through(jsr292_group_end, scan, CHECK); |
2056 } |
2047 } else { |
2057 if (_well_known_klasses[indy_group_start] == NULL) { |
2048 // Skip the JSR 292 classes, if not enabled. |
2058 // Skip the rest of the dynamic typing classes, if Linkage is not loaded. |
2049 scan = WKID(jsr292_group_end + 1); |
2059 scan = WKID(indy_group_end+1); |
|
2060 } |
2050 } |
2061 |
2051 |
2062 initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK); |
2052 initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK); |
2063 |
2053 |
2064 _box_klasses[T_BOOLEAN] = WK_KLASS(Boolean_klass); |
2054 _box_klasses[T_BOOLEAN] = WK_KLASS(Boolean_klass); |
2405 |
2395 |
2406 methodOop SystemDictionary::find_method_handle_invoke(Symbol* name, |
2396 methodOop SystemDictionary::find_method_handle_invoke(Symbol* name, |
2407 Symbol* signature, |
2397 Symbol* signature, |
2408 KlassHandle accessing_klass, |
2398 KlassHandle accessing_klass, |
2409 TRAPS) { |
2399 TRAPS) { |
2410 if (!EnableMethodHandles) return NULL; |
2400 if (!EnableInvokeDynamic) return NULL; |
2411 vmSymbols::SID name_id = vmSymbols::find_sid(name); |
2401 vmSymbols::SID name_id = vmSymbols::find_sid(name); |
2412 assert(name_id != vmSymbols::NO_SID, "must be a known name"); |
2402 assert(name_id != vmSymbols::NO_SID, "must be a known name"); |
2413 unsigned int hash = invoke_method_table()->compute_hash(signature, name_id); |
2403 unsigned int hash = invoke_method_table()->compute_hash(signature, name_id); |
2414 int index = invoke_method_table()->hash_to_index(hash); |
2404 int index = invoke_method_table()->hash_to_index(hash); |
2415 SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature, name_id); |
2405 SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature, name_id); |