You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by va...@apache.org on 2008/05/20 12:49:10 UTC

svn commit: r658196 [2/2] - in /harmony/enhanced/drlvm/trunk: ./ make/ make/tests/ vm/tests/lazy/ vm/tests/lazy/broken/ vm/tests/lazy/broken/org/ vm/tests/lazy/broken/org/apache/ vm/tests/lazy/broken/org/apache/harmony/ vm/tests/lazy/broken/org/apache/...

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/FieldsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/FieldsTest.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/FieldsTest.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/FieldsTest.java Tue May 20 03:49:08 2008
@@ -0,0 +1,388 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+import junit.framework.*;
+import org.apache.harmony.vm.test.lazyresolution.classloader.*;
+import org.apache.harmony.vm.test.lazyresolution.data.*;
+import java.util.*;
+
+public class FieldsTest extends LazyTest {
+
+    public void testStaticGet1() {
+        int before = getNumLoads();
+
+        int value = LazyObject1.intStaticField;
+
+        int after = getNumLoads();
+        Assert.assertEquals(10, value); 
+        Assert.assertEquals(1, after-before); 
+    } 
+
+    public void testStaticGet2() {
+        int before = getNumLoads();
+
+        LazyObject1 obj = LazyObject5.staticObjectField;
+
+        int after = getNumLoads();
+        Assert.assertNotNull(obj); 
+        Assert.assertEquals(2, after-before); 
+    } 
+
+    public void testStaticGet3() {
+        int before = getNumLoads();
+
+        LazyObject1[] arr = LazyObject5.staticArrayField;
+
+        int after = getNumLoads();
+        Assert.assertNotNull(arr); 
+        Assert.assertEquals(10, arr.length); 
+        Assert.assertNull(arr[0]);
+        Assert.assertEquals(2, after-before); 
+    } 
+
+    public void testStaticGet4() {
+        int before = getNumLoads();
+
+        LazyObject1[][] arr = LazyObject5.staticMultiArrayField;
+
+        int after = getNumLoads();
+        Assert.assertNotNull(arr); 
+        Assert.assertEquals(10, arr.length); 
+        Assert.assertNotNull(arr[5]); 
+        Assert.assertEquals(20, arr[5].length); 
+        Assert.assertEquals(2, after-before); 
+    } 
+
+    public void testStaticGetWithNotFoundError() {
+        int before = getNumLoads();
+        hideClass("LazyObject1");
+        boolean wasCNFE = false;
+        try {
+            int value = LazyObject1.intStaticField;
+        } catch (NoClassDefFoundError e) {
+            wasCNFE=true;
+        } finally {
+            restoreClass("LazyObject1");
+        }
+        Assert.assertTrue(wasCNFE);
+    } 
+
+    public void testStaticPut1() {
+        int before = getNumLoads();
+
+        int value = 12;
+        LazyObject1.intStaticField = value;
+
+        int after = getNumLoads();
+        Assert.assertEquals(value, LazyObject1.getIntStaticField()); 
+        Assert.assertEquals(1, after-before); 
+    } 
+
+
+    public void testStaticPut2() {
+        int before = getNumLoads();
+
+        LazyObject1 value = new LazyObject1();
+        LazyObject5.staticObjectField = value;
+
+        int after = getNumLoads();
+        Assert.assertEquals(value, LazyObject5.getStaticObjectField()); 
+        Assert.assertEquals(2, after-before); 
+    } 
+
+    public void testStaticPut3() {
+        int before = getNumLoads();
+
+        LazyObject1[] value = new LazyObject1[100];
+        LazyObject5.staticArrayField = value;
+
+        int after = getNumLoads();
+        Assert.assertEquals(value, LazyObject5.getStaticArrayField()); 
+        Assert.assertEquals(2, after-before); 
+    } 
+
+    public void testStaticPut4() {
+        int before = getNumLoads();
+
+        LazyObject1[][] value = new LazyObject1[10][10];
+        LazyObject5.staticMultiArrayField = value;
+
+        int after = getNumLoads();
+        Assert.assertEquals(value, LazyObject5.getStaticMultiArrayField()); 
+        Assert.assertEquals(2, after-before); 
+    } 
+
+    public void testNonStaticGet1() {
+        int before = getNumLoads();
+
+        int value = new LazyObject1().intField;
+
+        int after = getNumLoads();
+        Assert.assertEquals(20, value); 
+        Assert.assertEquals(1, after-before); 
+    } 
+
+    public void testNonStaticGet2() {
+        int before = getNumLoads();
+
+        Object o = new LazyObject5().objectField;
+
+        int after = getNumLoads();
+        Assert.assertNotNull(o); 
+        Assert.assertEquals(2, after-before); 
+        Assert.assertEquals(LazyObject5.getStaticObjectField(), o); 
+    } 
+
+    public void testNonStaticGet3() {
+        int before = getNumLoads();
+
+        Object[] o = new LazyObject5().arrayField;
+
+        int after = getNumLoads();
+        Assert.assertNotNull(o); 
+        Assert.assertEquals(2, after-before); 
+        Assert.assertEquals(LazyObject5.getStaticArrayField(), o); 
+    } 
+
+    public void testNonStaticGet4() {
+        int before = getNumLoads();
+
+        Object[][] o = new LazyObject5().multiArrayField;
+
+        int after = getNumLoads();
+        Assert.assertNotNull(o); 
+        Assert.assertEquals(2, after-before); 
+        Assert.assertEquals(LazyObject5.getStaticMultiArrayField(), o); 
+    } 
+
+    public void testNonStaticPut1() {
+        int before = getNumLoads();
+
+        int value = 22;
+        LazyObject1 lo = new LazyObject1();
+        lo.intField = value;            
+
+        int after = getNumLoads();
+        Assert.assertEquals(value, lo.getIntField()); 
+        Assert.assertEquals(1, after-before); 
+    } 
+
+    public void testNonStaticPut2() {
+        int before = getNumLoads();
+
+        LazyObject5 o = new LazyObject5();
+        LazyObject1 value = new LazyObject1();
+        o.objectField = value;            
+
+        int after = getNumLoads();
+        Assert.assertEquals(value, o.getObjectField()); 
+        Assert.assertEquals(2, after-before); 
+    } 
+
+    public void testNonStaticPut3() {
+        int before = getNumLoads();
+
+        LazyObject5 o = new LazyObject5();
+        LazyObject1[] value = new LazyObject1[100];
+        o.arrayField = value;            
+
+        int after = getNumLoads();
+        Assert.assertEquals(value, o.getArrayField()); 
+        Assert.assertEquals(2, after-before); 
+    } 
+
+    public void testNonStaticPut4() {
+        int before = getNumLoads();
+
+        LazyObject5 o = new LazyObject5();
+        LazyObject1[][] value = new LazyObject1[10][10];
+        o.multiArrayField = value;            
+
+        int after = getNumLoads();
+        Assert.assertEquals(value, o.getMultiArrayField()); 
+        Assert.assertEquals(2, after-before); 
+    } 
+
+    public void testStaticGetBroken1() {
+        setBrokenObjects(true);
+        int value = 0;
+        try {
+            value = LazyObject1.intStaticField;
+        } catch (IllegalAccessError e) {
+            value = -1;
+        }
+        Assert.assertEquals(-1, value); 
+    } 
+
+    public void testStaticPutBroken1() {
+        setBrokenObjects(true);
+        boolean passed = false;
+        try {
+            LazyObject1.intStaticField=10;
+        } catch (IllegalAccessError e) {
+            passed = true;
+        }
+        Assert.assertTrue(passed); 
+    } 
+
+
+    public void testNonStaticGetBroken1() {
+        setBrokenObjects(true);
+        int value = 0;
+        try {
+            value = new LazyObject1(10).intField;
+        } catch (IllegalAccessError e) {
+            value = -1;
+        }
+        Assert.assertEquals(-1, value); 
+    } 
+
+    public void testNonStaticPutBroken1() {
+        setBrokenObjects(true);
+        boolean passed = false;
+        try {
+            new LazyObject1(10).intField = 100;
+        } catch (IllegalAccessError e) {
+            passed=true;
+        }
+        Assert.assertTrue(passed); 
+    } 
+
+
+    public void testStaticGetBroken2() {
+        setBrokenObjects(true);
+        int value = 0;
+        try {
+            value = LazyObject1.intStaticField2;
+        } catch (NoSuchFieldError e) {
+            value = -1;
+        }
+        Assert.assertEquals(-1, value); 
+    } 
+
+    public void testStaticPutBroken2() {
+        setBrokenObjects(true);
+        boolean passed = false;
+        try {
+            LazyObject1.intStaticField2=10;
+        } catch (NoSuchFieldError e) {
+            passed = true;
+        }
+        Assert.assertTrue(passed); 
+    } 
+
+
+    public void testNonStaticGetBroken2() {
+        setBrokenObjects(true);
+        int value = 0;
+        try {
+            value = new LazyObject1(10).intField2;
+        } catch (NoSuchFieldError  e) {
+            value = -1;
+        }
+        Assert.assertEquals(-1, value); 
+    } 
+
+    public void testNonStaticPutBroken2() {
+        setBrokenObjects(true);
+        boolean passed = false;
+        try {
+            new LazyObject1(10).intField2 = 100;
+        } catch (NoSuchFieldError  e) {
+            passed=true;
+        }
+        Assert.assertTrue(passed); 
+    } 
+
+    private static void _testStaticGetBroken3() {
+        for (int i=0;i<100;i++){} //avoid inlining
+        Map m = LazyObject1.staticMapField; //mapField has String type if for a broken package
+    }
+
+    public void testStaticGetBroken3() {
+        setBrokenObjects(true);
+        boolean passed = false;
+        try {
+            new HashMap();//preload classes
+            new String("");
+            _testStaticGetBroken3();            
+        } catch (NoSuchFieldError e) {
+            passed = true;
+        }
+        Assert.assertTrue(passed); 
+    } 
+
+    private static void _testStaticPutBroken3() {
+        for (int i=0;i<100;i++){} //avoid inlining
+        LazyObject1.staticMapField = new HashMap(); //mapField has String type if for a broken package
+    }
+
+    public void testStaticPutBroken3() {
+        setBrokenObjects(true);
+        boolean passed = false;
+        try {
+            new HashMap();//preload classes
+            new String("");
+            _testStaticPutBroken3();            
+        } catch (NoSuchFieldError e) {
+            passed = true;
+        }
+        Assert.assertTrue(passed); 
+    } 
+
+
+    private static void _testNonStaticGetBroken3() {
+        for (int i=0;i<100;i++){} //avoid inlining
+        Map m = new LazyObject1(1).mapField; //mapField has String type if for a broken package
+    }                           
+
+    public void testNonStaticGetBroken3() {
+        setBrokenObjects(true);
+        boolean passed = false;
+        try {
+            new HashMap();//preload classes
+            new String("");
+            _testNonStaticGetBroken3();            
+        } catch (NoSuchFieldError e) {
+            passed = true;
+        }
+        Assert.assertTrue(passed); 
+    } 
+
+    private static void _testNonStaticPutBroken3() {
+        for (int i=0;i<100;i++){} //avoid inlining
+        new LazyObject1(1).mapField = new HashMap(); //mapField has String type if for a broken package
+    }
+
+    public void testNonStaticPutBroken3() {
+        setBrokenObjects(true);
+        boolean passed = false;
+        try {
+            new HashMap();//preload classes
+            new String("");
+            _testStaticPutBroken3();            
+        } catch (NoSuchFieldError e) {
+            passed = true;
+        }
+        Assert.assertTrue(passed); 
+    } 
+
+
+
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/FieldsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/InstanceOfTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/InstanceOfTest.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/InstanceOfTest.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/InstanceOfTest.java Tue May 20 03:49:08 2008
@@ -0,0 +1,163 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+import junit.framework.*;
+import org.apache.harmony.vm.test.lazyresolution.classloader.*;
+import org.apache.harmony.vm.test.lazyresolution.data.*;
+
+public class InstanceOfTest extends LazyTest {
+
+    private Object createObject(boolean object2) {
+        if (object2) {
+            return new LazyObject2();
+        } 
+        return new LazyObject3();
+//        return object2 ? new LazyObject2() : new LazyObject3();// -> dont use it. RI's verifier will load both classes!
+    }
+
+    public void testInstanceOf1() {
+        int before = getNumLoads();
+
+        Object o = createObject(true);
+        boolean passed = o instanceof LazyObject2;
+
+
+        int after = getNumLoads();
+
+        Assert.assertEquals(2, after-before); 
+        Assert.assertTrue(passed);
+    }
+
+    public void testInstanceOf2() {
+        int before = getNumLoads();
+
+        Object o = createObject(false);
+        boolean passed = ! (o instanceof LazyObject2);
+
+
+        int after = getNumLoads();
+        Assert.assertEquals(4, after-before); 
+        Assert.assertTrue(passed);
+    }
+
+    public void testInstanceOf3() {
+        int before = getNumLoads();
+
+        Object o = createObject(true);
+        boolean passed = o instanceof LazyInterface2;
+
+
+        int after = getNumLoads();
+
+        Assert.assertEquals(2, after-before); 
+        Assert.assertTrue(passed);
+    }
+
+    public void testInstanceOf4() {
+        int before = getNumLoads();
+
+        Object o = createObject(true);
+        boolean passed = !(o instanceof LazyInterface4);
+
+
+        int after = getNumLoads();
+
+        Assert.assertEquals(4, after-before); 
+        Assert.assertTrue(passed);
+    }
+
+
+    public void testInstanceOf5() {
+        int before = getNumLoads();
+
+        Object o = createObject(false);
+        boolean passed = (o instanceof LazyInterface2) && (o instanceof LazyInterface3);
+
+
+        int after = getNumLoads();
+
+        Assert.assertEquals(3, after-before); 
+        Assert.assertTrue(passed);
+    }
+
+
+    public Object createArray(int dims) {
+        if (dims == 0) {
+            return new LazyObject1();
+        } else if (dims == 1) {
+            return new LazyObject1[1];
+        } else  if (dims==2) {
+            return new LazyObject1[1][2];
+        }
+        return new LazyObject1[1][2][3];
+    }
+
+    public void testInstanceOf6() {
+        int before = getNumLoads();
+
+        Object o = createArray(1);
+        boolean passed = o instanceof LazyObject1[];
+
+
+        int after = getNumLoads();
+
+        Assert.assertEquals(1, after-before); 
+        Assert.assertTrue(passed);
+    }
+
+    public void testInstanceOf7() {
+        int before = getNumLoads();
+
+        Object o = createArray(2);
+        boolean passed = o instanceof LazyObject1[][];
+
+
+        int after = getNumLoads();
+
+        Assert.assertEquals(1, after-before); 
+        Assert.assertTrue(passed);
+    }
+
+    public void testInstanceOf8() {
+        int before = getNumLoads();
+
+        Object o = createArray(3);
+        boolean passed = o instanceof LazyObject1[][][];
+
+
+        int after = getNumLoads();
+
+        Assert.assertEquals(1, after-before); 
+        Assert.assertTrue(passed);
+    }
+
+    public void testInstanceOfWithNotFoundError() {
+        boolean passed = false;
+
+        hideClass("LazyObject2");
+        try  {
+            createObject(true);
+        } catch (NoClassDefFoundError e) {
+            passed = true;
+        }
+        restoreClass("LazyObject2");
+        Assert.assertTrue(passed);
+    }
+
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/InstanceOfTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/InterfaceCallsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/InterfaceCallsTest.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/InterfaceCallsTest.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/InterfaceCallsTest.java Tue May 20 03:49:08 2008
@@ -0,0 +1,121 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+import junit.framework.*;
+import org.apache.harmony.vm.test.lazyresolution.classloader.*;
+import org.apache.harmony.vm.test.lazyresolution.data.*;
+
+//separate this class from CallsTest :
+//  RI verifier loads all interfaces for all invokeinterface bytecodes
+//  this makes getNumLoads depend if any method in a class has interface calls.
+//  in the methods of this class it's expected that all interfaces are loaded
+public class InterfaceCallsTest extends LazyTest {
+
+    public void testInvokeInterface1() throws Throwable {
+        startTest();
+
+        LazyInterface2 i2 = new LazyObject2();
+        i2.interfaceCall2();
+
+        endTest();
+        assertLoaded("LazyObject2");
+        Assert.assertEquals(20, LazyObject2.intStaticField);
+    }
+
+    public void testInvokeInterface2() throws Throwable {
+        startTest();
+
+        LazyInterface3 i3 = new LazyObject3();
+        i3.interfaceCall3();
+
+        endTest();
+
+        assertLoaded("LazyObject3");//Assert.assertEquals(1, after-before);
+        Assert.assertEquals(110, LazyObject3.intStaticField);
+    }
+
+    public void testInvokeInterface3() throws Throwable {
+        startTest();
+
+        LazyInterface4 i4 = new LazyObject4();
+        i4.interfaceCall2();
+        i4.interfaceCall3();
+        i4.interfaceCall4();
+
+        endTest();
+
+        assertLoaded("LazyObject4");
+        Assert.assertEquals(1120, LazyObject4.intStaticField);
+    }
+
+
+    void _testInvokeInterfaceBroken1() {
+        LazyInterface2 i2 = new LazyObject2();
+        i2.interfaceCall2a();
+    }
+
+    public void testInvokeInterfaceBroken1() {
+        setBrokenObjects(true);
+        boolean passed = false;
+        try {
+            _testInvokeInterfaceBroken1();            
+        } catch (InstantiationError e) {
+            passed = true;
+        }
+        Assert.assertTrue(passed);
+    }
+
+
+    //check for a null object merge
+    public void testInvokeInterfaceBroken2() {
+        setBrokenObjects(true);
+        LazyInterface2 res = null;
+        if (LazyObject2.intStaticField==10) {
+            res = new LazyObject3();
+        }
+        boolean passed = false;
+        try {
+            res.interfaceCall2();
+        } catch (IncompatibleClassChangeError e) {
+            passed = true;
+        }
+        Assert.assertTrue(passed);
+    }
+
+    //check for 2 unresolved types merge
+    //WARN: this has incompatible with RI behaviour if lazy resolution is turned off!
+    public void testInvokeInterfaceBroken3() {
+        setBrokenObjects(true);
+        LazyInterface2 res = null;
+        if (LazyObject2.intStaticField==10) {
+            res = new LazyObject3();
+        } else {
+            res = new LazyObject3();
+        }
+        boolean passed = false;
+        try {
+            res.interfaceCall2();
+        } catch (IncompatibleClassChangeError e) {
+            passed = true;
+        }
+        Assert.assertTrue(passed);
+    }
+
+
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/InterfaceCallsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyException1.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyException1.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyException1.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyException1.java Tue May 20 03:49:08 2008
@@ -0,0 +1,21 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+public class LazyException1 extends RuntimeException {
+
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyException1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyException2.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyException2.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyException2.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyException2.java Tue May 20 03:49:08 2008
@@ -0,0 +1,21 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+public class LazyException2 extends RuntimeException {
+
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyException2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface2.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface2.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface2.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface2.java Tue May 20 03:49:08 2008
@@ -0,0 +1,25 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+public interface LazyInterface2 {
+
+    public static int intStaticField=Integer.parseInt("12"); 
+
+    void interfaceCall2();
+    void interfaceCall2a();
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface3.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface3.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface3.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface3.java Tue May 20 03:49:08 2008
@@ -0,0 +1,26 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+public interface LazyInterface3 {
+
+    static String stringStaticField = new Integer(13).toString();
+
+    void interfaceCall2();
+
+    void interfaceCall3();
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface4.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface4.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface4.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface4.java Tue May 20 03:49:08 2008
@@ -0,0 +1,24 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+public interface LazyInterface4 extends LazyInterface2, LazyInterface3 {
+
+    public static int intStaticField=Integer.parseInt("14"); 
+
+    void interfaceCall4();
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyInterface4.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject1.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject1.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject1.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject1.java Tue May 20 03:49:08 2008
@@ -0,0 +1,57 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+import java.util.*;
+
+public class LazyObject1 {
+
+    public static int intStaticField=10; 
+
+    public static int intStaticField2=11; 
+
+
+    public int intField=20; 
+
+    public int intField2=21; 
+
+    public static int getIntStaticField() {return intStaticField;}
+    public static int getIntStaticField2() {return intStaticField2;}
+
+    public int getIntField() {return intField;}
+    public int getIntField2() {return intField2;}
+
+    public LazyObject1(){}
+    public LazyObject1(int v){intField=v;}
+    public LazyObject1(int v1, int v2){intField=v1; intField2=v2;}
+
+    public void virtualCall() {
+        intField++;
+    }
+
+
+    public static Map staticMapField = new HashMap();
+    
+    public Map mapField = null;
+
+    static {
+        staticMapField.put("a", "b");
+    }
+
+
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject2.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject2.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject2.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject2.java Tue May 20 03:49:08 2008
@@ -0,0 +1,32 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+public class LazyObject2 implements LazyInterface2 {
+
+    public static int intStaticField=10; 
+
+    public void interfaceCall2() {
+        intStaticField+=10;
+    }
+
+    public void interfaceCall2a() {
+        intStaticField+=10;
+    }
+
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject3.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject3.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject3.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject3.java Tue May 20 03:49:08 2008
@@ -0,0 +1,36 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+public class LazyObject3 implements LazyInterface2, LazyInterface3 {
+
+    public static int intStaticField=10; 
+
+    public void interfaceCall2() {
+        intStaticField+=10;
+    }
+
+    public void interfaceCall2a() {
+        intStaticField+=10;
+    }
+
+    public void interfaceCall3() {
+        intStaticField+=100;
+    }
+
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject4.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject4.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject4.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject4.java Tue May 20 03:49:08 2008
@@ -0,0 +1,39 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+public class LazyObject4 implements LazyInterface4 {
+    public static int intStaticField = 10;
+
+    public void interfaceCall2() {
+        intStaticField+=10;
+    }
+
+    public void interfaceCall2a() {
+        intStaticField+=10;
+    }
+
+    public void interfaceCall3() {
+        intStaticField+=100;
+    }
+
+    public void interfaceCall4() {
+        intStaticField+=1000;
+    }
+
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject4.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject5.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject5.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject5.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject5.java Tue May 20 03:49:08 2008
@@ -0,0 +1,41 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+public class LazyObject5 {
+
+
+    public static LazyObject1 staticObjectField = new LazyObject1();
+    public static LazyObject1 staticArrayField[]= new LazyObject1[10];
+    public static LazyObject1 staticMultiArrayField[][] = new LazyObject1[10][20];
+
+    public LazyObject1     objectField = staticObjectField;
+    public LazyObject1[]   arrayField = staticArrayField;
+    public LazyObject1[][] multiArrayField = staticMultiArrayField;
+
+
+    public static LazyObject1 getStaticObjectField() {return staticObjectField;}
+    public LazyObject1 getObjectField() {return objectField;}
+
+    public static LazyObject1[] getStaticArrayField() {return staticArrayField;}
+    public LazyObject1[] getArrayField() {return arrayField;}
+
+    public static LazyObject1[][] getStaticMultiArrayField() {return staticMultiArrayField;}
+    public LazyObject1[][] getMultiArrayField() {return multiArrayField;}
+
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyObject5.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyTest.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyTest.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyTest.java Tue May 20 03:49:08 2008
@@ -0,0 +1,66 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+import org.apache.harmony.vm.test.lazyresolution.classloader.*;
+import java.io.*;
+import java.util.*;
+
+public class LazyTest {
+    
+
+    final LazyClassLoader getLazyClassLoader() {
+        return (LazyClassLoader)getClass().getClassLoader();
+    }
+
+    final void startTest() {
+        getLazyClassLoader().startTest();
+    }
+
+    final void endTest() {
+        System.err.println(getClass());
+        getLazyClassLoader().endTest();
+    }
+
+    final void assertNumLoads(int expected) {
+        getLazyClassLoader().assertNumLoads(expected);
+    }
+
+    final void assertLoaded(String name) throws Throwable {
+        getLazyClassLoader().assertLoaded(name);
+    }
+
+    final int getNumLoads() {
+        return getLazyClassLoader().numLoads;
+    }
+
+
+    final void hideClass(String name) {
+        getLazyClassLoader().hideClass(name);
+    }
+
+    final void restoreClass(String name) {
+        getLazyClassLoader().restoreClass(name);
+    }
+
+    final void setBrokenObjects(boolean flag) {
+        getLazyClassLoader().useBrokenPackage = flag;
+    }
+
+
+}
\ No newline at end of file

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/LazyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/OptimizerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/OptimizerTest.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/OptimizerTest.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/OptimizerTest.java Tue May 20 03:49:08 2008
@@ -0,0 +1,94 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+import junit.framework.*;
+import org.apache.harmony.vm.test.lazyresolution.classloader.*;
+import org.apache.harmony.vm.test.lazyresolution.data.*;
+import java.util.*;
+
+//tests for HLO optimizer.
+//triggering optimizations to work with unresolved types
+
+public class OptimizerTest extends LazyTest {
+    
+    private int getConst1() {
+        return 1;
+    }
+
+
+    public void testIfSimplifier1() {
+        int before = getNumLoads();
+
+        if (getConst1() == 1) {
+            new LazyObject1();
+        }
+
+        int after = getNumLoads();
+
+        Assert.assertEquals(1, after-before);
+    }
+
+
+    public void testIfSimplifier2() {
+        int before = getNumLoads();
+
+        if (getConst1() == 1) {
+            new LazyObject2();
+        }
+
+        int after = getNumLoads();
+
+        Assert.assertEquals(2, after-before);
+    }
+
+    public void testIfSimplifier3() {
+        int before = getNumLoads();
+
+        if (getConst1() != 1) {
+            new LazyObject1();
+        }
+
+        int after = getNumLoads();
+
+        Assert.assertEquals(0, after-before);
+    }
+
+
+    int _testDevirt1(boolean v) {
+        for (int i=0;i<100;i++){} //avoid inlining
+        Map map = null;
+        if (v) { // need this branch for merging results of unresolved field & resolved new op
+            map = LazyObject1.staticMapField;
+        } else {
+            map = new HashMap();;
+        }
+        return map.size();
+    }
+
+    public void testDevirt1() {
+        //checks that virtual/interface call on resolved object 
+        //obtained from unresolved field can be devirtualized
+        //this test relies on assertion in devirtualizer
+
+        new HashMap();//resolve field type
+        int res = _testDevirt1(true);
+        Assert.assertEquals(1, res);
+    }
+
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/OptimizerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/SignatureTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/SignatureTest.java?rev=658196&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/SignatureTest.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/SignatureTest.java Tue May 20 03:49:08 2008
@@ -0,0 +1,256 @@
+/*
+ *  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.vm.test.lazyresolution.data;
+
+import org.apache.harmony.vm.test.lazyresolution.data.*;
+import junit.framework.*;
+import org.apache.harmony.vm.test.lazyresolution.classloader.*;
+
+public class SignatureTest extends LazyTest {
+    
+    LazyObject1 foo1() {
+        return null;
+    }
+
+    LazyObject1 foo2() {
+        return new LazyObject1();
+    }
+
+    LazyObject2 foo3() {
+        return new LazyObject2();
+    }
+
+    public void testReturn1() {
+        int before = getNumLoads();
+
+        Object o = foo1();
+        
+        int after = getNumLoads();
+
+        Assert.assertEquals(0, after-before);
+        Assert.assertNull(o);
+    }
+
+    public void testReturn2() {
+        int before = getNumLoads();
+
+        Object o = foo2();
+        
+        int after = getNumLoads();
+
+        Assert.assertEquals(1, after-before);
+        Assert.assertNotNull(o);
+    }
+
+    public void testReturn3() {
+        int before = getNumLoads();
+
+        LazyInterface2 o = foo3();
+        
+        int after = getNumLoads();
+        Assert.assertEquals(2, after-before);
+        Assert.assertNotNull(o);
+    }
+
+
+// most of the params tests are expected to be inlined
+// in this case method params are unresolved when method is compiled
+
+    boolean poo1(LazyObject1 o) {
+        return o!=null;
+    }
+
+
+    public void testParams1() {
+        int before = getNumLoads();
+
+        LazyObject1 o = new LazyObject1();
+        boolean res = poo1(o);
+
+        int after = getNumLoads();
+        Assert.assertTrue(res);
+        Assert.assertEquals(1, after-before);
+    }
+
+    boolean poo2(LazyObject1 o1, LazyObject2 o2) {
+        return o1!=null && o2!=null;
+    }
+
+    public void testParams2() {
+        int before = getNumLoads();
+
+        boolean res = poo2(null, null);
+
+        int after = getNumLoads();
+        Assert.assertFalse(res);
+        Assert.assertEquals(0, after-before);
+    }
+
+    long poo3(LazyObject1[] arr) {
+        return arr.length;
+    }
+
+    public void testParams3() {
+        int before = getNumLoads();
+
+        boolean res = poo3(new LazyObject1[10]) == 10L;
+
+        int after = getNumLoads();
+        Assert.assertTrue(res);
+        Assert.assertEquals(1, after-before);
+    }
+
+    long poo4(LazyObject1[][] arr) {
+        return arr.length;
+    }
+
+    public void testParams4() {
+        int before = getNumLoads();
+
+        boolean res = poo4(new LazyObject1[10][]) == 10L;
+
+        int after = getNumLoads();
+        Assert.assertTrue(res);
+        Assert.assertEquals(1, after-before);
+    }
+
+    long poo5(LazyObject1[][] arr) {
+        return arr[0].length;
+    }
+
+    public void testParams5() {
+        int before = getNumLoads();
+
+        boolean res = poo5(new LazyObject1[10][20]) == 20L;
+
+        int after = getNumLoads();
+        Assert.assertTrue(res);
+        Assert.assertEquals(1, after-before);
+    }
+
+
+
+
+    void too1(LazyObject1 o) throws LazyException1 {
+        o.hashCode();
+    }
+
+
+    public void testExceptions1() {
+        int before = getNumLoads();
+
+        too1(new LazyObject1());
+
+        int after = getNumLoads();
+        Assert.assertEquals(1, after-before);
+    }
+
+
+    public void testExceptions2() {
+        int before = getNumLoads();
+        boolean passed = false;
+        try {
+            too1(null);
+        } catch (RuntimeException e) {
+            passed = true;
+            e.hashCode(); //prevent optimization
+        }
+
+        int after = getNumLoads();
+        Assert.assertTrue(passed);
+        Assert.assertEquals(0, after-before);
+    }
+
+    void too2(LazyObject1 o) throws LazyException1 {
+        if (o==null) {
+            throw new LazyException1();
+        } 
+    }
+
+    public void testExceptions3() {
+        int before = getNumLoads();
+        boolean passed = true;
+        try {
+            too2(new LazyObject1());
+        } catch (LazyException1 e) {
+            passed = false;
+            e.hashCode();//prevent optimization
+        }
+
+        int after = getNumLoads();
+        Assert.assertTrue(passed);
+        Assert.assertEquals(1, after-before);
+    }
+
+    public void testExceptions4() {
+        int before = getNumLoads();
+        boolean passed = false;
+        try {
+            too2(null);
+        } catch (LazyException1 e) { //exception is loaded by verifier
+            passed = true;
+        }
+
+        int after = getNumLoads();
+        Assert.assertTrue(passed);
+        Assert.assertEquals(0, after-before);
+    }
+
+
+
+
+    void throwException(int i) {
+        if (i==1) {
+            throw new LazyException1();
+        }
+        throw new LazyException2();
+    }
+
+    public void testExceptions5() {
+        int before = getNumLoads();
+        boolean passed = false;
+        try {
+            throwException(1);
+        } catch (LazyException1 e) {
+            passed = true;
+        } catch (LazyException2 e) {
+            System.err.println("Illegal catch handler");
+        }
+        int after = getNumLoads();
+        Assert.assertTrue(passed);
+        Assert.assertEquals(0, after-before);
+    }
+
+
+    public void testExceptions6() {
+        int before = getNumLoads();
+        boolean passed = false;
+        try {
+            throwException(2);
+        } catch (LazyException1 e) {
+            System.err.println("Illegal catch handler");
+        } catch (LazyException2 e) {
+            passed = true;
+        }
+        int after = getNumLoads();
+        Assert.assertTrue(passed);
+        Assert.assertEquals(0, after-before);
+    }
+
+
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/lazy/org/apache/harmony/vm/test/lazyresolution/data/SignatureTest.java
------------------------------------------------------------------------------
    svn:eol-style = native