harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r482618 - in /harmony/enhanced/drlvm/trunk/vm: jitrino/config/ia32/server.emconf vmcore/include/classloader.h vmcore/src/class_support/classloader.cpp vmcore/src/init/vm_init.cpp
Date Tue, 05 Dec 2006 12:18:38 GMT
Author: varlax
Date: Tue Dec  5 04:18:37 2006
New Revision: 482618

URL: http://svn.apache.org/viewvc?view=rev&rev=482618
Log:
Fixed HARMONY-2375. Made BootstrapClassLoader::SetBCPElement private and moved handling of
magics classpath to BootstrapClassLoader::Initialize.
Tested on WinXP.

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf?view=diff&rev=482618&r1=482617&r2=482618
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf Tue Dec  5 04:18:37
2006
@@ -91,4 +91,4 @@
 
 #GC magics support
 -Dvm.components.gc_cc.startupclass=org.apache.harmony.drlvm.gc_cc.GCHelper
--Dvm.components.gc_cc.classpath=gc_cc.jar
+-XDvm.component.classpath.gc_cc=gc_cc.jar

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h?view=diff&rev=482618&r1=482617&r2=482618
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/classloader.h Tue Dec  5 04:18:37 2006
@@ -389,7 +389,7 @@
         assert (k <= K_LAST_PRIMITIVE ); // primitive types are limited by K_LAST_PRIMITIVE
bound
         return primitive_types[k];
     }
-    void SetBCPElement(const char *path, apr_pool_t *tmp_pool);
+
 protected:
     virtual Class* DoLoadClass(Global_Env* env, const String* name);
 
@@ -402,6 +402,7 @@
         const char* class_name_in_jar, const String* class_name, bool* not_found);
     void SetClasspathFromString(char* prop_string, apr_pool_t *tmp_pool);
     void SetClasspathFromJarFile(JarFile *jar, apr_pool_t *tmp_pool);
+    void SetBCPElement(const char *path, apr_pool_t *tmp_pool);
 
     BCPElements m_BCPElements;
     Global_Env* m_env;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp?view=diff&rev=482618&r1=482617&r2=482618
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp Tue Dec  5 04:18:37
2006
@@ -1307,6 +1307,50 @@
     }
 }
 
