You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by xl...@apache.org on 2007/07/03 04:16:50 UTC

svn commit: r552648 - in /harmony/enhanced/drlvm/trunk/vm/vmcore: include/init.h src/init/harmony.properties src/init/vm_init.cpp src/init/vm_properties.cpp

Author: xli
Date: Mon Jul  2 19:16:46 2007
New Revision: 552648

URL: http://svn.apache.org/viewvc?view=rev&rev=552648
Log:
HARMONY-3934 : comments by Vladimir Beliaev: 

The attached patch does the following things:

1. reports error if -XX propery format is broken (-XX:+key, -XX:-key or -XX:key=[value] is allowed), i.e. '-XX:gc.dll=' is a proper specification (of empty value) while '-XX:gc.dll' argument produces error ('initialize_properties' returnns the status code now).

2. renamed 'vm.dlls' to 'gc.dll'". This required to do the following:

    2.1 add a check that "gc.dll" property is always set (the vm_init code expects this property is set either to default value or it is set through command line)

   2.2 remove "parsing cycle" of gc.dll (previously "vm.dlls" may contain the list of DLLs)

I've tested DRLVM with different variants of related command line - works as expected. 

Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h?view=diff&rev=552648&r1=552647&r2=552648
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h Mon Jul  2 19:16:46 2007
@@ -35,6 +35,6 @@
 void* get_portlib_for_logger(Global_Env *p_env);
 void parse_jit_arguments(JavaVMInitArgs* vm_arguments);
 void print_generic_help();
-void initialize_properties(Global_Env *p_env);
+jint initialize_properties(Global_Env *p_env);
 
 #endif //_INIT_H

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=552648&r1=552647&r2=552648
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties Mon Jul  2 19:16:46 2007
@@ -41,6 +41,9 @@
 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    -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              Also one of {on,true,1,off,false,0} can be used.\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\n              Please refer to h
 ttp://harmony.apache.org/cmd_options.html\n              for available properties description
+ECHO026=
+ECHO027=
+ECHO028=Wrong option format {0}
 ECHO029=Use {0} -help to get help on command line options
 ECHO030=Unknown option {0}
 ECHO031=Unknown argument {0} of -Xhelp: option
@@ -121,7 +124,7 @@
 WARN013=Cannot load EM component from {0}
 WARN014=Cannot instantiate EM
 WARN015=Cannot get EM_VM interface
-WARN016=Mandatory library cannot be loaded: {0}
+WARN016=GC library cannot be loaded: {0}
 WARN017=VM component mismatch: the VM compresses references but the GC doesn't.
 WARN018=VM component mismatch: the VM compresses references but a JIT doesn't
 WARN019=VM component mismatch: the VM doesn't compress references but the GC does.
@@ -149,3 +152,4 @@
 WARN041=Execution stack follows, consider using addr2line\n{0}
 WARN042=Fatal error
 WARN043=Fatal exception, terminating
+WARN044={0} internal property is undefined

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp?view=diff&rev=552648&r1=552647&r2=552648
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Mon Jul  2 19:16:46 2007
@@ -144,35 +144,30 @@
         return status;
     }
 
-    const char delimiters[] = {PORT_PATH_SEPARATOR, 0};
-
-    char* dlls = vm_env->VmProperties()->get("vm.dlls");
-    if (!dlls) return JNI_OK;
-    
-    char* tok = strtok((char *)dlls, delimiters);
-    while (tok) {
-        TRACE("analyzing dll " << tok);
+    /*
+     * Preload <GC>.dll which is specified by 'gc.dll' property.
+     *
+     * According to current design (r552465) 'gc.dll' property
+     * is always set: in configuration file (by default), or it can
+     * be reset from command line...
+     */
 #ifndef USE_GC_STATIC
-        if (vm_is_a_gc_dll(tok)) {
-            vm_add_gc(tok);
-            goto next_dll;
-        }
-#endif
+    char* gc_dll = vm_env->VmProperties()->get("gc.dll");
 
-#ifdef USE_DISEM
-        if (vm_is_a_disem_dll(tok)) {
-            vm_add_disem(tok);
-            goto next_dll;
-        }
-#endif
-        LWARN(16, "Mandatory library cannot be loaded: {0}" << tok);
-        status = JNI_ERR;
-        break;
-next_dll:
-        tok = strtok(NULL, delimiters);
+    if (!gc_dll) {
+        LWARN(44, "{0} internal property is undefined" << "gc.dll");
+        return JNI_ERR;
     }
+    TRACE("analyzing gc.dll " << gc_dll);
 
-    vm_env->VmProperties()->destroy(dlls);
+    if (vm_is_a_gc_dll(gc_dll)) {
+        vm_add_gc(gc_dll);
+    } else {
+        LWARN(16, "GC library cannot be loaded: {0}" << gc_dll);
+        status = JNI_ERR;
+    }
+    vm_env->VmProperties()->destroy(gc_dll);
+#endif
     return status;
 }
 
@@ -667,7 +662,8 @@
     // 20030407 Note: property initialization must follow initialization of the default JITs to allow 
     // the command line to override those default JITs.
 
-    initialize_properties(vm_env);
+    status = initialize_properties(vm_env);
+    if (status != JNI_OK) return status;
 
     tm_properties = (struct tm_props*) STD_MALLOC(sizeof(struct tm_props));
 

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=552648&r1=552647&r2=552648
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp Mon Jul  2 19:16:46 2007
@@ -272,7 +272,7 @@
         properties.set_new("vm.jvmti.enabled", "false");
         properties.set_new("vm.jvmti.compiled_method_load.inlined", "false");
         properties.set_new("vm.bootclasspath.appendclasspath", "false");
-        properties.set_new("vm.dlls", PORT_DSO_NAME(GC_DLL));
+        properties.set_new("gc.dll", PORT_DSO_NAME(GC_DLL));
         properties.set_new("thread.soft_unreservation", "false");
 
         int n_api_dll_files = sizeof(api_dll_files) / sizeof(char *);
@@ -284,9 +284,10 @@
         properties.set_new("vm.other_natives_dlls", path_buf);
 }
 
-void
-initialize_properties(Global_Env * p_env)
+jint initialize_properties(Global_Env * p_env)
 {
+    jint status = JNI_OK;
+
     if (!prop_pool) {
         apr_pool_create(&prop_pool, 0);
     }
@@ -359,6 +360,8 @@
                     ++name;
                 } else {
                     value = "";
+                    LECHO(28, "Wrong option format {0}" << option);
+                    status = JNI_ERR;
                 }
             }
 
@@ -366,14 +369,19 @@
             p_env->VmProperties()->set(name, value);
 
             STD_FREE(src);
+
+            if (status != JNI_OK) break;
         }
     }
 
 /*
  * 2. Set predefined values to properties not defined via vm options.
  */
-    init_java_properties(*p_env->JavaProperties());
-    init_vm_properties(*p_env->VmProperties());
-
+    if (status == JNI_OK)
+    {
+        init_java_properties(*p_env->JavaProperties());
+        init_vm_properties(*p_env->VmProperties());
+    }
     apr_pool_clear(prop_pool);
+    return status;
 }