< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page

1901   if (StackReservedPages != 0) {
1902     FLAG_SET_CMDLINE(StackReservedPages, 0);
1903     warning("Reserved Stack Area not supported on this platform");
1904   }
1905 #endif
1906 
1907 #if !defined(X86) && !defined(AARCH64) && !defined(RISCV64) && !defined(ARM) && !defined(PPC64) && !defined(S390)
1908   if (LockingMode == LM_LIGHTWEIGHT) {
1909     FLAG_SET_CMDLINE(LockingMode, LM_LEGACY);
1910     warning("New lightweight locking not supported on this platform");
1911   }
1912 #endif
1913 
1914 #if !defined(X86) && !defined(AARCH64) && !defined(PPC64) && !defined(RISCV64) && !defined(S390)
1915   if (LockingMode == LM_MONITOR) {
1916     jio_fprintf(defaultStream::error_stream(),
1917                 "LockingMode == 0 (LM_MONITOR) is not fully implemented on this architecture");
1918     return false;
1919   }
1920 #endif
1921 #if (defined(X86) || defined(PPC64)) && !defined(ZERO)
1922   if (LockingMode == LM_MONITOR && UseRTMForStackLocks) {
1923     jio_fprintf(defaultStream::error_stream(),
1924                 "LockingMode == 0 (LM_MONITOR) and -XX:+UseRTMForStackLocks are mutually exclusive");
1925 
1926     return false;
1927   }
1928 #endif
1929   if (VerifyHeavyMonitors && LockingMode != LM_MONITOR) {
1930     jio_fprintf(defaultStream::error_stream(),
1931                 "-XX:+VerifyHeavyMonitors requires LockingMode == 0 (LM_MONITOR)");
1932     return false;
1933   }
1934   return status;
1935 }
1936 
1937 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
1938   const char* option_type) {
1939   if (ignore) return false;
1940 
1941   const char* spacer = " ";

3068   if (UseSharedSpaces && patch_mod_javabase) {
3069     no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
3070   }
3071   if (UseSharedSpaces && !DumpSharedSpaces && check_unsupported_cds_runtime_properties()) {
3072     UseSharedSpaces = false;
3073   }
3074 
3075   if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
3076     // Always verify non-system classes during CDS dump
3077     if (!BytecodeVerificationRemote) {
3078       BytecodeVerificationRemote = true;
3079       log_info(cds)("All non-system classes will be verified (-Xverify:remote) during CDS dump time.");
3080     }
3081   }
3082 #endif
3083 
3084 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
3085   UNSUPPORTED_OPTION(ShowRegistersOnAssert);
3086 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
3087 






