+
+/**
+* Part of bootstrap classpath composed with jars from components.
+*/
+static char* bootstrap_components_classpath(Global_Env *vm_env) {
+    const char* PREFIX = "vm.component.classpath.";
+
+    const char* kernel_dir_path = vm_env->JavaProperties()->get(O_A_H_VM_VMDIR);
+    char* buf = NULL;
+    size_t buf_size = 0, buf_len = 0;
+
+    char** keys = vm_env->VmProperties()->get_keys_staring_with(PREFIX);
+    unsigned i = 0;
+    for (; keys[i]; ++i) 
+    {
+        const char* key = keys[i];
+        const char* path = vm_env->VmProperties()->get(keys[i]);
+        size_t path_len = strlen(path) + strlen(PORT_PATH_SEPARATOR_STR) + 1;
+        // check if path must be extended
+        bool no_dir = (strstr(path, PORT_FILE_SEPARATOR_STR) == NULL);
+        if (no_dir) {
+            path_len += strlen(kernel_dir_path) + 1;
+        }
+        if (buf_len + path_len > buf_size) {
+            buf_size += path_len * 2;
+            buf = (char*)STD_REALLOC(buf, buf_size);
+            buf[buf_len] = '\0';
+        }
+        buf_len += path_len;
+        if (no_dir) {
+            strcat(buf, kernel_dir_path);
+            strcat(buf, PORT_FILE_SEPARATOR_STR);
+        }
+        strcat(buf, path);
+        strcat(buf, PORT_PATH_SEPARATOR_STR);
+        vm_env->VmProperties()->destroy((char*)path);
+    } 
+    vm_env->VmProperties()->destroy(keys);
+    vm_env->JavaProperties()->destroy(const_cast<char*>(kernel_dir_path));
+
+    return buf;
+}
+
+
 bool BootstrapClassLoader::Initialize(ManagedObject* UNREF loader)
 {
     // init bootstrap class loader
@@ -1332,14 +1376,15 @@
     /*
      *  at this point, LUNI is loaded, so we can use the boot classpath
      *  generated there to set vm.boot.class.path since we didn't do
-     *  it before.  We need  to add on the kernel.jar
+     *  it before.  We need  to add on the kernel.jar 
+     *  and magics support jars (if any).
      *  note that parse_arguments.cpp defers any override, postpend or 
-     *  preprend here, storing everything as properties.
+     *  prepend here, storing everything as properties.
      */
      
     /*
      * start with the boot classpath. If overridden, just use that as the basis
-     * and otherwise, contstruct from o.a.h.b.c.p + o.a.h.vm.vmdir to add 
+     * and otherwise, construct from o.a.h.b.c.p + o.a.h.vm.vmdir to add 
      * the kernel
      */
      
@@ -1354,14 +1399,21 @@
         
         char *kernel_dir_path = m_env->JavaProperties()->get(O_A_H_VM_VMDIR);
 
-        char *kernel_path = (char *) malloc(strlen(kernel_dir_path == NULL ? "" : kernel_dir_path)

+        char* comp_path = bootstrap_components_classpath(m_env);
+        char *kernel_path = (char *) malloc(strlen(kernel_dir_path) 
                                         + strlen(PORT_FILE_SEPARATOR_STR) 
-                                        + strlen(KERNEL_JAR) + 1);
+                                        + strlen(KERNEL_JAR) + 1
+                                        + (comp_path ? strlen(comp_path) + strlen(PORT_PATH_SEPARATOR_STR)
: 0) );
     
         strcpy(kernel_path, kernel_dir_path);
         strcat(kernel_path, PORT_FILE_SEPARATOR_STR);
         strcat(kernel_path, KERNEL_JAR);
         m_env->JavaProperties()->destroy(kernel_dir_path);
+        if (comp_path) {
+            strcat(kernel_path, PORT_PATH_SEPARATOR_STR);
+            strcat(kernel_path, comp_path);
+            STD_FREE(comp_path);
+        }
 
         char *luni_path = m_env->JavaProperties()->get(O_A_H_BOOT_CLASS_PATH);
         

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=482618&r1=482617&r2=482618
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Tue Dec  5 04:18:37 2006
@@ -280,52 +280,6 @@
 }
 
 /**
-* Extends bootstrap classpath with jars from components
-*/
-static void bootstrap_add_components_classpath(Global_Env *vm_env) {
-    static std::string VM_COMPONENT_BOOTSTRAP_PREFIX="vm.components.";
-    static std::string VM_COMPONENT_BOOTSTRAP_SUFFIX=".classpath";
-
-    // create temp pool for apr functions
-    apr_pool_t *tmp_pool;
-    apr_pool_create(&tmp_pool, NULL);
-
-    std::string kernel_dir_path = get_property(O_A_H_VM_VMDIR, JAVA_PROPERTIES);
-
-    char** keys = get_properties_keys(JAVA_PROPERTIES);
-    for (unsigned i = 0; keys[i] != NULL; ++i) {
-        const char* key = keys[i];
-        //check if the property name is VM_COMPONENT_BOOTSTRAP_PREFIX.*.VM_COMPONENT_BOOTSTRAP_SUFFIX
form
-        if (strncmp(VM_COMPONENT_BOOTSTRAP_PREFIX.c_str(), key, VM_COMPONENT_BOOTSTRAP_PREFIX.length()))
{
-            continue;
-        }
-        size_t len = strlen(key);
-        if (len < VM_COMPONENT_BOOTSTRAP_PREFIX.length()+ 2 + VM_COMPONENT_BOOTSTRAP_SUFFIX.length())
{
-            continue;
-        }
-        if (strcmp(VM_COMPONENT_BOOTSTRAP_SUFFIX.c_str(), key + len - VM_COMPONENT_BOOTSTRAP_SUFFIX.length()))
{
-            continue;
-        }
-        //all checks passed
-        //extends boot class path with the property value
-        char* path = get_property(key, JAVA_PROPERTIES);
-        // check if path must be extended
-        std::string absPath;
-        if (strstr(path, PORT_FILE_SEPARATOR_STR)==NULL) {
-            absPath = kernel_dir_path + path;
-        } else {
-            absPath = path;
-        }
-        destroy_property_value(path);
-        vm_env->bootstrap_class_loader->SetBCPElement(absPath.c_str(), tmp_pool);
-    }
-
-    destroy_properties_keys(keys);
-
-    apr_pool_destroy(tmp_pool);
-}
-
-/**
  * Loads initial classes. For example j.l.Object, j.l.Class, etc.
  */
 static void bootstrap_initial_java_classes(Global_Env * vm_env)
@@ -334,8 +288,6 @@
     TRACE("bootstrapping initial java classes");
 
     vm_env->bootstrap_class_loader->Initialize();
-
-    bootstrap_add_components_classpath(vm_env);
 
     /*
      *  Bootstrap java.lang.Class class. This requires also loading the other classes 



Mime
View raw message