src/share/vm/classfile/systemDictionary.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6893081 Sdiff src/share/vm/classfile

src/share/vm/classfile/systemDictionary.cpp

Print this page
rev 1081 : imported patch indy-cleanup-6893081.patch


1967   instanceKlass::cast(WK_KLASS(reference_klass))->set_reference_type(REF_OTHER);
1968   instanceRefKlass::update_nonstatic_oop_maps(WK_KLASS(reference_klass));
1969 
1970   initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(phantom_reference_klass), scan, CHECK);
1971   instanceKlass::cast(WK_KLASS(soft_reference_klass))->set_reference_type(REF_SOFT);
1972   instanceKlass::cast(WK_KLASS(weak_reference_klass))->set_reference_type(REF_WEAK);
1973   instanceKlass::cast(WK_KLASS(final_reference_klass))->set_reference_type(REF_FINAL);
1974   instanceKlass::cast(WK_KLASS(phantom_reference_klass))->set_reference_type(REF_PHANTOM);
1975 
1976   WKID meth_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);
1977   WKID meth_group_end   = WK_KLASS_ENUM_NAME(WrongMethodTypeException_klass);
1978   initialize_wk_klasses_until(meth_group_start, scan, CHECK);
1979   if (EnableMethodHandles) {
1980     initialize_wk_klasses_through(meth_group_end, scan, CHECK);
1981   }
1982   if (_well_known_klasses[meth_group_start] == NULL) {
1983     // Skip the rest of the method handle classes, if MethodHandle is not loaded.
1984     scan = WKID(meth_group_end+1);
1985   }
1986   WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass);
1987   WKID indy_group_end   = WK_KLASS_ENUM_NAME(Dynamic_klass);
1988   initialize_wk_klasses_until(indy_group_start, scan, CHECK);
1989   if (EnableInvokeDynamic) {
1990     initialize_wk_klasses_through(indy_group_end, scan, CHECK);
1991   }
1992   if (_well_known_klasses[indy_group_start] == NULL) {
1993     // Skip the rest of the dynamic typing classes, if Linkage is not loaded.
1994     scan = WKID(indy_group_end+1);
1995   }
1996 
1997   initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK);
1998 
1999   _box_klasses[T_BOOLEAN] = WK_KLASS(boolean_klass);
2000   _box_klasses[T_CHAR]    = WK_KLASS(char_klass);
2001   _box_klasses[T_FLOAT]   = WK_KLASS(float_klass);
2002   _box_klasses[T_DOUBLE]  = WK_KLASS(double_klass);
2003   _box_klasses[T_BYTE]    = WK_KLASS(byte_klass);
2004   _box_klasses[T_SHORT]   = WK_KLASS(short_klass);
2005   _box_klasses[T_INT]     = WK_KLASS(int_klass);
2006   _box_klasses[T_LONG]    = WK_KLASS(long_klass);
2007   //_box_klasses[T_OBJECT]  = WK_KLASS(object_klass);


2323   return NULL;
2324 }
2325 
2326 
2327 methodOop SystemDictionary::find_method_handle_invoke(symbolHandle signature,
2328                                                       Handle class_loader,
2329                                                       Handle protection_domain,
2330                                                       TRAPS) {
2331   if (!EnableMethodHandles)  return NULL;
2332   assert(class_loader.is_null() && protection_domain.is_null(),
2333          "cannot load specialized versions of MethodHandle.invoke");
2334   if (invoke_method_table() == NULL) {
2335     // create this side table lazily
2336     _invoke_method_table = new SymbolPropertyTable(_invoke_method_size);
2337   }
2338   unsigned int hash  = invoke_method_table()->compute_hash(signature);
2339   int          index = invoke_method_table()->hash_to_index(hash);
2340   SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature);
2341   if (spe == NULL || spe->property_oop() == NULL) {
2342     // Must create lots of stuff here, but outside of the SystemDictionary lock.


2343     Handle mt = compute_method_handle_type(signature(),
2344                                            class_loader, protection_domain,
2345                                            CHECK_NULL);
2346     KlassHandle  mh_klass = SystemDictionaryHandles::MethodHandle_klass();
2347     methodHandle m = methodOopDesc::make_invoke_method(mh_klass, signature,
2348                                                        mt, CHECK_NULL);
2349     // Now grab the lock.  We might have to throw away the new method,
2350     // if a racing thread has managed to install one at the same time.
2351     {
2352       MutexLocker ml(SystemDictionary_lock, Thread::current());
2353       spe = invoke_method_table()->find_entry(index, hash, signature);
2354       if (spe == NULL)
2355         spe = invoke_method_table()->add_entry(index, hash, signature);
2356       if (spe->property_oop() == NULL)
2357         spe->set_property_oop(m());
2358     }
2359   }
2360   methodOop m = (methodOop) spe->property_oop();
2361   assert(m->is_method(), "");
2362   return m;




