harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r474197 - in /incubator/harmony/enhanced/drlvm/trunk/vm: em/src/ include/ vmcore/include/ vmcore/src/class_support/ vmcore/src/init/ vmcore/src/jni/
Date Mon, 13 Nov 2006 09:00:14 GMT
Author: geirm
Date: Mon Nov 13 01:00:14 2006
New Revision: 474197

URL: http://svn.apache.org/viewvc?view=rev&rev=474197
Log:
tweaks to work better embedded w/o our launcher.

I also learned a bit about embedding, and will 
post notes on wiki tomorrow


Added:
    incubator/harmony/enhanced/drlvm/trunk/vm/include/vm_properties.h   (with props)
Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classpath_const.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/properties.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp?view=diff&rev=474197&r1=474196&r2=474197
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp Mon Nov 13 01:00:14 2006
@@ -30,6 +30,8 @@
 #include "ini.h"
 #include "cxxlog.h"
 
+#include "vm_properties.h"
+
 #include <assert.h>
 #include <algorithm>
 #include <sstream>
@@ -325,7 +327,8 @@
     }
 
     if (configFileName.find('/') == configFileName.npos && configFileName.find('\\')
== configFileName.npos ) {
-        std::string defaultConfigDir = vm_get_property_value("org.apache.harmony.vm.vmdir");
+        std::string defaultConfigDir = vm_get_property_value(O_A_H_VM_VMDIR);
+        
         configFileName = defaultConfigDir + "/" + configFileName;
     }
     std::string config = readFile(configFileName);

