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 1021 : 6858164: invokedynamic code needs some cleanup (post-6655638)
Note: The bug ID for this change set was erroneously used to call for review of 6815692.
Summary: Fix several crashers, remove needless paths for boxed-style bootstrap method call, refactor & simplify APIs for rewriter constantPoolOop, remove sun.dyn.CallSiteImpl
Reviewed-by: ?
rev 1024 : imported patch indy-cleanup-6893081.patch


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


2309   return NULL;
2310 }
2311 
2312 
2313 methodOop SystemDictionary::find_method_handle_invoke(symbolHandle signature,
2314                                                       Handle class_loader,
2315                                                       Handle protection_domain,
2316                                                       TRAPS) {
2317   if (!EnableMethodHandles)  return NULL;
2318   assert(class_loader.is_null() && protection_domain.is_null(),
2319          "cannot load specialized versions of MethodHandle.invoke");
2320   if (invoke_method_table() == NULL) {
2321     // create this side table lazily
2322     _invoke_method_table = new SymbolPropertyTable(_invoke_method_size);
2323   }
2324   unsigned int hash  = invoke_method_table()->compute_hash(signature);
2325   int          index = invoke_method_table()->hash_to_index(hash);
2326   SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature);
2327   if (spe == NULL || spe->property_oop() == NULL) {
2328     // Must create lots of stuff here, but outside of the SystemDictionary lock.


2329     Handle mt = compute_method_handle_type(signature(),
2330                                            class_loader, protection_domain,
2331                                            CHECK_NULL);
2332     KlassHandle  mh_klass = SystemDictionaryHandles::MethodHandle_klass();
2333     methodHandle m = methodOopDesc::make_invoke_method(mh_klass, signature,
2334                                                        mt, CHECK_NULL);
2335     // Now grab the lock.  We might have to throw away the new method,
2336     // if a racing thread has managed to install one at the same time.
2337     {
2338       MutexLocker ml(SystemDictionary_lock, Thread::current());
2339       spe = invoke_method_table()->find_entry(index, hash, signature);
2340       if (spe == NULL)
2341         spe = invoke_method_table()->add_entry(index, hash, signature);
2342       if (spe->property_oop() == NULL)
2343         spe->set_property_oop(m());
2344     }
2345   }
2346   methodOop m = (methodOop) spe->property_oop();
2347   assert(m->is_method(), "");
2348   return m;




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


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


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