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/15 13:22:04 UTC
svn commit: r566107 - in /harmony/enhanced/drlvm/trunk:
src/test/regression/H2748/ src/test/regression/H2748/Test.java
src/test/regression/H2748/run.test.xml
vm/jitrino/src/optimizer/reassociate.cpp
vm/jitrino/src/optimizer/reassociate.h
Author: mfursov
Date: Wed Aug 15 04:22:03 2007
New Revision: 566107
URL: http://svn.apache.org/viewvc?view=rev&rev=566107
Log:
Fix and regression test for HARMONY-2748 "[drlvm][jit] Server static mode: a problem with 'reassoc' optimization pass"
Added:
harmony/enhanced/drlvm/trunk/src/test/regression/H2748/
harmony/enhanced/drlvm/trunk/src/test/regression/H2748/Test.java (with props)
harmony/enhanced/drlvm/trunk/src/test/regression/H2748/run.test.xml (with props)
Modified:
harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/reassociate.cpp
harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/reassociate.h
Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2748/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2748/Test.java?view=auto&rev=566107
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H2748/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H2748/Test.java Wed Aug 15 04:22:03 2007
@@ -0,0 +1,48 @@
+/*
+ * 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.h2748;
+import junit.framework.*;
+
+public class Test extends TestCase {
+ public void test1() {
+ int x = 1;
+ for (int i=0; i<1000; i++) {
+ x +=i;
+ }
+ x+=x;
+ x+=x;
+ x+=x;
+ x+=x;
+ x+=x;
+ x+=x;
+ x+=x;
+ x+=x;//8
+
+ x+=x;
+ x+=x;
+ x+=x;
+ x+=x;
+ x+=x;
+ x+=x;
+ x+=x;//16
+
+ assertEquals(-812220416, x);
+ }
+}
+
Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H2748/Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2748/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2748/run.test.xml?view=auto&rev=566107
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H2748/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H2748/run.test.xml Wed Aug 15 04:22:03 2007
@@ -0,0 +1,9 @@
+<project name="RUN HARMONY-2748 Regression Test">
+ <target name="run-test">
+ <run-junit-test
+ test="org.apache.harmony.drlvm.tests.regression.h2748.Test"
+ vmarg="-Xem:server_static">
+ </run-junit-test>
+ </target>
+</project>
+
Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H2748/run.test.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/reassociate.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/reassociate.cpp?view=diff&rev=566107&r1=566106&r2=566107
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/reassociate.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/reassociate.cpp Wed Aug 15 04:22:03 2007
@@ -90,7 +90,8 @@
mm(memManager),
cfgRpoNum(memManager),
priority(memManager),
- minDepth(false)
+ minDepth(false),
+ maxReassocDepth(64)
{
}
@@ -265,7 +266,7 @@
Type* type, Opnd* opnd)
{
Inst *inst = opnd->getInst();
- if (inst->getType() == type->tag) {
+ if (inst->getType() == type->tag && opnds.size() < maxReassocDepth) {
switch(inst->getOpcode()) {
case Op_Add:
if (inst->getOverflowModifier() != Overflow_None) break;
@@ -333,7 +334,7 @@
Type* type, Opnd* opnd)
{
Inst *inst = opnd->getInst();
- if (inst->getType() == type->tag) {
+ if (inst->getType() == type->tag && opnds.size() < maxReassocDepth) {
switch(inst->getOpcode()) {
case Op_Mul:
if (inst->getOverflowModifier() != Overflow_None) break;
@@ -356,7 +357,7 @@
Type* type, Opnd* opnd)
{
Inst *inst = opnd->getInst();
- if (inst->getType() == type->tag) {
+ if (inst->getType() == type->tag && opnds.size() < maxReassocDepth) {
switch(inst->getOpcode()) {
case Op_AddOffset:
addAddOffsetAssoc(opnds, compressed, type, inst->getSrc(0));
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/reassociate.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/reassociate.h?view=diff&rev=566107&r1=566106&r2=566107
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/reassociate.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/reassociate.h Wed Aug 15 04:22:03 2007
@@ -124,6 +124,7 @@
uint32 numBlocks;
bool minDepth;
+ uint32 maxReassocDepth;
};
} //namespace Jitrino