harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r427693 [2/2] - in /incubator/harmony/enhanced/drlvm/trunk: build/make/components/extra/ vm/em/src/ vm/gc/src/ vm/include/open/ vm/interpreter/src/ vm/jitrino/src/codegenerator/ia32/ vm/jitrino/src/jet/ vm/jitrino/src/optimizer/ vm/port/src...
Date Tue, 01 Aug 2006 19:45:41 GMT
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/FinalizerThread.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/FinalizerThread.java?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/FinalizerThread.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/FinalizerThread.java
Tue Aug  1 12:45:38 2006
@@ -61,7 +61,9 @@
      * Initializes finalization system. Starts permanent thread.
      */
     static void initialize() {
-        trace("FinalizerThread: static initialization started");
+        if (TRACE) {
+            trace("FinalizerThread: static initialization started");
+        }
 
         String p = System.getProperty("vm.finalize");
         processorsQuantity = getProcessorsQuantity();
@@ -74,15 +76,20 @@
             (new FinalizerThread(true)).start();
             enabled = true;
         }
-        
-        trace("FinalizerThread: static initialization complete");
+
+        if (TRACE) {
+            trace("FinalizerThread: static initialization complete");
+        }
     }
 
     /**
      * VM calls this method to request finalizer thread shutdown.
      */
     static void shutdown() {
-        trace("shutting down finalizer thread");
+        if (TRACE) {
+            trace("shutting down finalizer thread");
+        }
+
         if (startFinalizationOnExit) {
             doFinalizationOnExit();
         }
@@ -110,21 +117,27 @@
     // Maximum quantity of finalizers threads
     private static final int MAX_THREADS = 256;
 
+    // create separate class for finalizer workLock to easier debugging
+    private static class FinalizerWorkLock {};
+
     // Lock used to wake up permanent finalizer threads and synchronize change of state of
work
-    private static Object workLock = new Object();
+    private static Object workLock = new FinalizerWorkLock();
 
     // Shows that finalizers works in state on exit
     // Used by VM. It should be package private to eliminate compiler warning.
     static boolean onExit = false;
 
+    // create separate class for finalizer waitFinishLock to easier debugging
+    private static class FinalizerWaitFinishLock {};
+
     /*
      * Lock used to to synchronize quantity of active threads and to wake up finalizer starter
thread
      * when new finalization tasks aren't available and finalizer threads finish work.
      */
-    private static Object waitFinishLock = new Object();
+    private static Object waitFinishLock = new FinalizerWaitFinishLock();
 
     /*
-     * The Quantity of active finalizer threads which shoud be stopped to wake up finalizer
starter 
+     * The Quantity of active finalizer threads which shoud be stopped to wake up finalizer
starter
      * thread. When is thread is started this counter is incremented when thread is stoppig
it's decremeted.
      * Zero means finalization tasks aren't available and finalizer threads aren't working.
      */
@@ -200,20 +213,27 @@
      * It is called from startFinalization() only.
      */
     private static void spawnBalanceThreads() {
+        /* finalizer threads shouldn't be spawn by finalizer thread,
+         * in this case balancing can't work
+         */
+        if (isFinalizerThread()) {
+            return;
+        }
+
         FinalizerThread newThread = null;
         if (waitFinishCounter >= MAX_THREADS) {
-            // do nothing   
+            // do nothing
         } else {
             try {
                 for (int i = 0; i < processorsQuantity; i++) {
                     newThread = new FinalizerThread(false);
-                    
-                    synchronized (newThread){
+
+                    synchronized (newThread.startLock){
                         newThread.start();
-                        
+
                         // waiting when new thread will be started
                         try {
-                            newThread.wait();
+                            newThread.startLock.wait();
                         } catch (InterruptedException e) {}
                     }
                 }
@@ -262,6 +282,8 @@
         }
     }
 
+    private static final boolean TRACE = false;
+
     /**
      * debug output.
      */
@@ -283,7 +305,12 @@
     public FinalizerThread () {
         this (true);
     }
-    
+
+    // create separate class for finalizer startLock to easier debugging
+    private class FinalizerStartLock {};
+
+    private FinalizerStartLock startLock = new FinalizerStartLock();
+
     protected FinalizerThread (boolean permanent) {
         super(threadGroup, "FinalizerThread");
         this.permanent = permanent;
@@ -291,28 +318,41 @@
     }
 
     public void run() {
-        trace((permanent ? "permanent":"temporary") 
-                + " finalization thread started");
-        
+        // don't put any code here, before try block
+
         try {
             synchronized (waitFinishLock) {
                 waitFinishCounter ++;
             }
 
-            // notify that finalizer thread has started
-            synchronized (this) {
-                notify();
+            /* notify that finalizer thread has started.
+             * Don't put any code whith any memory allocation before here!
+             * It should be granted that notify is called in any case!
+             */
+            synchronized (startLock) {
+                startLock.notify();
             }
-            
+
+            if (TRACE) {
+                if (permanent) {
+                    trace("permanent finalization thread started");
+                } else {
+                    trace("temporary finalization thread started");
+                }
+            }
+
             while (true) {
                 int n = doFinalization(128);
 
                 synchronized (workLock) {
                     if (shutdown) {
-                        trace("terminated by shutdown request");
+
+                        if (TRACE) {
+                            trace("terminated by shutdown request");
+                        }
                         break;
                     }
-                } 
+                }
                 
                 if (0 == n) {
                     if (permanent) {
@@ -322,9 +362,9 @@
                     }
                 }
             }
-        } catch (Throwable e) {
-            warn("FinalizerThread terminated by " + e);
-            throw new RuntimeException("FinalizerThread interrupted", e);
+        } catch (Throwable th) {
+            warn("FinalizerThread terminated by " + th);
+            throw new RuntimeException("FinalizerThread interrupted", th);
         } finally {
             synchronized (waitFinishLock) {
                 waitFinishCounter --;
@@ -333,7 +373,10 @@
                     waitFinishLock.notifyAll();
                 }
             }
-            trace("FinalizerThread completed");
+
+            if (TRACE) {
+                trace("FinalizerThread completed");
+            }
         }
     }
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
Tue Aug  1 12:45:38 2006
@@ -781,10 +781,11 @@
             localValues.put(local, value);
             return value;
         }
-        if ((value = localValues.get(local)) == null) {
-            value = local.initialValue();
-            localValues.put(local, value);
+        if (localValues.containsKey(local)) {
+            return localValues.get(local);
         }
+        value = local.initialValue();
+        localValues.put(local, value);
         return value;
     }
     

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ThreadGroup.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ThreadGroup.java?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ThreadGroup.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ThreadGroup.java
Tue Aug  1 12:45:38 2006
@@ -24,7 +24,7 @@
 import java.util.LinkedList;
 import java.util.Iterator;
 import java.util.WeakHashMap;
-import java.util.Set;
+import java.util.ConcurrentModificationException;
 
 /**
  * @com.intel.drl.spec_ref 
@@ -110,17 +110,17 @@
      */
     public int activeCount() {
         int count = 0;
-        List groupsListCopy = null; // a copy of subgroups list
-        Set threadsCopy = null; // threads
+        List groupsListCopy = null;  // a copy of subgroups list
+        Object[] threadsCopy = null; // a copy of threads list
         synchronized (this) {
             if (destroyed) {
                 return 0;
             }
-         	groupsListCopy = (List)groups.clone();
-            threadsCopy = threads.keySet();
+            threadsCopy = copyThreads();
+            groupsListCopy = (List)groups.clone();
         }
-        for (Iterator it = threadsCopy.iterator(); it.hasNext();) {
-            if ( ((Thread)it.next()).isAlive()) {
+        for (int i = 0; i < threadsCopy.length; i++) {
+            if (((Thread) threadsCopy[i]).isAlive()) {
                 count++;
             }
         }
@@ -391,6 +391,21 @@
         }
         groups.add(group);
     }
+    
+    /**
+     * Copies this ThreadGroup's threads to an array which is used in iteration
+     * over threads because iteration over a WeakHashMap object can lead to
+     * ConcurrentModificationException.
+     */
+    private Object[] copyThreads() {
+        while (true) {
+            try {
+                // toArray() can throw ConcurrentModificationException
+                return threads.keySet().toArray();
+            } catch (ConcurrentModificationException e) {
+            }
+        }
+    }
 
     /**
      * Copies all the threads contained in the snapshot of this thread group to
@@ -407,21 +422,20 @@
      *         done
      */
     private int enumerate(Thread[] list, int offset, boolean recurse) {
-        if (destroyed) {
-            return offset;
-        }
-        List groupsListCopy = null; // a copy of subgroups list
-        Set threadsCopy = null; // a copy of threads list
+        List groupsListCopy = null;  // a copy of subgroups list
+        Object[] threadsCopy = null; // a copy of threads list
         synchronized (this) {
-            threadsCopy = threads.keySet();
+            if (destroyed) {
+                return offset;
+            }
+            threadsCopy = copyThreads();
             if (recurse) {
                 groupsListCopy = (List)groups.clone();
             }
         }
-        for (Iterator it = threadsCopy.iterator(); it.hasNext();) {
-            Thread nextThread = (Thread)it.next();
-            if (nextThread.isAlive()) {
-                list[offset++] = nextThread;
+        for (int i = 0; i < threadsCopy.length; i++) {
+            if (((Thread) threadsCopy[i]).isAlive()) {
+                list[offset++] = (Thread) threadsCopy[i];
                 if (offset == list.length) {
                     return offset;
                 }
@@ -480,14 +494,15 @@
     private void list(String prefix) {
         System.out.println(prefix + toString());
         prefix += LISTING_INDENT;
-        List groupsListCopy = null; // a copy of subgroups list
-        Set threadsCopy = threads.keySet();
+        List groupsListCopy = null;   // a copy of subgroups list
+        Object[] threadsCopy = null;  // a copy of threads list
         synchronized (this) {
-            for (Iterator it = threadsCopy.iterator(); it.hasNext();) {
-                System.out.println(prefix + it.next());
-            }
+            threadsCopy = copyThreads();
             groupsListCopy = (List)groups.clone();
         }
+        for (int i = 0; i < threadsCopy.length; i++) {
+            System.out.println(prefix + (Thread) threadsCopy[i]);
+        }
         for (Iterator it = groupsListCopy.iterator(); it.hasNext();) {
             ((ThreadGroup)it.next()).list(prefix);
         }
@@ -514,8 +529,9 @@
      * method to avoid calls to the checkAccess() method on subgroups
      */
     private synchronized void nonsecureInterrupt() {
-        for (Iterator it = threads.keySet().iterator(); it.hasNext();) {
-            ((Thread)it.next()).interrupt();
+        Object[] threadsCopy = copyThreads(); // a copy of threads list
+        for (int i = 0; i < threadsCopy.length; i++) {
+            ((Thread) threadsCopy[i]).interrupt();
         }
         for (Iterator it = groups.iterator(); it.hasNext();) {
             ((ThreadGroup)it.next()).nonsecureInterrupt();
@@ -527,8 +543,9 @@
      * to avoid calls to the checkAccess() method on subgroups
      */
     private synchronized void nonsecureResume() {
-        for (Iterator it = threads.keySet().iterator(); it.hasNext();) {
-            ((Thread)it.next()).resume();
+        Object[] threadsCopy = copyThreads();
+        for (int i = 0; i < threadsCopy.length; i++) {
+            ((Thread) threadsCopy[i]).resume();
         }
         for (Iterator it = groups.iterator(); it.hasNext();) {
             ((ThreadGroup)it.next()).nonsecureResume();
@@ -556,8 +573,9 @@
      * We add this method to avoid calls to the checkAccess() method on subgroups
      */
     private synchronized void nonsecureStop() {
-        for (Iterator it = threads.keySet().iterator(); it.hasNext();) {
-            ((Thread)it.next()).stop();
+        Object[] threadsCopy = copyThreads();
+        for (int i = 0; i < threadsCopy.length; i++) {
+            ((Thread) threadsCopy[i]).stop();
         }
         for (Iterator it = groups.iterator(); it.hasNext();) {
             ((ThreadGroup)it.next()).nonsecureStop();
@@ -569,8 +587,9 @@
      * We add this method to avoid calls to the checkAccess() method on subgroups
      */
     private synchronized void nonsecureSuspend() {
-        for (Iterator it = threads.keySet().iterator(); it.hasNext();) {
-            ((Thread)it.next()).suspend();
+        Object[] threadsCopy = copyThreads(); // a copy of threads list
+        for (int i = 0; i < threadsCopy.length; i++) {
+            ((Thread) threadsCopy[i]).suspend();
         }
         for (Iterator it = groups.iterator(); it.hasNext();) {
             ((ThreadGroup)it.next()).nonsecureSuspend();

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMStart.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMStart.java?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMStart.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMStart.java
Tue Aug  1 12:45:38 2006
@@ -115,7 +115,7 @@
                 // load and start main class
                 ClassLoader loader = ClassLoader.getSystemClassLoader();
                 Class cl = Class.forName(mainClass, true, loader);
-                final Method mainMethod = cl.getDeclaredMethod("main", 
+                final Method mainMethod = cl.getMethod("main", 
                         new Class[]{String[].class});
                 int expectedModifiers = (Modifier.PUBLIC | Modifier.STATIC);
                 if ((mainMethod.getModifiers() & expectedModifiers) != expectedModifiers


Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/AccessibleObject.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/AccessibleObject.java?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/AccessibleObject.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/reflect/AccessibleObject.java
Tue Aug  1 12:45:38 2006
@@ -211,7 +211,7 @@
      *         Class
      */
     private void setAccessible0(boolean flag) throws SecurityException {
-        if (this instanceof Constructor
+        if (flag && this instanceof Constructor
             && ((Constructor)this).getDeclaringClass() == Class.class) {
             throw new SecurityException(
                 "Can not make the java.lang.Class class constructor accessible");

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_VMClassRegistry.cpp
Tue Aug  1 12:45:38 2006
@@ -422,7 +422,7 @@
     Java_java_lang_VMClassRegistry_linkClass(jenv, unused, clazz);
     if(jenv->ExceptionCheck())
         return;
-    class_initialize_from_jni(clss, false);
+    class_initialize_from_jni(clss);
 }
 
 /*

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
Tue Aug  1 12:45:38 2006
@@ -246,13 +246,21 @@
              jc r=0,not_initialized; \
              ret; \
              :not_initialized; \
-             push_m2n 0, 0; \
+             push_m2n 0, %1i; \
              in2out platform:void; \
-             call %1i; \
+             call %2i; \
+             l1 = ts; \
+             ld l1, [l1 + %3i:ref]; \
+             jc l1 != 0,_exn_raised; \
              pop_m2n; \
-             ret;",
-            (void *)is_class_initialized,
-            (void *)class_initialize);
+             ret; \
+             :_exn_raised; \
+             out platform::void; \
+             call.noret %4i;",
+             (void *)is_class_initialized,
+             FRAME_JNI,
+             (void *)class_initialize,
+             OFFSET(VM_thread, p_exception_object), (void*)rethrow_current_thread_exception);
         assert(lil_is_valid(cs));
         addr = LilCodeGenerator::get_platform()->compile(cs, "vm_initialize_class_naked",
dump_stubs);
         lil_free_code_stub(cs);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp
Tue Aug  1 12:45:38 2006
@@ -1123,7 +1123,7 @@
     emitter.ipf_brret(br_many, br_sptk, br_none, BRANCH_RETURN_LINK_REG, SCRATCH_PRED_REG);
 
     // push m2n frame
-    unsigned out_arg0 = m2n_gen_push_m2n(&emitter, NULL, FRAME_UNKNOWN, false, 0, 0,
1);
+    unsigned out_arg0 = m2n_gen_push_m2n(&emitter, NULL, FRAME_JNI, false, 0, 0, 1);
     emitter.ipf_mov(out_arg0+0, IN_REG0);
     void (*p_class_initialize)(Class *clss);
     p_class_initialize = class_initialize;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/jarfile_support.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/jarfile_support.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/jarfile_support.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/jarfile_support.cpp Tue Aug
 1 12:45:38 2006
@@ -173,7 +173,7 @@
 
     lseek(fp, offsetCD, SEEK_SET);
 
-    buf = (unsigned char *)STD_MALLOC(fsize - offsetCD);
+    buf = (unsigned char *)STD_ALLOCA(fsize - offsetCD);
     fsize = read(fp, buf, fsize - offsetCD);
 
     off = 0;
@@ -204,4 +204,3 @@
 #ifndef PLATFORM_POSIX
 #pragma warning( default: 4786 ) // identifier was truncated to 255 characters in the browser
information
 #endif
-

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/mem_alloc.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/mem_alloc.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/mem_alloc.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/mem_alloc.cpp Tue Aug  1 12:45:38
2006
@@ -41,8 +41,8 @@
 unsigned page_size_for_allocation = 0;
 size_t   initial_code_pool_size = 0;
 
-Pool_Descriptor* jit_code_pool;
-Pool_Descriptor* vtable_data_pool;
+Pool_Descriptor* jit_code_pool = NULL;
+Pool_Descriptor* vtable_data_pool = NULL;
 
 static apr_pool_t* aux_pool;
 static apr_thread_mutex_t* aux_mutex;
@@ -283,6 +283,10 @@
 
 void vm_mem_dealloc()
 {
+    delete vtable_data_pool;
+    vtable_data_pool = NULL;
+    delete jit_code_pool;
+    jit_code_pool = NULL;
     std::vector<port_vmem_t *>::iterator it;
     for (it = m_allocated_memory_ptrs.begin(); it != m_allocated_memory_ptrs.end(); it++)
     {

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp Tue Aug  1 12:45:38
2006
@@ -32,6 +32,7 @@
 #include "classloader.h"
 
 #include "vm_stats.h"
+#include "GlobalClassLoaderIterator.h"
 
 VM_Statistics vm_stats_total;
 
@@ -471,28 +472,31 @@
 static void print_methods()
 {
     printf("--------- begin native method execution counts (total and slow-path):\n");
-    ClassTable* ct = VM_Global_State::loader_env->bootstrap_class_loader->
-        GetLoadedClasses();
-    ClassTable::iterator it;
-    for (it = ct->begin(); it != ct->end(); it++)
-    {
-        Class *c = it->second;
-        int n_methods = c->n_methods;
-        for(int i = 0; i < n_methods; i++) {
-            Method *m = &(c->methods[i]);
-            if (m->is_fake_method()) {
-                continue;   // ignore fake methods
-            }
-            if(m->num_accesses) {
-                const char *cname = c->name->bytes;
-                const char *mname = m->get_name()->bytes;
-                const char *descr = m->get_descriptor()->bytes;
-                printf("%11" FMT64 "u : %11" FMT64 "u ::: %s.%s%s\n",
-                       m->num_accesses,
-                       m->num_slow_accesses,
-                       cname,
-                       mname,
-                       descr);
+    GlobalClassLoaderIterator clIterator;
+    ClassLoader *cl;
+    for(cl = clIterator.first(); cl; cl = clIterator.next()) {
+        ClassTable* ct = cl->GetLoadedClasses();
+        ClassTable::iterator it;
+        for (it = ct->begin(); it != ct->end(); it++)
+        {
+            Class *c = it->second;
+            int n_methods = c->n_methods;
+            for(int i = 0; i < n_methods; i++) {
+                Method *m = &(c->methods[i]);
+                if (m->is_fake_method()) {
+                    continue;   // ignore fake methods
+                }
+                if(m->num_accesses) {
+                    const char *cname = c->name->bytes;
+                    const char *mname = m->get_name()->bytes;
+                    const char *descr = m->get_descriptor()->bytes;
+                    printf("%11" FMT64 "u : %11" FMT64 "u ::: %s.%s%s\n",
+                        m->num_accesses,
+                        m->num_slow_accesses,
+                        cname,
+                        mname,
+                        descr);
+                }
             }
         }
     }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp Tue Aug  1
12:45:38 2006
@@ -3614,6 +3614,14 @@
             << ") Must call initializers using invokespecial" );
         return VER_ErrorConstantPool;
     }
+    // check number of arguments
+    if( cp_parse.method.m_inlen > 255 ) {
+        VERIFY_REPORT( ctex, "(class: " << class_get_name( ctex->m_class ) 
+            << ", method: " << method_get_name( ctex->m_method )
+            << method_get_descriptor( ctex->m_method )
+            << ") The number of method parameters is limited to 255" );
+        return VER_ErrorInstruction;
+    }
     // set stack modifier for instruction
     vf_set_stack_modifier( code, cp_parse.method.m_outlen - cp_parse.method.m_inlen );
     // set minimal stack for instruction
@@ -3649,6 +3657,14 @@
     if( result != VER_OK ) {
         return result;
     }
+    // check number of arguments
+    if( cp_parse.method.m_inlen > 255 ) {
+        VERIFY_REPORT( ctex, "(class: " << class_get_name( ctex->m_class ) 
+            << ", method: " << method_get_name( ctex->m_method )
+            << method_get_descriptor( ctex->m_method )
+            << ") The number of method parameters is limited to 255" );
+        return VER_ErrorInstruction;
+    }
     // set stack modifier for instruction
     vf_set_stack_modifier( code, cp_parse.method.m_outlen - cp_parse.method.m_inlen );
     // set minimal stack for instruction
@@ -4008,6 +4024,13 @@
     unsigned short index;
     for( index = 0; array[index] == '['; index++ ) {
         continue;
+    }
+    if( index > 255 ) {
+        VERIFY_REPORT( ctex, "(class: " << class_get_name( ctex->m_class ) 
+            << ", method: " << method_get_name( ctex->m_method )
+            << method_get_descriptor( ctex->m_method )
+            << ") Array with too many dimensions" );
+        return VER_ErrorInstruction;
     }
     if( dimension == 0 || index < dimension ) {
         VERIFY_REPORT( ctex, "(class: " << class_get_name( ctex->m_class ) 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_dataflow.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_dataflow.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_dataflow.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_dataflow.cpp Tue Aug
 1 12:45:38 2006
@@ -802,7 +802,7 @@
                 VERIFY_REPORT( ctex, "(class: " << class_get_name( ctex->m_class
) 
                     << ", method: " << method_get_name( ctex->m_method )
                     << method_get_descriptor( ctex->m_method )
-                    << ") Data flow analysis error" );
+                    << ") Data flow analysis error (uninitialized)" );
                 return result;
             }
             copy = true;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.cpp?rev=427693&r1=427692&r2=427693&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.cpp Tue Aug  1
12:45:38 2006
@@ -1225,7 +1225,7 @@
     // get instance class
     class_handler instance = vf_resolve_class( instance_name, false, ctex );
     if( !instance ) {
-        // inctance class isn't loaded
+        // instance class isn't loaded
         return VER_ClassNotLoaded;
     }
 
@@ -1336,10 +1336,11 @@
     }
 
     /**
-     * Verifier which is built on Java Spec recommendation of verification proccess
-     * doesn't check interfaces usage. Unfortunately, a lot of Java applications
-     * depends on this neglect. To be compatible with those applications we should
-     * do full constraint checks only if -Xverify option is present in command line.
+     * Verifier which is built on Java VM Specification 2nd Edition (4.9.2)
+     * recommendation of verification proccess doesn't check interfaces usage.
+     * Unfortunately, a lot of Java applications depends on this neglect.
+     * To be compatible with those applications we should do full constraint
+     * checks only if -Xverify option is present in command line.
      */
     if( !ctex->m_dump.m_verify && class_is_interface_( target ) ) {
         // no need to check



Mime
View raw message