hotspot/src/share/vm/runtime/arguments.cpp
changeset 22734 41757c1f3946
parent 22524 f1db7977d906
child 22735 b6a3f5dbd2c2
equal deleted inserted replaced
22733:61060412fd34 22734:41757c1f3946
    99 bool   Arguments::_java_compiler                = false;
    99 bool   Arguments::_java_compiler                = false;
   100 bool   Arguments::_xdebug_mode                  = false;
   100 bool   Arguments::_xdebug_mode                  = false;
   101 const char*  Arguments::_java_vendor_url_bug    = DEFAULT_VENDOR_URL_BUG;
   101 const char*  Arguments::_java_vendor_url_bug    = DEFAULT_VENDOR_URL_BUG;
   102 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;
   102 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;
   103 int    Arguments::_sun_java_launcher_pid        = -1;
   103 int    Arguments::_sun_java_launcher_pid        = -1;
   104 bool   Arguments::_created_by_gamma_launcher    = false;
   104 bool   Arguments::_sun_java_launcher_is_altjvm  = false;
   105 
   105 
   106 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*)
   106 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*)
   107 bool   Arguments::_AlwaysCompileLoopMethods     = AlwaysCompileLoopMethods;
   107 bool   Arguments::_AlwaysCompileLoopMethods     = AlwaysCompileLoopMethods;
   108 bool   Arguments::_UseOnStackReplacement        = UseOnStackReplacement;
   108 bool   Arguments::_UseOnStackReplacement        = UseOnStackReplacement;
   109 bool   Arguments::_BackgroundCompilation        = BackgroundCompilation;
   109 bool   Arguments::_BackgroundCompilation        = BackgroundCompilation;
   149   }
   149   }
   150 }
   150 }
   151 
   151 
   152 // Process java launcher properties.
   152 // Process java launcher properties.
   153 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
   153 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
   154   // See if sun.java.launcher or sun.java.launcher.pid is defined.
   154   // See if sun.java.launcher, sun.java.launcher.is_altjvm or
       
   155   // sun.java.launcher.pid is defined.
   155   // Must do this before setting up other system properties,
   156   // Must do this before setting up other system properties,
   156   // as some of them may depend on launcher type.
   157   // as some of them may depend on launcher type.
   157   for (int index = 0; index < args->nOptions; index++) {
   158   for (int index = 0; index < args->nOptions; index++) {
   158     const JavaVMOption* option = args->options + index;
   159     const JavaVMOption* option = args->options + index;
   159     const char* tail;
   160     const char* tail;
   160 
   161 
   161     if (match_option(option, "-Dsun.java.launcher=", &tail)) {
   162     if (match_option(option, "-Dsun.java.launcher=", &tail)) {
   162       process_java_launcher_argument(tail, option->extraInfo);
   163       process_java_launcher_argument(tail, option->extraInfo);
       
   164       continue;
       
   165     }
       
   166     if (match_option(option, "-Dsun.java.launcher.is_altjvm=", &tail)) {
       
   167       if (strcmp(tail, "true") == 0) {
       
   168         _sun_java_launcher_is_altjvm = true;
       
   169       }
   163       continue;
   170       continue;
   164     }
   171     }
   165     if (match_option(option, "-Dsun.java.launcher.pid=", &tail)) {
   172     if (match_option(option, "-Dsun.java.launcher.pid=", &tail)) {
   166       _sun_java_launcher_pid = atoi(tail);
   173       _sun_java_launcher_pid = atoi(tail);
   167       continue;
   174       continue;
  1011     return true;
  1018     return true;
  1012   } else if (strcmp(key, "sun.java.command") == 0) {
  1019   } else if (strcmp(key, "sun.java.command") == 0) {
  1013     _java_command = value;
  1020     _java_command = value;
  1014 
  1021 
  1015     // Record value in Arguments, but let it get passed to Java.
  1022     // Record value in Arguments, but let it get passed to Java.
  1016   } else if (strcmp(key, "sun.java.launcher.pid") == 0) {
  1023   } else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0 ||
  1017     // launcher.pid property is private and is processed
  1024              strcmp(key, "sun.java.launcher.pid") == 0) {
  1018     // in process_sun_java_launcher_properties();
  1025     // sun.java.launcher.is_altjvm and sun.java.launcher.pid property are
       
  1026     // private and are processed in process_sun_java_launcher_properties();
  1019     // the sun.java.launcher property is passed on to the java application
  1027     // the sun.java.launcher property is passed on to the java application
  1020     FreeHeap(key);
  1028     FreeHeap(key);
  1021     if (eq != NULL) {
  1029     if (eq != NULL) {
  1022       FreeHeap(value);
  1030       FreeHeap(value);
  1023     }
  1031     }
  1798   }
  1806   }
  1799 }
  1807 }
  1800 
  1808 
  1801 void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) {
  1809 void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) {
  1802   _sun_java_launcher = strdup(launcher);
  1810   _sun_java_launcher = strdup(launcher);
  1803   if (strcmp("gamma", _sun_java_launcher) == 0) {
       
  1804     _created_by_gamma_launcher = true;
       
  1805   }
       
  1806 }
  1811 }
  1807 
  1812 
  1808 bool Arguments::created_by_java_launcher() {
  1813 bool Arguments::created_by_java_launcher() {
  1809   assert(_sun_java_launcher != NULL, "property must have value");
  1814   assert(_sun_java_launcher != NULL, "property must have value");
  1810   return strcmp(DEFAULT_JAVA_LAUNCHER, _sun_java_launcher) != 0;
  1815   return strcmp(DEFAULT_JAVA_LAUNCHER, _sun_java_launcher) != 0;
  1811 }
  1816 }
  1812 
  1817 
  1813 bool Arguments::created_by_gamma_launcher() {
  1818 bool Arguments::sun_java_launcher_is_altjvm() {
  1814   return _created_by_gamma_launcher;
  1819   return _sun_java_launcher_is_altjvm;
  1815 }
  1820 }
  1816 
  1821 
  1817 //===========================================================================================================
  1822 //===========================================================================================================
  1818 // Parsing of main arguments
  1823 // Parsing of main arguments
  1819 
  1824 
  3763         !(FLAG_IS_CMDLINE(UseBiasedLocking))) {
  3768         !(FLAG_IS_CMDLINE(UseBiasedLocking))) {
  3764       UseBiasedLocking = false;
  3769       UseBiasedLocking = false;
  3765     }
  3770     }
  3766   }
  3771   }
  3767 
  3772 
  3768   // set PauseAtExit if the gamma launcher was used and a debugger is attached
       
  3769   // but only if not already set on the commandline
       
  3770   if (Arguments::created_by_gamma_launcher() && os::is_debugger_attached()) {
       
  3771     bool set = false;
       
  3772     CommandLineFlags::wasSetOnCmdline("PauseAtExit", &set);
       
  3773     if (!set) {
       
  3774       FLAG_SET_DEFAULT(PauseAtExit, true);
       
  3775     }
       
  3776   }
       
  3777 
       
  3778   return JNI_OK;
  3773   return JNI_OK;
  3779 }
  3774 }
  3780 
  3775 
  3781 jint Arguments::adjust_after_os() {
  3776 jint Arguments::adjust_after_os() {
  3782 #if INCLUDE_ALL_GCS
  3777 #if INCLUDE_ALL_GCS