harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r545153 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H3658/ src/test/regression/H3658/Test.java src/test/regression/H3658/run.test.xml vm/jitrino/src/jet/cg_obj.cpp vm/jitrino/src/optimizer/IRBuilder.cpp
Date Thu, 07 Jun 2007 12:25:54 GMT
Author: varlax
Date: Thu Jun  7 05:25:53 2007
New Revision: 545153

URL: http://svn.apache.org/viewvc?view=rev&rev=545153
Log:
Applied HARMONY-3658 [drlvm][jit] Incorrect class resolution / initialization order in JET
and OPT compilers

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H3658/
    harmony/enhanced/drlvm/trunk/src/test/regression/H3658/Test.java
    harmony/enhanced/drlvm/trunk/src/test/regression/H3658/run.test.xml
Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3658/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3658/Test.java?view=auto&rev=545153
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3658/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3658/Test.java Thu Jun  7 05:25:53 2007
@@ -0,0 +1,29 @@
+package org.apache.harmony.drlvm.tests.regression.h3658;
+
+import junit.framework.TestCase;
+
+public class Test extends TestCase {
+
+    public void test() {
+        int x = 1;
+        try {
+            new Foo(x=0);
+        } catch (Error e) {}
+       assertEquals(1, x); 
+    } 
+}
+
+class Foo {
+    static {
+        exception();
+    }
+
+    static void exception() {
+        throw new RuntimeException();
+    }
+
+    Foo(int x) {
+        System.out.println("FAILED!");
+    }
+} 
+

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3658/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3658/run.test.xml?view=auto&rev=545153
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3658/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3658/run.test.xml Thu Jun  7 05:25:53
2007
@@ -0,0 +1,14 @@
+<project name="RUN HARMONY-3658 Regression Test">
+  <target name="run-test">
+    <run-junit-test 
+        test="org.apache.harmony.drlvm.tests.regression.h3658.Test"
+        vmarg="-Xem:opt">
+    </run-junit-test>
+
+    <run-junit-test 
+        test="org.apache.harmony.drlvm.tests.regression.h3658.Test"
+        vmarg="-Xem:jet">
+    </run-junit-test>
+
+  </target>
+</project>

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp?view=diff&rev=545153&r1=545152&r2=545153
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_obj.cpp Thu Jun  7 05:25:53 2007
@@ -172,6 +172,9 @@
         if (klass == NULL) {
             gen_call_throw(ci_helper_linkerr, rt_helper_throw_linking_exc, 0, enclClass,
cpIndex, OPCODE_NEW);
         } else {
+            if ( klass!=enclClass && class_needs_initialization(klass)) {
+                gen_call_vm(ci_helper_o, rt_helper_init_class, 0, klass);
+            }
             unsigned size = class_get_boxed_data_size(klass);
             Allocation_Handle ah = class_get_allocation_handle(klass);
             static CallSig ci_new(CCONV_STDCALL, i32, jobj);
@@ -183,11 +186,9 @@
         gen_call_vm(ci_new_with_resolve, rt_helper_new_withresolve, 0, enclClass, cpIndex);
     }
     gen_save_ret(jobj);
-    // the returned can not be null, marking as such.
-    vstack(0).set(VA_NZ);
-    // allocation assumes GC invocation
-    
-    m_bbstate->seen_gcpt = true;
+    vstack(0).set(VA_NZ);// the returned can not be null, marking as such.
+    m_bbstate->seen_gcpt = true;// allocation assumes GC invocation
+
 }
 
 void CodeGen::gen_instanceof_cast(JavaByteCodes opcode, Class_Handle enclClass, unsigned
short cpIdx)

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp?view=diff&rev=545153&r1=545152&r2=545153
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp Thu Jun  7 05:25:53
2007
@@ -1950,8 +1950,14 @@
 
 void
 IRBuilder::genInitType(NamedType* type) {
-    if (!type->needsInitialization())
+    if (!type->needsInitialization()) {
         return;
+    }
+    MethodDesc * m = irManager->getCompilationInterface().getMethodToCompile();
+    NamedType* classType = m->getParentType();
+    if (type == classType) {
+        return;
+    }
     Opnd* opnd = lookupHash(Op_InitType, type->getId());
     if (opnd) return; // no need to re-initialize
 
@@ -2871,8 +2877,11 @@
 
 Opnd*
 IRBuilder::genNewObj(Type* type) {
+    assert(type->isNamedType());
     Opnd* dst = createOpnd(type);
+    //FIXME class initialization must be done before allocating new object
     appendInst(instFactory->makeNewObj(dst, type));
+    genInitType(type->asNamedType());
     return dst;
 }
 



Mime
View raw message