Added: incubator/harmony/enhanced/drlvm/trunk/vm/include/vm_properties.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/vm_properties.h?view=auto&rev=474197
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/vm_properties.h (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/vm_properties.h Mon Nov 13 01:00:14
2006
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+#ifndef VM_PROPERTIES_H_
+#define VM_PROPERTIES_H_
+
+/**
+ *   Constants used for VM properties
+ */
+
+#define O_A_H_BOOT_CLASS_PATH  "org.apache.harmony.boot.class.path"
+#define O_A_H_VM_VMDIR         "org.apache.harmony.vm.vmdir"
+
+#define VM_BOOT_CLASS_PATH     "vm.boot.class.path"
+#define SUN_BOOT_CLASS_PATH    "sun.boot.class.path"
+
+#endif /*VM_PROPERTIES_H_*/

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/include/vm_properties.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classpath_const.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classpath_const.h?view=diff&rev=474197&r1=474196&r2=474197
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classpath_const.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classpath_const.h Mon Nov 13
01:00:14 2006
@@ -17,6 +17,8 @@
 #ifndef CLASSPATH_CONST_H_
 #define CLASSPATH_CONST_H_
 
+#include "vm_properties.h"
+
 /**
  *   Constants used for classpath definition and manipulation
  */
@@ -25,13 +27,7 @@
 #define XBOOTCLASSPATH_A       "-Xbootclasspath/a:"
 #define XBOOTCLASSPATH_P       "-Xbootclasspath/p:"
 
-#define O_A_H_BOOT_CLASS_PATH  "org.apache.harmony.boot.class.path"
-#define O_A_H_VM_VMDIR         "org.apache.harmony.vm.vmdir"
-
 #define KERNEL_JAR             "kernel.jar"
-
-#define VM_BOOT_CLASS_PATH     "vm.boot.class.path"
-#define SUN_BOOT_CLASS_PATH    "sun.boot.class.path"
 
 #endif /*CLASSPATH_CONST_H_*/
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp?view=diff&rev=474197&r1=474196&r2=474197
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp Mon
Nov 13 01:00:14 2006
@@ -1316,7 +1316,9 @@
         properties_get_string_property(
             reinterpret_cast<PropertiesHandle>(m_env->properties),
             "vm.other_natives_dlls" );
+             
     size_t len = strlen( lib_list ) + 1;
+
     char *libraries = (char*)STD_ALLOCA( len );
     memcpy( libraries, lib_list, len );
 
@@ -1359,8 +1361,8 @@
         /* not overridden, so lets build, adding the kernel to what luni made for us */
         
         const char *kernel_dir_path = properties_get_string_property(hProps, O_A_H_VM_VMDIR);
-    
-        char *kernel_path = (char *) malloc(strlen(kernel_dir_path) 
+
+        char *kernel_path = (char *) malloc(strlen(kernel_dir_path == NULL ? "" : kernel_dir_path)

                                         + strlen(PORT_FILE_SEPARATOR_STR) 
                                         + strlen(KERNEL_JAR) + 1);
     
@@ -1370,7 +1372,8 @@
         
         const char *luni_path = properties_get_string_property(hProps,O_A_H_BOOT_CLASS_PATH);
         
-        char *vmboot = (char *) malloc(strlen(luni_path) + strlen(kernel_path) + strlen(PORT_PATH_SEPARATOR_STR)
+ 1);
+        char *vmboot = (char *) malloc(strlen(luni_path == NULL ? "" : luni_path) 
+                                + strlen(kernel_path) + strlen(PORT_PATH_SEPARATOR_STR) +
1);
         
         strcpy(vmboot, kernel_path);
         strcat(vmboot, PORT_PATH_SEPARATOR_STR);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/properties.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/properties.cpp?view=diff&rev=474197&r1=474196&r2=474197
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/properties.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/properties.cpp Mon Nov 13 01:00:14
2006
@@ -33,6 +33,8 @@
 #include "port_filepath.h"
 #include "port_sysinfo.h"
 
+#include "vm_properties.h"
+
 #define PROP_ENV_NAME  "VM_PROPERTIES"
 #define PROP_FILE_NAME "vm.properties"
 #define BOOT_PROPS_FILE_NAME "bootclasspath.properties"
@@ -252,12 +254,29 @@
      *  launched in a mariad of ways, so just set to empty string.
      */
     add_pair_to_properties(properties, "vm.boot.library.path", "");
-    TRACE( "vm.boot.library.path = " << base_path_buf);
+    TRACE( "vm.boot.library.path = ");
     
     // Added for compatibility with the external java JDWP agent
     add_pair_to_properties(properties, "sun.boot.library.path", base_path_buf);
     TRACE( "sun.boot.library.path = " << base_path_buf);
 
+    /*
+     *  it's possible someone forgot to set this property - set to default of .
+     */
+    if (properties_get_string_property(reinterpret_cast<PropertiesHandle>(&properties),
O_A_H_VM_VMDIR) == NULL) {
+        TRACE2("init", "o.a.h.vm.vmdir not set - setting predefined value of as '.'");
+        add_pair_to_properties(properties, O_A_H_VM_VMDIR, ".");
+    }
+    
+    /*
+     *  also, do the same for java.class.path
+     */
+     
+    if (properties_get_string_property(reinterpret_cast<PropertiesHandle>(&properties),
"java.class.path") == NULL) {
+        TRACE2("init", "java.class.path not set - setting predefined value of '.'");
+        add_pair_to_properties(properties, "java.class.path", ".");
+    }
+    
     // vm.dlls initialization, the value is location of VM executable +
     // GC_DLL and on IPF JIT_DLL
     // FIXME, add JIT_DLL on other architectures when we have JIT in a dll on ia32

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp?view=diff&rev=474197&r1=474196&r2=474197
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Mon Nov 13 01:00:14
2006
@@ -318,12 +318,14 @@
     Class* GenericDeclaration_Class    = preload_class(vm_env, "java/lang/reflect/GenericDeclaration");
     Class* Type_Class                  = preload_class(vm_env, "java/lang/reflect/Type");
     vm_env->JavaLangClass_Class        = preload_class(vm_env, vm_env->JavaLangClass_String);
+
     vm_env->FinishVMBootstrap();
 
     // Now create the java_lang_Class instance.
     create_instance_for_class(vm_env, vm_env->JavaLangClass_Class);
 
     ClassTable* table = vm_env->bootstrap_class_loader->GetLoadedClasses();
+    
     unsigned num = 0;
     for (ClassTable::const_iterator it = table->begin(), end = table->end(); 
         it != end; ++it, ++num)

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp?view=diff&rev=474197&r1=474196&r2=474197
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp Mon Nov 13 01:00:14 2006
@@ -446,8 +446,8 @@
     jthread java_thread;
     jint status;
 
-
-    status = jni_init();
+    status = jni_init();        
+    
     if (status != JNI_OK) return status;
 
     apr_thread_mutex_lock(GLOBAL_LOCK);
@@ -492,7 +492,7 @@
     java_vm->vm_env = vm_env;
     java_vm->reserved = (void *)0x1234abcd;
     *p_vm = java_vm;
-    
+        
     status = vm_init1(java_vm, vm_args);
     if (status != JNI_OK) {
         goto done;



Mime
View raw message