Author: varlax
Date: Thu Feb 15 22:48:50 2007
New Revision: 508325
URL: http://svn.apache.org/viewvc?view=rev&rev=508325
Log:
Partial fix to HARMONY-3184 [drlvm][netbeans] Aborting on RI-supported options
Added handling of -XX:*, -client, -server cmd-line options.
Modified:
harmony/enhanced/drlvm/trunk/build/make/targets/jvmti.test.xml
harmony/enhanced/drlvm/trunk/build/make/targets/kernel.test.xml
harmony/enhanced/drlvm/trunk/build/make/targets/smoke.test.xml
harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp
harmony/enhanced/drlvm/trunk/vm/include/open/vm.h
harmony/enhanced/drlvm/trunk/vm/interpreter/interpreter.emconf
harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties
harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp
Modified: harmony/enhanced/drlvm/trunk/build/make/targets/jvmti.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/targets/jvmti.test.xml?view=diff&rev=508325&r1=508324&r2=508325
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/targets/jvmti.test.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/targets/jvmti.test.xml Thu Feb 15 22:48:50 2007
@@ -136,7 +136,7 @@
failureproperty="${testname}.failed"
timeout="${jvmti.test.timeout}"
jvm="${build.deploy.dir}/jdk/jre/bin/java">
- <jvmarg value="-XDvm.assert_dialog=0" />
+ <jvmarg value="-XX:-vm.assert_dialog" />
<select os="win">
<jvmarg
value="-agentpath:${jvmti.test.native.path}/${testname}/${testname}.dll"
Modified: harmony/enhanced/drlvm/trunk/build/make/targets/kernel.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/targets/kernel.test.xml?view=diff&rev=508325&r1=508324&r2=508325
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/targets/kernel.test.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/targets/kernel.test.xml Thu Feb 15 22:48:50 2007
@@ -153,7 +153,7 @@
timeout="${kernel.test.timeout}"
jvm="${test.jvm.exe}">
- <jvmarg value="-XDvm.assert_dialog=0" />
+ <jvmarg value="-XX:-vm.assert_dialog" />
<jvmarg value="-Dtest.resource.path=${test.resource.path}"/>
<jvmarg value="${kernel.mode.switch}" />
<jvmarg value="-Xbootclasspath/a:${junit.jar}${path.separator}${test.class.path}"
/>
Modified: harmony/enhanced/drlvm/trunk/build/make/targets/smoke.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/targets/smoke.test.xml?view=diff&rev=508325&r1=508324&r2=508325
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/targets/smoke.test.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/targets/smoke.test.xml Thu Feb 15 22:48:50 2007
@@ -222,7 +222,7 @@
</not>
<then>
<java newenvironment="yes" dir="${build.deploy.dir}/jdk/jre/bin"
output="${build.dir}/_smoke.tests/reports/${class.name}_${jit.or.interpreter}.out" classname="${class.name}"
fork="true" jvm="${build.deploy.dir}/jdk/jre/bin/java${executable.postfix}" error="${build.dir}/_smoke.tests/reports/${class.name}_${jit.or.interpreter}.out.err">
- <jvmarg value="-XDvm.assert_dialog=0" />
+ <jvmarg value="-XX:-vm.assert_dialog" />
<jvmarg value="-Djava.library.path=${smoke.test.native.path}/${outdir}"
/>
<jvmarg value="${int.or.jit.arg}" />
<jvmarg value="-classpath" />
@@ -233,7 +233,7 @@
</then>
<else>
<java newenvironment="yes" dir="${build.deploy.dir}/jdk/jre/bin"
output="${build.dir}/_smoke.tests/reports/${class.name}_${jit.or.interpreter}.out" classname="${class.name}"
fork="true" jvm="${build.deploy.dir}/jdk/jre/bin/java${executable.postfix}" error="${build.dir}/_smoke.tests/reports/${class.name}_${jit.or.interpreter}.out.err">
- <jvmarg value="-XDvm.assert_dialog=0" />
+ <jvmarg value="-XX:vm.assert_dialog=0" />
<jvmarg value="-Djava.library.path=${smoke.test.native.path}/${outdir}"
/>
<jvmarg value="-classpath" />
<jvmarg value="${smoke.test.class.path}" />
Modified: harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp?view=diff&rev=508325&r1=508324&r2=508325
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp Thu Feb 15 22:48:50 2007
@@ -321,7 +321,32 @@
set_property(name.c_str(), value.c_str(), VM_PROPERTIES);
}
continue;
+ } else if (startsWith(line, "-XX:") && line.length() >= 5) {
+ idx = line.find('=');
+ std::string name;
+ std::string value;
+ if (idx != std::string::npos) {
+ std::string name = line.substr(4, idx-4);
+ std::string value = line.substr(idx+1);
+ } else {
+ if (line[4] == '-' ) {
+ value = "off";
+ name = line.substr(5);
+ } else if (line[4] == '+') {
+ value = "on";
+ name = line.substr(5);
+ } else {
+ value = "";
+ name = line.substr(4);
+ }
+ }
+
+ if (!is_property_set(name.c_str(),VM_PROPERTIES)) {
+ set_property(name.c_str(), value.c_str(), VM_PROPERTIES);
+ }
+ continue;
}
+
config+=line + "\n";
}
rc = !config.empty();
Modified: harmony/enhanced/drlvm/trunk/vm/include/open/vm.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/vm.h?view=diff&rev=508325&r1=508324&r2=508325
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/vm.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/vm.h Thu Feb 15 22:48:50 2007
@@ -1050,6 +1050,9 @@
*/
VMEXPORT int get_int_property(const char *property_name, int default_value, PropertyTable
table_number);
+//Tries to interpret property value as int and returns it. In case of failure returns default_value.
+// Numbers can include 'm' or 'M' for megabytes, 'k' or 'K' for kilobytes, and 'g' or 'G'
for gigabytes (for example, 32k is the same as 32768).
+VMEXPORT int64 get_numerical_property(const char *property_name, int64 default_value, PropertyTable
table_number);
////
// end miscellaneous functions.
Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/interpreter.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/interpreter.emconf?view=diff&rev=508325&r1=508324&r2=508325
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/interpreter.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/interpreter.emconf Thu Feb 15 22:48:50 2007
@@ -23,4 +23,4 @@
#system properties
-Djava.compiler=interpreter
--XDvm.use_interpreter=true
+-XX:+vm.use_interpreter
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?view=diff&rev=508325&r1=508324&r2=508325
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Thu Feb 15 22:48:50
2007
@@ -2733,6 +2733,32 @@
return return_value;
}
+int64 get_numerical_property(const char *property_name, int64 default_value, PropertyTable
table_number)
+{
+ assert(property_name);
+ char *value = get_property(property_name, table_number);
+ int64 return_value = default_value;
+ if (NULL != value)
+ {
+ int64 size = atol(value);
+ int sizeModifier = tolower(value[strlen(value) - 1]);
+ destroy_property_value(value);
+
+ size_t unit = 1;
+ switch (sizeModifier) {
+ case 'k': unit = 1024; break;
+ case 'm': unit = 1024 * 1024; break;
+ case 'g': unit = 1024 * 1024 * 1024;break;
+ }
+
+ return_value = size * unit;
+ if (return_value / unit != size) {
+ /* overflow happened */
+ return_value = default_value;
+ }
+ }
+ return return_value;
+}
Boolean get_boolean_property(const char *property_name, Boolean default_value, PropertyTable
table_number)
{
assert(property_name);
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties?view=diff&rev=508325&r1=508324&r2=508325
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties Thu Feb 15 22:48:50
2007
@@ -40,7 +40,7 @@
ECHO022=\ -Xbootclasspath:<PATH>\n Set bootclasspath to the specified
value\n -Xbootclasspath/a:<PATH>\n Append specified directories and
files to bootclasspath\n -Xbootclasspath/p:<PATH>\n Prepend specified
directories and files to bootclasspath\n -Xjit <JIT options>\n Specify
JIT specific options\n -Xms<size>\n Set Java heap size\n -Xmx<size>\n
Set maximum Java heap size\n -Xdebug\n Does nothing, this is
a compatibility option\n -Xnoagent\n Does nothing, this is a compatibility
option\n -Xrun\n Specify debugger agent library\n -Xverbose[:<category>[:<file>]\n
Switch logging on [for specified category only\n [and log that category
to a file]]\n -Xwarn[:<category>[:<file>]\n Switch verbose logging
off [for specified category only\n [and log that category to a file]]\n -Xver
boseconf:<file>\n Set up logging via log4cxx configuration file\n -Xverboselog:<file>\n
Log verbose output to a file\n -Xverify[:none|all]\n Do full
bytecode verification\n -Xinvisible\n Retain invisible annotations at runtime\n
-Xfileline\n Add source information to logging messages\n -Xthread\n
Add thread id to logging messages\n -Xcategory\n Add category name
to logging messages\n -Xtimestamp\n Add timestamp to logging messages\n
-Xfunction\n Add function signature to logging messages
ECHO023=\ -Xlog[:<category>[:<file>]\n Switch debug logging on
[for specified category only\n [and log that category to a file]]\n -Xtrace[:<category>[:<file>]\n
Switch trace logging on [for specified category only\n [and log
that category to a file]]
ECHO024=\ -Xstats:<mask>\n Generates different statistics
-ECHO025=\ -Xint\n Use interpreter to execute the program\n -Xgc:<gc
options>\n Specify gc specific options\n -Xem:<em options>\n
Specify em specific options\n -Xdumpstubs\n Writes stubs generated
by LIL to disk\n -Xparallel_jit\n Launch compilation in parallel (default)\n
-Xno_parallel_jit\n Do not launch compilation in parallel\n -Xdumpfile:<file>\n
Specifies a file name for the dump\n -XD<name>=<value>\n
set an internal system property
+ECHO025=\ -Xint\n Use interpreter to execute the program\n -Xgc:<gc
options>\n Specify gc specific options\n -Xem:<em options>\n
Specify em specific options\n -Xdumpstubs\n Writes stubs generated
by LIL to disk\n -Xparallel_jit\n Launch compilation in parallel (default)\n
-Xno_parallel_jit\n Do not launch compilation in parallel\n -Xdumpfile:<file>\n
Specifies a file name for the dump\n -XX:<name>=<value>\n
set an internal system property
ECHO026=Boolean-valued properties (set to one of {on,true,1,off,false,0} through -XD<name>=<value>):\n\n
vm.assert_dialog (default TRUE):\n If false, prevent assertion failures from
popping up a dialog box.
ECHO027=\ vm.crash_handler (default FALSE):\n Invoke gdb on crashes.
ECHO028=\ vm.finalize (default TRUE):\n Run finalizers.\n vm.jit_may_inline_sync
(default TRUE):\n The JIT is allowed to inline part of the synchronization sequence.\n
vm.use_interpreter (default FALSE):\n Use interpreter not jit.\n vm.use_verifier
(default TRUE):\n Use verifier.\n vm.jvmti.enabled (default FALSE):\n
Whether JVMTI mode is enabled.\n vm.bootclasspath.appendclasspath (default FALSE):\n
Append classpath to the bootclasspath.\n\nOther properties:\n\n vm.boot.library.path:\n
List of directories which contain additional dynamic libraries to load into VM.\n
vm.boot.class.path:\n Virtual machine bootclasspath.\n vm.dlls:\n
A '{0}'-delimited list of modular dlls (GC/etc.) to load at startup.\n vm.em_dll:\n
A '{0}'-execution manager (EM) dll to load at startup.\n vm.other_natives_dlls:\n
A '{0}'-delimited list of dll
s contained native methods implementations to load at startup.\n vm.components.<component>.classpath:\n
Part of a <component>'s classpath to append to the JDK booclasspath\n
vm.components.<component>.startupclass:\n A <component> class to be
initialized during startup
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp?view=diff&rev=508325&r1=508324&r2=508325
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp Thu Feb 15 22:48:50
2007
@@ -88,7 +88,8 @@
void print_generic_help()
{
- LECHO(21, "Usage: {0} [-options] class [args...]\n"
+ LECHO(21,
+ "Usage: {0} [-options] class [args...]\n"
" (to execute a method main() of the class)\n"
" or {0} [-options] -jar jarfile [args...]\n"
" (to execute the jar file)\n"
@@ -98,6 +99,8 @@
" -cp <class search path of directories and zip/jar files>\n"
" A {1} separated list of directories, jar archives,\n"
" and zip archives to search for class file\n"
+ " -client select the 'client' VM (same as -Xem:client)\n"
+ " -server select the 'server' VM (same as -Xem:server)\n"
" -D<name>=<value>\n"
" set a system property\n"
" -showversion print product version and continue\n"
@@ -131,7 +134,8 @@
static void print_help_on_nonstandard_options()
{
- LECHO(22, " -Xbootclasspath:<PATH>\n"
+ LECHO(22,
+ " -Xbootclasspath:<PATH>\n"
" Set bootclasspath to the specified value\n"
" -Xbootclasspath/a:<PATH>\n"
" Append specified directories and files to bootclasspath\n"
@@ -174,7 +178,8 @@
" -Xfunction\n"
" Add function signature to logging messages");
#ifdef _DEBUG
- LECHO(23, " -Xlog[:<category>[:<file>]\n"
+ LECHO(23,
+ " -Xlog[:<category>[:<file>]\n"
" Switch debug logging on [for specified category only\n"
" [and log that category to a file]]\n"
" -Xtrace[:<category>[:<file>]\n"
@@ -183,10 +188,12 @@
#endif //_DEBUG
#ifdef VM_STATS
- LECHO(24, " -Xstats:<mask>\n"
- " Generates different statistics");
+ LECHO(24,
+ " -Xstats:<mask>\n"
+ " Generates different statistics");
#endif // VM_STATS
- LECHO(25, " -Xint\n"
+ LECHO(25,
+ " -Xint\n"
" Use interpreter to execute the program\n"
" -Xgc:<gc options>\n"
" Specify gc specific options\n"
@@ -200,13 +207,21 @@
" Do not launch compilation in parallel\n"
" -Xdumpfile:<file>\n"
" Specifies a file name for the dump\n"
- " -XD<name>=<value>\n"
- " set an internal system property");
+ " -XX:<name>=<value>\n"
+ " set an internal system property.\n"
+ " Boolean options may be turned on with -XX:+<option>\n"
+ " and turned off with -XX:-<option>\n"
+ " Numeric options are set with -XX:<option>=<number>.\n"
+ " Numbers can include suffix 'm' or 'M' for megabytes,\n"
+ " 'k' or 'K' for kilobytes, and 'g' or 'G' for gigabytes\n"
+ " (for example, 32k is the same as 32768).\n"
+ );
} //print_help_on_nonstandard_options
void print_vm_standard_properties()
{
- LECHO(26, "Boolean-valued properties (set to one of {on,true,1,off,false,0} through -XD<name>=<value>):\n\n"
+ LECHO(26,
+ "Boolean-valued properties (set to one of {on,true,1,off,false,0} through -XD<name>=<value>):\n\n"
" vm.assert_dialog (default TRUE):\n"
" If false, prevent assertion failures from popping up a dialog box.");
#ifdef PLATFORM_POSIX
@@ -404,6 +419,9 @@
const char* arg = option + strlen("-Xem:");
p_env->VmProperties()->set("em.properties", arg);
+ } else if (strcmp(option, "-client") == 0 || strcmp(option, "-server") == 0) {
+ p_env->VmProperties()->set("em.properties", option + 1);
+
} else if (begins_with(option, "-Xms")) {
// cut -Xms
const char* arg = option + 4;
@@ -486,7 +504,7 @@
}
else if (strncmp(option, "-D", 2) == 0) {
}
- else if (strncmp(option, "-XD", 3) == 0) {
+ else if (strncmp(option, "-XD", 3) == 0 || strncmp(option, "-XX:", 4) == 0) {
}
else if (strcmp(option, "-Xdumpstubs") == 0) {
dump_stubs = true;
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp?view=diff&rev=508325&r1=508324&r2=508325
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp Thu Feb 15 22:48:50
2007
@@ -264,16 +264,20 @@
apr_pool_create(&prop_pool, 0);
}
/*
- * 0. Add predefined properties
+ * 1. Add predefined properties
*/
-
init_java_properties(*p_env->JavaProperties());
init_vm_properties(*p_env->VmProperties());
/*
- * 2. Check whether there is a command line option, say,
- * -Properties-file "d:\xyz\eee\vm.properties" or -Dproperties key=value,
- * read the Properties, if key is duplicated, override the value.
+ * 2. Process command line options, possibly overriding the default values.
+ * Java properties are set as -Dkey[=value];
+ * VM properties are set with the following syntax ("fully compatible" with RI):
+ * - options are set with -XX:<option>=<string>
+ * - Boolean options may be turned on with -XX:+<option> and turned off with -XX:-<option>
+ * - Numeric options are set with -XX:<option>=<number>.
+ * Numbers can include 'm' or 'M' for megabytes, 'k' or 'K' for kilobytes, and 'g' or
+ * 'G' for gigabytes (for example, 32k is the same as 32768).
*/
char *src, *tok;
for (int arg_num = 0; arg_num < p_env->vm_arguments.nOptions; arg_num++)
@@ -297,6 +301,7 @@
}
else if (strncmp(option, "-XD", 3) == 0)
{
+ WARN("Deprecated syntax to set internal property, use -XX:key=value instead:
" << option);
TRACE("setting internal property " << option + 3);
src = strdup(option + 3);
tok = strchr(src, '=');
@@ -309,6 +314,35 @@
{
p_env->VmProperties()->set(unquote(src), "");
}
+
+ STD_FREE(src);
+ }
+ else if (strncmp(option, "-XX:", 4) == 0)
+ {
+ TRACE("setting internal property " << option + 4);
+ src = strdup(option + 4);
+ char* name = unquote(src);
+ char* value = strchr(src, '=');
+ if(value)
+ {
+ *value = '\0';
+ ++value;
+ }
+ else
+ {
+ if (name[0] == '-' ) {
+ value = "off";
+ ++name;
+ } else if (src[0] == '+') {
+ value = "on";
+ ++name;
+ } else {
+ value = "";
+ }
+ }
+
+ TRACE("parsed internal property " << name << " = " << value
<< ";");
+ p_env->VmProperties()->set(name, value);
STD_FREE(src);
}
|