1967   instanceKlass::cast(WK_KLASS(reference_klass))->set_reference_type(REF_OTHER);
1968   instanceRefKlass::update_nonstatic_oop_maps(WK_KLASS(reference_klass));
1969 
1970   initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(phantom_reference_klass), scan, CHECK);
1971   instanceKlass::cast(WK_KLASS(soft_reference_klass))->set_reference_type(REF_SOFT);
1972   instanceKlass::cast(WK_KLASS(weak_reference_klass))->set_reference_type(REF_WEAK);
1973   instanceKlass::cast(WK_KLASS(final_reference_klass))->set_reference_type(REF_FINAL);
1974   instanceKlass::cast(WK_KLASS(phantom_reference_klass))->set_reference_type(REF_PHANTOM);
1975 
1976   WKID meth_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);
1977   WKID meth_group_end   = WK_KLASS_ENUM_NAME(WrongMethodTypeException_klass);
1978   initialize_wk_klasses_until(meth_group_start, scan, CHECK);
1979   if (EnableMethodHandles) {
1980     initialize_wk_klasses_through(meth_group_end, scan, CHECK);
1981   }
1982   if (_well_known_klasses[meth_group_start] == NULL) {
1983     // Skip the rest of the method handle classes, if MethodHandle is not loaded.
1984     scan = WKID(meth_group_end+1);
1985   }
1986   WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass);
1987   WKID indy_group_end   = WK_KLASS_ENUM_NAME(InvokeDynamic_klass);
1988   initialize_wk_klasses_until(indy_group_start, scan, CHECK);
1989   if (EnableInvokeDynamic) {
1990     initialize_wk_klasses_through(indy_group_end, scan, CHECK);
1991   }
1992   if (_well_known_klasses[indy_group_start] == NULL) {
1993     // Skip the rest of the dynamic typing classes, if Linkage is not loaded.
1994     scan = WKID(indy_group_end+1);
1995   }
1996 
1997   initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK);
1998 
1999   _box_klasses[T_BOOLEAN] = WK_KLASS(boolean_klass);
2000   _box_klasses[T_CHAR]    = WK_KLASS(char_klass);
2001   _box_klasses[T_FLOAT]   = WK_KLASS(float_klass);
2002   _box_klasses[T_DOUBLE]  = WK_KLASS(double_klass);
2003   _box_klasses[T_BYTE]    = WK_KLASS(byte_klass);
2004   _box_klasses[T_SHORT]   = WK_KLASS(short_klass);
2005   _box_klasses[T_INT]     = WK_KLASS(int_klass);
2006   _box_klasses[T_LONG]    = WK_KLASS(long_klass);
2007   //_box_klasses[T_OBJECT]  = WK_KLASS(object_klass);


2323   return NULL;
2324 }
2325 
2326 
2327 methodOop SystemDictionary::find_method_handle_invoke(symbolHandle signature,
2328                                                       Handle class_loader,
2329                                                       Handle protection_domain,
2330                                                       TRAPS) {
2331   if (!EnableMethodHandles)  return NULL;
2332   assert(class_loader.is_null() && protection_domain.is_null(),
2333          "cannot load specialized versions of MethodHandle.invoke");
2334   if (invoke_method_table() == NULL) {
2335     // create this side table lazily
2336     _invoke_method_table = new SymbolPropertyTable(_invoke_method_size);
2337   }
2338   unsigned int hash  = invoke_method_table()->compute_hash(signature);
2339   int          index = invoke_method_table()->hash_to_index(hash);
2340   SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature);
2341   if (spe == NULL || spe->property_oop() == NULL) {
2342     // Must create lots of stuff here, but outside of the SystemDictionary lock.
2343     if (THREAD->is_Compiler_thread())
2344       return NULL;              // do not attempt from within compiler
2345     Handle mt = compute_method_handle_type(signature(),
2346                                            class_loader, protection_domain,
2347                                            CHECK_NULL);
2348     KlassHandle  mh_klass = SystemDictionaryHandles::MethodHandle_klass();
2349     methodHandle m = methodOopDesc::make_invoke_method(mh_klass, signature,
2350                                                        mt, CHECK_NULL);
2351     // Now grab the lock.  We might have to throw away the new method,
2352     // if a racing thread has managed to install one at the same time.
2353     {
2354       MutexLocker ml(SystemDictionary_lock, Thread::current());
2355       spe = invoke_method_table()->find_entry(index, hash, signature);
2356       if (spe == NULL)
2357         spe = invoke_method_table()->add_entry(index, hash, signature);
2358       if (spe->property_oop() == NULL)
2359         spe->set_property_oop(m());
2360     }
2361   }
2362   methodOop m = (methodOop) spe->property_oop();
2363   assert(m->is_method(), "");
2364   return m;


src/share/vm/classfile/systemDictionary.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File