harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r540942 - in /harmony/enhanced/drlvm/trunk/vm/vmcore/src: class_support/classloader.cpp gc/root_set_enum_common.cpp kernel_classes/javasrc/java/lang/Class.java kernel_classes/javasrc/java/lang/ClassLoader.java
Date Wed, 23 May 2007 12:54:52 GMT
Author: varlax
Date: Wed May 23 05:54:51 2007
New Revision: 540942

URL: http://svn.apache.org/viewvc?view=rev&rev=540942
Log:
Postfix to HARMONY-3462, corrected spotted issues.

Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java

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=540942&r1=540941&r2=540942
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp Wed May 23 05:54:51
2007
@@ -1595,6 +1595,15 @@
     return clss;
 } // UserDefinedClassLoader::DoLoadClass
 
+static jmethodID getClassRegistryMethod(Global_Env* env) {
+    String* acr_func_name = env->string_pool.lookup("addToLoadedClasses");
+    String* acr_func_desc = env->string_pool.lookup("(Ljava/lang/String;Ljava/lang/Class;)V");
+    Class* clss = env->LoadCoreClass("java/lang/ClassLoader");
+    Method* m = clss->lookup_method(acr_func_name, acr_func_desc);
+    assert(m);
+    return (jmethodID)m;
+}
+
 bool ClassLoader::InsertClass(Class* clss) {
     tmn_suspend_disable();
     if (!IsBootstrap()) // skip BS classes
@@ -1633,14 +1642,10 @@
         chl->object = *clss->get_class_handle();
         args[2].l = chl;
 
-        static String* acr_func_name = env->string_pool.lookup("addToLoadedClasses");
-        static String* acr_func_desc = env->string_pool.lookup("(Ljava/lang/String;Ljava/lang/Class;)V");
-
-        Method* method = class_lookup_method_recursive(m_loader->vt()->clss, acr_func_name,
acr_func_desc);
-        assert(method);
+        static jmethodID registryMethod = getClassRegistryMethod(env);
 
         jvalue res;
-        vm_execute_java_method_array((jmethodID) method, &res, args);
+        vm_execute_java_method_array(registryMethod, &res, args);
 
         if(exn_raised()) {
             tmn_suspend_enable();

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp?view=diff&rev=540942&r1=540941&r2=540942
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp Wed May 23 05:54:51
2007
@@ -139,10 +139,9 @@
  } //vm_enumerate_static_fields
 
 
-// This is the main function used to enumerate Java references by the VM and the JITs.  
-// It is part of the JIT-VM interface.
 // 20030405 Note: When compressing references, vm_enumerate_root_reference() expects to be
called with slots
 // containing *managed* refs (represented by heap_base if null, not 0/NULL), so those refs
must not be NULL. 
+#if _DEBUG
 static void check_ref(void** ref)
 {
     if (VM_Global_State::loader_env->compress_references) {
@@ -156,6 +155,7 @@
         } 
     }
 }
+#endif // _DEBUG
 
 void 
 vm_enumerate_root_reference(void **ref, Boolean is_pinned)

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java?view=diff&rev=540942&r1=540941&r2=540942
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Class.java
Wed May 23 05:54:51 2007
@@ -1160,7 +1160,12 @@
         return VMClassRegistry.getSimpleName(this);
     }
 
-    protected ClassLoader definingLoader;
+    /**
+     * Provides strong referencing between the classloader 
+     * and it's defined classes. Intended for class unloading implementation.
+     * @see java.lang.ClassLoader#loadedClasses
+     */
+    ClassLoader definingLoader;
 
     private final class ReflectionData {
         

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java?view=diff&rev=540942&r1=540941&r2=540942
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
Wed May 23 05:54:51 2007
@@ -106,11 +106,13 @@
      */
     private final HashMap<String, Package> definedPackages;
 
-    /*
-    * The following mapping is used <String binaryClassName, Class clazz>, where binaryClassName
- class name,
-    * clazz - corresponding class.
-    */
-    Hashtable<String, Class> loadedClasses = new Hashtable<String, Class>();

+    /**
+     * The class registry, provides strong referencing between the classloader 
+     * and it's defined classes. Intended for class unloading implementation.
+     * Maps binary class name to the class.
+     * @see java.lang.Class#definingLoader
+     */
+    private HashMap<String, Class> loadedClasses = new HashMap<String, Class>();

 
     /**
      * package private to access from the java.lang.Class class. The following
@@ -377,12 +379,14 @@
     }
 
     /**
-     * @com.intel.drl.spec_ref
+     * Registers the defined class, invoked by VM.
+     * Intended for class unloading implementation.
      */
-    public void addToLoadedClasses(String name, Class clazz) {
+    @SuppressWarnings("unused") 
+    private void addToLoadedClasses(String name, Class clazz) {
         synchronized (loadedClasses){
             loadedClasses.put(name, clazz); 
-    	}
+        }
     }
 
     /**
@@ -390,7 +394,7 @@
      */
     protected final Class<?> defineClass(String name, ByteBuffer b, ProtectionDomain
protectionDomain)
         throws ClassFormatError {
-		byte[] data = b.array();
+        byte[] data = b.array();
         return defineClass(name, data, 0, data.length, protectionDomain);
     }
 



Mime
View raw message