Print this page
rev 6864 : 8061651: Interface to the Lookup Index Cache to improve URLClassPath search time
Summary: Implemented the interface in sun.misc.URLClassPath and corresponding JVM_XXX APIs
Reviewed-by: mchung, acorn, jiangli, dholmes

Split Split Close
Expand all
Collapse all
          --- old/src/share/vm/memory/metaspaceShared.cpp
          +++ new/src/share/vm/memory/metaspaceShared.cpp
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18   18   *
  19   19   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20   20   * or visit www.oracle.com if you need additional information or have any
  21   21   * questions.
  22   22   *
  23   23   */
  24   24  
  25   25  #include "precompiled.hpp"
  26   26  #include "classfile/dictionary.hpp"
       27 +#include "classfile/classLoaderExt.hpp"
  27   28  #include "classfile/loaderConstraints.hpp"
  28   29  #include "classfile/placeholders.hpp"
  29   30  #include "classfile/sharedClassUtil.hpp"
  30   31  #include "classfile/symbolTable.hpp"
  31   32  #include "classfile/systemDictionary.hpp"
  32   33  #include "code/codeCache.hpp"
  33   34  #include "memory/filemap.hpp"
  34   35  #include "memory/gcLocker.hpp"
  35   36  #include "memory/metaspace.hpp"
  36   37  #include "memory/metaspaceShared.hpp"
  37   38  #include "oops/objArrayOop.hpp"
  38   39  #include "oops/oop.inline.hpp"
  39   40  #include "runtime/signature.hpp"
  40   41  #include "runtime/vm_operations.hpp"
  41   42  #include "runtime/vmThread.hpp"
       43 +#include "utilities/hashtable.hpp"
  42   44  #include "utilities/hashtable.inline.hpp"
  43   45  
  44   46  PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  45   47  
  46   48  int MetaspaceShared::_max_alignment = 0;
  47   49  
  48   50  ReservedSpace* MetaspaceShared::_shared_rs = NULL;
  49   51  
  50   52  bool MetaspaceShared::_link_classes_made_progress;
  51   53  bool MetaspaceShared::_check_classes_made_progress;
↓ open down ↓ 474 lines elided ↑ open up ↑
 526  528    ClassLoader::verify();
 527  529    ClassLoader::copy_package_info_buckets(&md_top, md_end);
 528  530    ClassLoader::verify();
 529  531  
 530  532    SymbolTable::copy_table(&md_top, md_end);
 531  533    SystemDictionary::copy_table(&md_top, md_end);
 532  534    ClassLoader::verify();
 533  535    ClassLoader::copy_package_info_table(&md_top, md_end);
 534  536    ClassLoader::verify();
 535  537  
      538 +  ClassLoaderExt::copy_lookup_cache_to_archive(&md_top, md_end);
      539 +
 536  540    // Write the other data to the output array.
 537  541    WriteClosure wc(md_top, md_end);
 538  542    MetaspaceShared::serialize(&wc);
 539  543    md_top = wc.get_top();
 540  544  
 541  545    // Print shared spaces all the time
 542  546  // To make fmt_space be a syntactic constant (for format warnings), use #define.
 543  547  #define fmt_space "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " PTR_FORMAT
 544  548    Metaspace* ro_space = _loader_data->ro_metaspace();
 545  549    Metaspace* rw_space = _loader_data->rw_metaspace();
↓ open down ↓ 192 lines elided ↑ open up ↑
 738  742    tty->print_cr("Loading classes to share ...");
 739  743    _has_error_classes = false;
 740  744    class_count += preload_and_dump(class_list_path, class_promote_order,
 741  745                                    THREAD);
 742  746    if (ExtraSharedClassListFile) {
 743  747      class_count += preload_and_dump(ExtraSharedClassListFile, class_promote_order,
 744  748                                      THREAD);
 745  749    }
 746  750    tty->print_cr("Loading classes to share: done.");
 747  751  
      752 +  ClassLoaderExt::init_lookup_cache(THREAD);
      753 +
 748  754    if (PrintSharedSpaces) {
 749  755      tty->print_cr("Shared spaces: preloaded %d classes", class_count);
 750  756    }
 751  757  
 752  758    // Rewrite and link classes
 753  759    tty->print_cr("Rewriting and linking classes ...");
 754  760  
 755  761    // Link any classes which got missed. This would happen if we have loaded classes that
 756  762    // were not explicitly specified in the classlist. E.g., if an interface implemented by class K
 757  763    // fails verification, all other interfaces that were not specified in the classlist but
↓ open down ↓ 291 lines elided ↑ open up ↑
1049 1055    buffer += len;
1050 1056  
1051 1057    len = *(intptr_t*)buffer;     // skip over package info table entries
1052 1058    buffer += sizeof(intptr_t);
1053 1059    buffer += len;
1054 1060  
1055 1061    len = *(intptr_t*)buffer;     // skip over package info table char[] arrays.
1056 1062    buffer += sizeof(intptr_t);
1057 1063    buffer += len;
1058 1064  
     1065 +  buffer = ClassLoaderExt::restore_lookup_cache_from_archive(buffer);
     1066 +
1059 1067    intptr_t* array = (intptr_t*)buffer;
1060 1068    ReadClosure rc(&array);
1061 1069    serialize(&rc);
1062 1070  
1063 1071    // Close the mapinfo file
1064 1072    mapinfo->close();
1065 1073  
1066 1074    if (PrintSharedArchiveAndExit) {
1067 1075      if (PrintSharedDictionary) {
1068 1076        tty->print_cr("\nShared classes:\n");
↓ open down ↓ 71 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX