Index: src/test/regression/H3228/run.test.xml =================================================================== --- src/test/regression/H3228/run.test.xml (revision 0) +++ src/test/regression/H3228/run.test.xml (revision 0) @@ -0,0 +1,8 @@ + + + + + + Index: src/test/regression/H3228/H3228.java =================================================================== --- src/test/regression/H3228/H3228.java (revision 0) +++ src/test/regression/H3228/H3228.java (revision 0) @@ -0,0 +1,31 @@ +package org.apache.harmony.drlvm.tests.regression.h3228; + +import junit.framework.TestCase; + + +/* The test checks that the JIT correctly optimizes nested monenter/monexit + * pairs when they are enclosed into another monenter/monexit with the same + * synchronization object. + * The synchronized method sync_run() contains a synchronized statement which + * can be safely removed. The issue described in Harmony-3228 caused + * a crash during the JIT compilation stage. + */ +public class H3228 extends TestCase { + + public static void main(String args[]) { + H3228 test = new H3228(); + boolean b = false; + for (int i = 0; i < 1000000000; i++) { + b = test.sync_run(); + } + System.out.println("Test passed"); + } + + public synchronized boolean sync_run() { + boolean a = false; + synchronized (this) { + a = !a; + } + return a; + } +}