src/share/vm/memory/metaspaceShared.cpp

Print this page




 628 {
 629     jlong h = start;
 630     char *p = (char *)buf, *e = p + len;
 631     while (p < e) {
 632         char c = *p++;
 633         if (c <= ' ') {
 634             /* Skip spaces and control characters */
 635             continue;
 636         }
 637         h = 31 * h + c;
 638     }
 639     return h;
 640 }
 641 
 642 // Preload classes from a list, populate the shared spaces and dump to a
 643 // file.
 644 void MetaspaceShared::preload_and_dump(TRAPS) {
 645   TraceTime timer("Dump Shared Spaces", TraceStartupTime);
 646   ResourceMark rm;
 647 
 648   // Lock out GC - is it necessary? I don't think we care.
 649   No_GC_Verifier no_gc;
 650 
 651   // Preload classes to be shared.
 652   // Should use some os:: method rather than fopen() here. aB.
 653   // Construct the path to the class list (in jre/lib)
 654   // Walk up two directories from the location of the VM and
 655   // optionally tack on "lib" (depending on platform)
 656   char class_list_path[JVM_MAXPATHLEN];
 657   os::jvm_path(class_list_path, sizeof(class_list_path));
 658   for (int i = 0; i < 3; i++) {
 659     char *end = strrchr(class_list_path, *os::file_separator());
 660     if (end != NULL) *end = '\0';
 661   }
 662   int class_list_path_len = (int)strlen(class_list_path);
 663   if (class_list_path_len >= 3) {
 664     if (strcmp(class_list_path + class_list_path_len - 3, "lib") != 0) {
 665       strcat(class_list_path, os::file_separator());
 666       strcat(class_list_path, "lib");
 667     }
 668   }
 669   strcat(class_list_path, os::file_separator());
 670   strcat(class_list_path, "classlist");




 628 {
 629     jlong h = start;
 630     char *p = (char *)buf, *e = p + len;
 631     while (p < e) {
 632         char c = *p++;
 633         if (c <= ' ') {
 634             /* Skip spaces and control characters */
 635             continue;
 636         }
 637         h = 31 * h + c;
 638     }
 639     return h;
 640 }
 641 
 642 // Preload classes from a list, populate the shared spaces and dump to a
 643 // file.
 644 void MetaspaceShared::preload_and_dump(TRAPS) {
 645   TraceTime timer("Dump Shared Spaces", TraceStartupTime);
 646   ResourceMark rm;
 647 



 648   // Preload classes to be shared.
 649   // Should use some os:: method rather than fopen() here. aB.
 650   // Construct the path to the class list (in jre/lib)
 651   // Walk up two directories from the location of the VM and
 652   // optionally tack on "lib" (depending on platform)
 653   char class_list_path[JVM_MAXPATHLEN];
 654   os::jvm_path(class_list_path, sizeof(class_list_path));
 655   for (int i = 0; i < 3; i++) {
 656     char *end = strrchr(class_list_path, *os::file_separator());
 657     if (end != NULL) *end = '\0';
 658   }
 659   int class_list_path_len = (int)strlen(class_list_path);
 660   if (class_list_path_len >= 3) {
 661     if (strcmp(class_list_path + class_list_path_len - 3, "lib") != 0) {
 662       strcat(class_list_path, os::file_separator());
 663       strcat(class_list_path, "lib");
 664     }
 665   }
 666   strcat(class_list_path, os::file_separator());
 667   strcat(class_list_path, "classlist");