3088   return JNI_OK;
3089 }
3090 
3091 // Helper class for controlling the lifetime of JavaVMInitArgs
3092 // objects.  The contents of the JavaVMInitArgs are guaranteed to be
3093 // deleted on the destruction of the ScopedVMInitArgs object.
3094 class ScopedVMInitArgs : public StackObj {
3095  private:
3096   JavaVMInitArgs _args;
3097   char*          _container_name;
3098   bool           _is_set;
3099   char*          _vm_options_file_arg;
3100 
3101  public:
3102   ScopedVMInitArgs(const char *container_name) {
3103     _args.version = JNI_VERSION_1_2;
3104     _args.nOptions = 0;
3105     _args.options = nullptr;
3106     _args.ignoreUnrecognized = false;
3107     _container_name = (char *)container_name;

3358 #if INCLUDE_CDS
3359   // Initialize shared archive paths which could include both base and dynamic archive paths
3360   // This must be after set_ergonomics_flags() called so flag UseCompressedOops is set properly.
3361   //
3362   // UseSharedSpaces may be disabled if -XX:SharedArchiveFile is invalid.
3363   if (DumpSharedSpaces || UseSharedSpaces) {
3364     init_shared_archive_paths();
3365   }
3366 #endif  // INCLUDE_CDS
3367 }
3368 
3369 #if INCLUDE_CDS
3370 // Sharing support
3371 // Construct the path to the archive
3372 char* Arguments::get_default_shared_archive_path() {
3373   if (_default_shared_archive_path == nullptr) {
3374     char jvm_path[JVM_MAXPATHLEN];
3375     os::jvm_path(jvm_path, sizeof(jvm_path));
3376     char *end = strrchr(jvm_path, *os::file_separator());
3377     if (end != nullptr) *end = '\0';
3378     size_t jvm_path_len = strlen(jvm_path);
3379     size_t file_sep_len = strlen(os::file_separator());
3380     const size_t len = jvm_path_len + file_sep_len + 20;
3381     _default_shared_archive_path = NEW_C_HEAP_ARRAY(char, len, mtArguments);
3382     jio_snprintf(_default_shared_archive_path, len,
3383                 LP64_ONLY(!UseCompressedOops ? "%s%sclasses_nocoops.jsa":) "%s%sclasses.jsa",
3384                 jvm_path, os::file_separator());







3385   }
3386   return _default_shared_archive_path;
3387 }
3388 
3389 int Arguments::num_archives(const char* archive_path) {
3390   if (archive_path == nullptr) {
3391     return 0;
3392   }
3393   int npaths = 1;
3394   char* p = (char*)archive_path;
3395   while (*p != '\0') {
3396     if (*p == os::path_separator()[0]) {
3397       npaths++;
3398     }
3399     p++;
3400   }
3401   return npaths;
3402 }
3403 
3404 void Arguments::extract_shared_archive_paths(const char* archive_path,

1901   if (StackReservedPages != 0) {
1902     FLAG_SET_CMDLINE(StackReservedPages, 0);
1903     warning("Reserved Stack Area not supported on this platform");
1904   }
1905 #endif
1906 
1907 #if !defined(X86) && !defined(AARCH64) && !defined(RISCV64) && !defined(ARM) && !defined(PPC64) && !defined(S390)
1908   if (LockingMode == LM_LIGHTWEIGHT) {
1909     FLAG_SET_CMDLINE(LockingMode, LM_LEGACY);
1910     warning("New lightweight locking not supported on this platform");
1911   }
1912 #endif
1913 
1914 #if !defined(X86) && !defined(AARCH64) && !defined(PPC64) && !defined(RISCV64) && !defined(S390)
1915   if (LockingMode == LM_MONITOR) {
1916     jio_fprintf(defaultStream::error_stream(),
1917                 "LockingMode == 0 (LM_MONITOR) is not fully implemented on this architecture");
1918     return false;
1919   }
1920 #endif
1921 #if defined(X86) && !defined(ZERO)
1922   if (LockingMode == LM_MONITOR && UseRTMForStackLocks) {
1923     jio_fprintf(defaultStream::error_stream(),
1924                 "LockingMode == 0 (LM_MONITOR) and -XX:+UseRTMForStackLocks are mutually exclusive");
1925 
1926     return false;
1927   }
1928 #endif
1929   if (VerifyHeavyMonitors && LockingMode != LM_MONITOR) {
1930     jio_fprintf(defaultStream::error_stream(),
1931                 "-XX:+VerifyHeavyMonitors requires LockingMode == 0 (LM_MONITOR)");
1932     return false;
1933   }
1934   return status;
1935 }
1936 
1937 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore,
1938   const char* option_type) {
1939   if (ignore) return false;
1940 
1941   const char* spacer = " ";

3068   if (UseSharedSpaces && patch_mod_javabase) {
3069     no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
3070   }
3071   if (UseSharedSpaces && !DumpSharedSpaces && check_unsupported_cds_runtime_properties()) {
3072     UseSharedSpaces = false;
3073   }
3074 
3075   if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
3076     // Always verify non-system classes during CDS dump
3077     if (!BytecodeVerificationRemote) {
3078       BytecodeVerificationRemote = true;
3079       log_info(cds)("All non-system classes will be verified (-Xverify:remote) during CDS dump time.");
3080     }
3081   }
3082 #endif
3083 
3084 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
3085   UNSUPPORTED_OPTION(ShowRegistersOnAssert);
3086 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
3087 
3088 #ifdef _LP64
3089   if (UseCompactObjectHeaders && UseZGC && !ZGenerational) {
3090     if (FLAG_IS_CMDLINE(UseCompactObjectHeaders)) {
3091       warning("Single-generational ZGC does not work with compact object headers, disabling UseCompactObjectHeaders");
3092     }
3093     FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3094   }
3095   if (UseCompactObjectHeaders && FLAG_IS_CMDLINE(UseCompressedClassPointers) && !UseCompressedClassPointers) {
3096     warning("Compact object headers require compressed class pointers. Disabling compact object headers.");
3097     FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3098   }
3099   if (UseCompactObjectHeaders && LockingMode == LM_LEGACY) {
3100     FLAG_SET_DEFAULT(LockingMode, LM_LIGHTWEIGHT);
3101   }
3102   if (UseCompactObjectHeaders && !UseAltGCForwarding) {
3103     FLAG_SET_DEFAULT(UseAltGCForwarding, true);
3104   }
3105   if (UseCompactObjectHeaders && !UseCompressedClassPointers) {
3106     FLAG_SET_DEFAULT(UseCompressedClassPointers, true);
3107   }
3108 #endif
3109 
3110   return JNI_OK;
3111 }
3112 
3113 // Helper class for controlling the lifetime of JavaVMInitArgs
3114 // objects.  The contents of the JavaVMInitArgs are guaranteed to be
3115 // deleted on the destruction of the ScopedVMInitArgs object.
3116 class ScopedVMInitArgs : public StackObj {
3117  private:
3118   JavaVMInitArgs _args;
3119   char*          _container_name;
3120   bool           _is_set;
3121   char*          _vm_options_file_arg;
3122 
3123  public:
3124   ScopedVMInitArgs(const char *container_name) {
3125     _args.version = JNI_VERSION_1_2;
3126     _args.nOptions = 0;
3127     _args.options = nullptr;
3128     _args.ignoreUnrecognized = false;
3129     _container_name = (char *)container_name;

3380 #if INCLUDE_CDS
3381   // Initialize shared archive paths which could include both base and dynamic archive paths
3382   // This must be after set_ergonomics_flags() called so flag UseCompressedOops is set properly.
3383   //
3384   // UseSharedSpaces may be disabled if -XX:SharedArchiveFile is invalid.
3385   if (DumpSharedSpaces || UseSharedSpaces) {
3386     init_shared_archive_paths();
3387   }
3388 #endif  // INCLUDE_CDS
3389 }
3390 
3391 #if INCLUDE_CDS
3392 // Sharing support
3393 // Construct the path to the archive
3394 char* Arguments::get_default_shared_archive_path() {
3395   if (_default_shared_archive_path == nullptr) {
3396     char jvm_path[JVM_MAXPATHLEN];
3397     os::jvm_path(jvm_path, sizeof(jvm_path));
3398     char *end = strrchr(jvm_path, *os::file_separator());
3399     if (end != nullptr) *end = '\0';
3400     stringStream tmp;
3401     tmp.print("%s%sclasses", jvm_path, os::file_separator());
3402 #ifdef _LP64
3403     if (!UseCompressedOops) {
3404       tmp.print_raw("_nocoops");
3405     }
3406     if (UseCompactObjectHeaders) {
3407       // Note that generation of xxx_coh.jsa variants require
3408       // --enable-cds-archive-coh at build time
3409       tmp.print_raw("_coh");
3410     }
3411 #endif
3412     tmp.print_raw(".jsa");
3413     _default_shared_archive_path = os::strdup(tmp.base());
3414   }
3415   return _default_shared_archive_path;
3416 }
3417 
3418 int Arguments::num_archives(const char* archive_path) {
3419   if (archive_path == nullptr) {
3420     return 0;
3421   }
3422   int npaths = 1;
3423   char* p = (char*)archive_path;
3424   while (*p != '\0') {
3425     if (*p == os::path_separator()[0]) {
3426       npaths++;
3427     }
3428     p++;
3429   }
3430   return npaths;
3431 }
3432 
3433 void Arguments::extract_shared_archive_paths(const char* archive_path,
< prev index next >