You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2007/07/25 22:39:52 UTC

svn commit: r559588 - in /harmony/enhanced/drlvm/trunk/vm: include/open/vm.h vmcore/include/type.h vmcore/src/class_support/C_Interface.cpp vmcore/src/class_support/java_type.cpp

Author: gshimansky
Date: Wed Jul 25 13:39:51 2007
New Revision: 559588

URL: http://svn.apache.org/viewvc?view=rev&rev=559588
Log:
Applied patch from HARMONY-3627
[drlvm][exception] VM works incorrectly if several threads catch StackOverflowError


Modified:
    harmony/enhanced/drlvm/trunk/vm/include/open/vm.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/type.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/java_type.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/include/open/vm.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/vm.h?view=diff&rev=559588&r1=559587&r2=559588
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/vm.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/vm.h Wed Jul 25 13:39:51 2007
@@ -843,7 +843,8 @@
  * <code>type_info_is_unboxed</code> returned <code>TRUE</code>. 
  * If the type info is a vector or a general array, return the
  * class handle for the array type (not the element type).
- * Does not leave any exception on stack.
+ * Invokes class loader with no exception but preserves previously
+ * raised exception.
  */
 VMEXPORT Class_Handle type_info_get_class_no_exn(Type_Info_Handle tih);
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/type.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/type.h?view=diff&rev=559588&r1=559587&r2=559588
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/type.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/type.h Wed Jul 25 13:39:51 2007
@@ -91,7 +91,7 @@
     // For other types return NULL.
     Class* load_type_desc();
 
-    bool is_loaded() const {return clss != NULL;}
+    bool is_loaded();
 
     const String* get_type_name(){
         return name;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?view=diff&rev=559588&r1=559587&r2=559588
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Wed Jul 25 13:39:51 2007
@@ -2076,8 +2076,17 @@
 
 Class_Handle type_info_get_class_no_exn(Type_Info_Handle tih)
 {
+    // Store raised exception
+    jthrowable exc_object = exn_get();
+    // Workaround to let JIT invoke class loader even if exception is pending
+    exn_clear();
     Class_Handle ch = type_info_get_class(tih);
+    // To clear exn_class if set
     exn_clear();
+    // Restore saved exception
+    if (exc_object)
+        exn_raise_object(exc_object);
+
     return ch;
 } // type_info_get_class_no_exn
 
@@ -2131,22 +2140,7 @@
             }
             return type_info_is_resolved(td->get_element_type());
         case K_Object:
-            {
-                bool res = td->is_loaded();
-                if (!res) {
-                    const String* typeName = td->get_type_name();
-                    assert(typeName);
-                    res =  td->get_classloader()->LookupClass(typeName) != NULL;
-                    if (res) {
-                        // type descs for some bootstrap classes (e.g. java/lang/Throwable) 
-                        // are not initialized by default. Do it here to avoid extra lookups next time
-                        td->load_type_desc();
-                        assert(td->is_loaded());
-                    }
-                }
-                
-                return res;
-            }
+                return td->is_loaded();
         default:
             ABORT("Unexpected kind");
             return 0;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/java_type.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/java_type.cpp?view=diff&rev=559588&r1=559587&r2=559588
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/java_type.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/java_type.cpp Wed Jul 25 13:39:51 2007
@@ -146,6 +146,21 @@
     }
 }
 
+bool TypeDesc::is_loaded()
+{
+    if (clss != NULL)
+        return true;
+
+    assert(name);
+    assert(loader);
+    Class* loaded_class = loader->LookupClass(name);
+
+    if (loaded_class)
+        clss = loaded_class;
+
+    return (clss != NULL);
+}
+
 TypeDesc* TypeDesc::type_desc_create_vector()
 {
     TypeDesc* td = get_vector_type();