You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by mf...@apache.org on 2007/08/06 16:24:46 UTC

svn commit: r563148 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H3716/ src/test/regression/H3816/ src/test/regression/H4596/ vm/jitrino/src/codegenerator/ia32/ vm/jitrino/src/optimizer/ vm/vmcore/src/jit/

Author: mfursov
Date: Mon Aug  6 07:24:45 2007
New Revision: 563148

URL: http://svn.apache.org/viewvc?view=rev&rev=563148
Log:
Fixes for "continue in finally block" problems for Jitrino.OPT: 
1) HARMONY-3816 "[drlvm][jit] BBP fails to provide safe-points on back branches from exception handlers"
2) HARMONY-4596 "[drlvm][opt] OPT crashes with an assertion"

Fix for HARMONY-3716: "[drlvm][jit][opt] Jitrino.OPT misses checkcast insts sometimes."

Fix for HARMONY-4600: "[drlvm][jet][lazy] IncompatibleClassChangeError causes failure of 8 EUT3.2 tests from 'jdtuirefactoring' - regression"



Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H3716/
    harmony/enhanced/drlvm/trunk/src/test/regression/H3716/Test.java   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H3716/run.test.xml   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H3816/
    harmony/enhanced/drlvm/trunk/src/test/regression/H3816/Test.java   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H3816/run.test.xml   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H4596/
    harmony/enhanced/drlvm/trunk/src/test/regression/H4596/Test.java   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H4596/run.test.xml   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/hashvaluenumberer.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3716/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3716/Test.java?view=auto&rev=563148
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3716/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3716/Test.java Mon Aug  6 07:24:45 2007
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h3716;
+
+import junit.framework.TestCase;
+
+public class Test extends TestCase {
+    
+    public void test() throws Exception {
+        foo(new Long(1));
+    }
+
+    void foo(Number n) {
+        try {
+            failed((Integer)n);
+        } catch (ClassCastException e) {}
+
+        try {
+            failed((Integer)n);
+        } catch (ClassCastException e) {}
+    } 
+
+    void failed(Integer i) {
+        fail();
+    }
+
+}
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H3716/Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3716/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3716/run.test.xml?view=auto&rev=563148
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3716/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3716/run.test.xml Mon Aug  6 07:24:45 2007
@@ -0,0 +1,9 @@
+<project name="RUN HARMONY-3716 Regression Test">
+    <target name="run-test">
+        <run-junit-test
+            test="org.apache.harmony.drlvm.tests.regression.h3716.Test"
+            vmarg="-Xem:opt -XX:-vm.assert_dialog">
+        </run-junit-test>
+    </target>
+</project>
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H3716/run.test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3816/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3816/Test.java?view=auto&rev=563148
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3816/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3816/Test.java Mon Aug  6 07:24:45 2007
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.harmony.drlvm.tests.regression.h3816;
+
+import junit.framework.TestCase;
+
+public class Test extends TestCase {
+    
+    public void testIt() {
+        try {
+            WorkerThread worker = new WorkerThread();
+            worker.setDaemon(true);
+
+            worker.start();
+            Thread.sleep(1000);
+
+            worker.suspend();
+            worker.resume();
+            System.out.println("PASSED");
+         } catch (InterruptedException e) {
+         }
+    }
+
+    public static class WorkerThread extends Thread {
+
+        private int foo(int n) {
+            if (n <= 0) return 1;
+            return foo(n-1) * n;
+        }
+
+        public void run() {
+            while(true) {
+                try {
+                    foo(100);
+                } finally {
+                    continue;
+                }
+            }
+        }
+    }
+}
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H3816/Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3816/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3816/run.test.xml?view=auto&rev=563148
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3816/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3816/run.test.xml Mon Aug  6 07:24:45 2007
@@ -0,0 +1,8 @@
+<project name="RUN HARMONY-3816 Regression Test">
+    <target name="run-test">
+        <run-junit-test 
+             test="org.apache.harmony.drlvm.tests.regression.h3816.Test"
+             vmarg="-Xem:opt">
+        </run-junit-test>
+    </target>
+</project>

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H3816/run.test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H4596/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H4596/Test.java?view=auto&rev=563148
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H4596/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H4596/Test.java Mon Aug  6 07:24:45 2007
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.harmony.drlvm.tests.regression.h4596;
+
+import junit.framework.TestCase;
+
+public class Test extends TestCase {
+    
+    public void testIt() {
+        try {
+            WorkerThread worker = new WorkerThread();
+            worker.setDaemon(true);
+
+            worker.start();
+            Thread.sleep(100);
+
+            worker.suspend();
+            worker.resume();
+            System.out.println("PASSED");
+         } catch (InterruptedException e) {
+         }
+    }
+
+    public static class WorkerThread extends Thread {
+
+        public void run() {
+            Object o1 = new Object();
+            Object o2 = new Object();
+            while(true) {
+                try {
+                    o1.equals(o2);
+                } finally {
+                    continue;
+                }
+            }
+        }
+    }
+}
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H4596/Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H4596/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H4596/run.test.xml?view=auto&rev=563148
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H4596/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H4596/run.test.xml Mon Aug  6 07:24:45 2007
@@ -0,0 +1,9 @@
+<project name="RUN HARMONY-4596 Regression Test">
+    <target name="run-test">
+        <run-junit-test 
+             test="org.apache.harmony.drlvm.tests.regression.h4596.Test"
+             vmarg="-Xem:opt">
+        </run-junit-test>
+    </target>
+</project>
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H4596/run.test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp?view=diff&rev=563148&r1=563147&r2=563148
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32BBPolling.cpp Mon Aug  6 07:24:45 2007
@@ -231,7 +231,7 @@
                     fg->setUnwindNode(unwind);
                 }
                 fg->spliceFlowGraphInline(edge, *bbpCFG);
-                bbp.setBBPSubCFGController(originalTargetId,sourceDispatchId,edge->getTargetNode());
+                bbp.setBBPSubCFGController(originalTargetId,sourceDispatchId,bbpCFG->getEntryNode());
             }
         }
         if (Log::isEnabled())
@@ -416,9 +416,6 @@
 
 bool
 BBPolling::hasNativeInterruptablePoints(const Node* node) {
-    if (node->isDispatchNode()) {
-        return true;
-    }
     if (node->isBlockNode()) {
         // If current BB has an inst that is ThreadInterruptablePoint itself
         // the hasThreadInterruptablePoint becomes true for it
@@ -433,12 +430,12 @@
 
 bool
 BBPolling::hasAllThreadInterruptablePredecessors(const Node* node) {
-    if (node->isDispatchNode()) {
-        return true;
-    }
     LoopTree* lt = irManager.getFlowGraph()->getLoopTree();
     assert(lt->isValid());
     const Edges& edges = node->getInEdges();
+    
+    if (edges.size()==0) return false;    
+
     // All the predecessors must be processed earlier!
     for (Edges::const_iterator ite = edges.begin(), ende = edges.end(); ite!=ende; ++ite) {
         Edge* e = *ite;

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/hashvaluenumberer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/hashvaluenumberer.cpp?view=diff&rev=563148&r1=563147&r2=563148
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/hashvaluenumberer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/hashvaluenumberer.cpp Mon Aug  6 07:24:45 2007
@@ -963,7 +963,8 @@
         CSEHashKey key = getKey(Operation(Op_TauCheckCast, Type::SystemObject,
                                           Modifier(Exception_Sometimes)),
                                 inst->getSrc(0)->getId(),
-                                inst->getTypeInfo()->getId());
+                                inst->getTypeInfo()->getId(),
+                                inst->getNode()->getExceptionEdgeTarget()->getId());
         return hashInst(inst, key);
     }
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp?view=diff&rev=563148&r1=563147&r2=563148
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp Mon Aug  6 07:24:45 2007
@@ -850,9 +850,15 @@
     Edge* edgeToInlined = callNode->getUnconditionalEdge();
     ControlFlowGraph& parentCFG = parent->getFlowGraph();
     parentCFG.spliceFlowGraphInline(edgeToInlined, inlinedFlowGraph);
-    parentCFG.removeEdge(callNode->getExceptionEdge());
-    callInst->unlink();
 
+    if (inlinedFlowGraph.getUnwindNode() == NULL) {
+        // Replace original call with PseudoThrow to keep graph topology.
+        callNode->appendInst(_instFactory.makePseudoThrow());
+    } else {
+        // Inlined graph has exception path so just remove original edge.
+        parentCFG.removeEdge(callNode->getExceptionEdge());
+    }
+    callInst->unlink();
 }
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp?view=diff&rev=563148&r1=563147&r2=563148
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp Mon Aug  6 07:24:45 2007
@@ -2159,6 +2159,7 @@
     hythread_suspend_enable();
     Global_Env* env = VM_Global_State::loader_env;
     m = resolve_interface_method_env(env, klass, cp_idx, true);
+    assert(m);
     hythread_suspend_disable();
 
     obj = obj_h->object;
@@ -2172,12 +2173,15 @@
     assert(objClass!=NULL);
     assert(objClass->is_initialized() || objClass->is_initializing());
 
-    char* infc_vtable = (char*)Class::helper_get_interface_vtable(obj, m->get_class());
-    if(infc_vtable == NULL) {
-        exn_throw_by_name("java/lang/IncompatibleClassChangeError", objClass->get_name()->bytes);
-        return NULL;
+    unsigned base_index = 0;
+    if(m->get_class()->is_interface()) {
+        char* infc_vtable = (char*)Class::helper_get_interface_vtable(obj, m->get_class());
+        if(infc_vtable == NULL) {
+            exn_throw_by_name("java/lang/IncompatibleClassChangeError", objClass->get_name()->bytes);
+            return NULL;
+        }
+        base_index = (unsigned)(infc_vtable - (char*)objClass->get_vtable()->methods)/sizeof(char*);
     }
-    unsigned base_index = (unsigned)(infc_vtable - (char*)objClass->get_vtable()->methods)/sizeof(char*);
     Method* infc_method = objClass->get_method_from_vtable(base_index + m->get_index());
     if(infc_method == NULL) {
         // objClass does not implement interface method