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/classfile/classLoader.cpp
          +++ new/src/share/vm/classfile/classLoader.cpp
↓ open down ↓ 602 lines elided ↑ open up ↑
 603  603  }
 604  604  
 605  605  bool ClassLoader::check_shared_paths_misc_info(void *buf, int size) {
 606  606    SharedPathsMiscInfo* checker = SharedClassUtil::allocate_shared_paths_misc_info((char*)buf, size);
 607  607    bool result = checker->check();
 608  608    delete checker;
 609  609    return result;
 610  610  }
 611  611  #endif
 612  612  
 613      -void ClassLoader::setup_search_path(const char *class_path) {
      613 +void ClassLoader::setup_search_path(const char *class_path, bool canonicalize) {
 614  614    int offset = 0;
 615  615    int len = (int)strlen(class_path);
 616  616    int end = 0;
 617  617  
 618  618    // Iterate over class path entries
 619  619    for (int start = 0; start < len; start = end) {
 620  620      while (class_path[end] && class_path[end] != os::path_separator()[0]) {
 621  621        end++;
 622  622      }
 623  623      EXCEPTION_MARK;
 624  624      ResourceMark rm(THREAD);
 625  625      char* path = NEW_RESOURCE_ARRAY(char, end - start + 1);
 626  626      strncpy(path, &class_path[start], end - start);
 627  627      path[end - start] = '\0';
 628      -    update_class_path_entry_list(path, false);
      628 +    if (canonicalize) {
      629 +      char* canonical_path = NEW_RESOURCE_ARRAY(char, JVM_MAXPATHLEN + 1);
      630 +      if (get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
      631 +        path = canonical_path;
      632 +      }
      633 +    }
      634 +    update_class_path_entry_list(path, /*check_for_duplicates=*/canonicalize);
 629  635  #if INCLUDE_CDS
 630  636      if (DumpSharedSpaces) {
 631  637        check_shared_classpath(path);
 632  638      }
 633  639  #endif
 634  640      while (class_path[end] == os::path_separator()[0]) {
 635  641        end++;
 636  642      }
 637  643    }
 638  644  }
↓ open down ↓ 1072 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX