Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/vm/classfile/systemDictionary.cpp
          +++ new/src/share/vm/classfile/systemDictionary.cpp
↓ open down ↓ 1009 lines elided ↑ open up ↑
1010 1010                                                         class_loader);
1011 1011      int p_index = placeholders()->hash_to_index(p_hash);
1012 1012      {
1013 1013      MutexLocker mu(SystemDictionary_lock, THREAD);
1014 1014      placeholders()->find_and_remove(p_index, p_hash, parsed_name, class_loader, THREAD);
1015 1015      SystemDictionary_lock->notify_all();
1016 1016      }
1017 1017    }
1018 1018  
1019 1019    if (host_klass.not_null() && k.not_null()) {
1020      -    assert(AnonymousClasses, "");
     1020 +    assert(EnableInvokeDynamic, "");
1021 1021      // If it's anonymous, initialize it now, since nobody else will.
1022 1022      k->set_host_klass(host_klass());
1023 1023  
1024 1024      {
1025 1025        MutexLocker mu_r(Compile_lock, THREAD);
1026 1026  
1027 1027        // Add to class hierarchy, initialize vtables, and do possible
1028 1028        // deoptimizations.
1029 1029        add_to_hierarchy(k, CHECK_NULL); // No exception, but can block
1030 1030  
↓ open down ↓ 902 lines elided ↑ open up ↑
1933 1933    klassOop*    klassp = &_well_known_klasses[id];
1934 1934    bool pre_load = (init_opt < SystemDictionary::Opt);
1935 1935    bool try_load = true;
1936 1936    if (init_opt == SystemDictionary::Opt_Kernel) {
1937 1937  #ifndef KERNEL
1938 1938      try_load = false;
1939 1939  #endif //KERNEL
1940 1940    }
1941 1941    Symbol* backup_symbol = NULL;  // symbol to try if the current symbol fails
1942 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 1944      if (AllowTransitionalJSR292) {
1945 1945        backup_symbol = find_backup_class_name(symbol);
1946 1946        if (try_load && PreferTransitionalJSR292) {
1947 1947          while (backup_symbol != NULL) {
1948 1948            (*klassp) = resolve_or_null(backup_symbol, CHECK_0); // try backup early
1949 1949            if (TraceMethodHandles) {
1950 1950              ResourceMark rm;
1951 1951              tty->print_cr("MethodHandles: try backup first for %s => %s (%s)",
1952 1952                            symbol->as_C_string(), backup_symbol->as_C_string(),
1953 1953                            ((*klassp) == NULL) ? "no such class" : "backup load succeeded");
↓ open down ↓ 77 lines elided ↑ open up ↑
2031 2031    // Preload ref klasses and set reference types
2032 2032    instanceKlass::cast(WK_KLASS(Reference_klass))->set_reference_type(REF_OTHER);
2033 2033    instanceRefKlass::update_nonstatic_oop_maps(WK_KLASS(Reference_klass));
2034 2034  
2035 2035    initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(PhantomReference_klass), scan, CHECK);
2036 2036    instanceKlass::cast(WK_KLASS(SoftReference_klass))->set_reference_type(REF_SOFT);
2037 2037    instanceKlass::cast(WK_KLASS(WeakReference_klass))->set_reference_type(REF_WEAK);
2038 2038    instanceKlass::cast(WK_KLASS(FinalReference_klass))->set_reference_type(REF_FINAL);
2039 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);
2042      -  WKID meth_group_end   = WK_KLASS_ENUM_NAME(WrongMethodTypeException_klass);
2043      -  initialize_wk_klasses_until(meth_group_start, scan, CHECK);
2044      -  if (EnableMethodHandles) {
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);
     2041 +  // JSR 292 classes
     2042 +  WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);
     2043 +  WKID jsr292_group_end   = WK_KLASS_ENUM_NAME(CallSite_klass);
     2044 +  initialize_wk_klasses_until(jsr292_group_start, scan, CHECK);
2054 2045    if (EnableInvokeDynamic) {
2055      -    initialize_wk_klasses_through(indy_group_end, scan, CHECK);
2056      -  }
2057      -  if (_well_known_klasses[indy_group_start] == NULL) {
2058      -    // Skip the rest of the dynamic typing classes, if Linkage is not loaded.
2059      -    scan = WKID(indy_group_end+1);
     2046 +    initialize_wk_klasses_through(jsr292_group_end, scan, CHECK);
     2047 +  } else {
     2048 +    // Skip the JSR 292 classes, if not enabled.
     2049 +    scan = WKID(jsr292_group_end + 1);
2060 2050    }
2061 2051  
2062 2052    initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK);
2063 2053  
2064 2054    _box_klasses[T_BOOLEAN] = WK_KLASS(Boolean_klass);
2065 2055    _box_klasses[T_CHAR]    = WK_KLASS(Character_klass);
2066 2056    _box_klasses[T_FLOAT]   = WK_KLASS(Float_klass);
2067 2057    _box_klasses[T_DOUBLE]  = WK_KLASS(Double_klass);
2068 2058    _box_klasses[T_BYTE]    = WK_KLASS(Byte_klass);
2069 2059    _box_klasses[T_SHORT]   = WK_KLASS(Short_klass);
↓ open down ↓ 330 lines elided ↑ open up ↑
2400 2390      sig_strm.next();
2401 2391    }
2402 2392    return NULL;
2403 2393  }
2404 2394  
2405 2395  
2406 2396  methodOop SystemDictionary::find_method_handle_invoke(Symbol* name,
2407 2397                                                        Symbol* signature,
2408 2398                                                        KlassHandle accessing_klass,
2409 2399                                                        TRAPS) {
2410      -  if (!EnableMethodHandles)  return NULL;
     2400 +  if (!EnableInvokeDynamic)  return NULL;
2411 2401    vmSymbols::SID name_id = vmSymbols::find_sid(name);
2412 2402    assert(name_id != vmSymbols::NO_SID, "must be a known name");
2413 2403    unsigned int hash  = invoke_method_table()->compute_hash(signature, name_id);
2414 2404    int          index = invoke_method_table()->hash_to_index(hash);
2415 2405    SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature, name_id);
2416 2406    methodHandle non_cached_result;
2417 2407    if (spe == NULL || spe->property_oop() == NULL) {
2418 2408      spe = NULL;
2419 2409      // Must create lots of stuff here, but outside of the SystemDictionary lock.
2420 2410      if (THREAD->is_Compiler_thread())
↓ open down ↓ 581 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX