Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 26499 invoked from network); 20 Dec 2006 11:30:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Dec 2006 11:30:35 -0000 Received: (qmail 74336 invoked by uid 500); 20 Dec 2006 11:30:42 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 74241 invoked by uid 500); 20 Dec 2006 11:30:42 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 74232 invoked by uid 99); 20 Dec 2006 11:30:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Dec 2006 03:30:42 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Dec 2006 03:30:33 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 2EC361A981A; Wed, 20 Dec 2006 03:29:45 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r489054 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H2259/ vm/jitrino/src/codegenerator/ia32/ vm/jitrino/src/shared/ Date: Wed, 20 Dec 2006 11:29:44 -0000 To: commits@harmony.apache.org From: varlax@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061220112945.2EC361A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: varlax Date: Wed Dec 20 03:29:42 2006 New Revision: 489054 URL: http://svn.apache.org/viewvc?view=rev&rev=489054 Log: Applied HARMONY-2259 [drlvm][jit][opt] tests.api.java.lang.reflect.ProxyTest fails on Jitrino.OPT while passes on Jitrino.JET Tested on SUSE9 Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2259/ harmony/enhanced/drlvm/trunk/src/test/regression/H2259/H2259.java harmony/enhanced/drlvm/trunk/src/test/regression/H2259/run.test.xml Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.h Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2259/H2259.java URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2259/H2259.java?view=auto&rev=489054 ============================================================================== --- harmony/enhanced/drlvm/trunk/src/test/regression/H2259/H2259.java (added) +++ harmony/enhanced/drlvm/trunk/src/test/regression/H2259/H2259.java Wed Dec 20 03:29:42 2006 @@ -0,0 +1,65 @@ + +package org.apache.harmony.drlvm.tests.regression.h2259; + +import junit.framework.TestCase; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.lang.reflect.UndeclaredThrowableException; + +interface I1 { + String string(String s) throws ParentException; +} + +interface I2 { + String string(String s) throws SubException; +} + +class ParentException extends Exception {} +class SubException extends ParentException {} + +public class H2259 extends TestCase { + + /* + * When multiple interfaces define the same method, the list of thrown + * exceptions are those which can be mapped to another exception in the + * other method: + * + * String foo(String s) throws SubException, LinkageError; + * + * UndeclaredThrowableException wrappers any checked exception which is not + * in the merged list. So ParentException would be wrapped, BUT LinkageError + * would not be since its not an Error/RuntimeException. + * + * interface I1 { String foo(String s) throws ParentException, LinkageError; } + * interface I2 { String foo(String s) throws SubException, Error; } + */ + + public void test_H2259() { + + Object p = Proxy.newProxyInstance(I1.class.getClassLoader(), + new Class[] { I1.class, I2.class }, + new InvocationHandler() { + public Object invoke(Object proxy, + Method method, + Object[] args) + throws Throwable { + throw new ArrayStoreException(); + } + }); + + I1 proxy = (I1) p; + int res = 0; + + try { + proxy.string("error"); + } catch (ParentException e) { // is never thrown + } catch (UndeclaredThrowableException e) { + } catch (RuntimeException e) { + res = 104; + } + assertFalse("RuntimeException was not thrown", res == 0); + } +} + Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2259/run.test.xml URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2259/run.test.xml?view=auto&rev=489054 ============================================================================== --- harmony/enhanced/drlvm/trunk/src/test/regression/H2259/run.test.xml (added) +++ harmony/enhanced/drlvm/trunk/src/test/regression/H2259/run.test.xml Wed Dec 20 03:29:42 2006 @@ -0,0 +1,9 @@ + + + + + + + Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp?view=diff&rev=489054&r1=489053&r2=489054 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeSelector.cpp Wed Dec 20 03:29:42 2006 @@ -441,6 +441,21 @@ assert(target!=NULL); fg->addEdge(node, target, 1.0); } + // fixup empty catch blocks otherwise respective catchEdges will be lost + // There is no [catchBlock]-->[catchHandler] edge. Catch block will be removed + // as an empty one and exception handling will be incorrect + if (node->isCatchBlock() && node->isEmpty()) { + assert(node->getInDegree()==1); + Edge* catchEdge = node->getInEdges().front(); + assert(catchEdge->getSourceNode()->isDispatchNode()); + assert(node->getOutDegree()==1); + Node* succ = node->getUnconditionalEdgeTarget(); + while( succ->isEmpty() && (succ->getOutDegree() == 1) ) { + succ = succ->getUnconditionalEdgeTarget(); + } + assert(succ && ((Inst*)succ->getFirstInst())->hasKind(Inst::Kind_CatchPseudoInst)); + fg->replaceEdgeTarget(catchEdge,succ,true/*keepOldBody*/); + } } } } Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.cpp?view=diff&rev=489054&r1=489053&r2=489054 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.cpp Wed Dec 20 03:29:42 2006 @@ -302,13 +302,19 @@ lastEdgeRemovalTraversalNumber = traversalNumber; } -Edge* ControlFlowGraph::replaceEdgeTarget(Edge* edge, Node* newTarget) { +Edge* ControlFlowGraph::replaceEdgeTarget(Edge* edge, Node* newTarget, bool keepOldBody) { Node* source = edge->getSourceNode(); Node* oldTarget = edge->getTargetNode(); CFGInst* lastInst = source->getLastInst(); - - removeEdge(edge); - Edge* newEdge = addEdge(source, newTarget); + + Edge* newEdge = NULL; + if (keepOldBody) { + edge->target = newTarget; + newEdge = edge; + } else { + removeEdge(edge); + newEdge = addEdge(source, newTarget); + } if (lastInst!=NULL) { lastInst->updateControlTransferInst(oldTarget, newTarget); } Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.h?view=diff&rev=489054&r1=489053&r2=489054 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.h Wed Dec 20 03:29:42 2006 @@ -1287,17 +1287,17 @@ * Removes the edge, creates a new one and connects it to * the newTarget node. * - * @param[in] edge - the edge to change the target - * @param[in] newTarget - a new Target node + * @param[in] edge - the edge to change the target + * @param[in] newTarget - a new Target node + * @param[in] keepOldBody - modify old or create a new edge * * @return The edge connecting the Source node of the * edge and the newTarget node. * - * @note The removal of the old edge is obsolete and should be refactored. - * The only place to take care is retargeting edges + * @note The removal of the old edge is needed * while inlining CFG: edge IDs must be renewed. */ - Edge* replaceEdgeTarget(Edge* edge, Node *newTarget); + Edge* replaceEdgeTarget(Edge* edge, Node *newTarget, bool keepOldBody = false); /** * Checks if CFG is annotated with the edge profile information.