Hi Tomek, On Wed, 2009-08-19 at 21:47 +0200, Tomek Grabiec wrote: > Data flow resolution code assumed that basic blocks always contain > some struct insn, before which spill/reload instructions can be > put. When data flow resolution was run on empty basic block, it worked > on invalid struct insn pointer and entered infinite loop. > > This patch also fixes another bug. Data flow resolution didn't work > correctly when basic block in which spill occurs was not ended by a > branch. That's because in this case spill was inserted after the last > instruction, which is correct, but the corresponding spill slot moves > (push+pop) were inserted before last instruction - before the slot was > assigned a correct value. > > Empty basic blocks can be a result of the following bytecode: > > iconst_0 > iconst_1 > ifeq lab > pop // This and the next instruction generate no > iconst_1 // LIR instructions. > lab: > .... >
I tried to write a regression test based on the above description. Unfortunately this doesn't seem to trigger the bug: >From d642832b008d8622f01e14eb07c197f40458488a Mon Sep 17 00:00:00 2001 From: Pekka Enberg <penb...@cs.helsinki.fi> Date: Thu, 20 Aug 2009 09:41:28 +0300 Subject: [PATCH] regression: Add test case for empty basic blocks Signed-off-by: Pekka Enberg <penb...@cs.helsinki.fi> --- Makefile | 1 + regression/jvm/EmptyBasicBlockTest.j | 26 ++++++++++++++++++++++++++ regression/run-suite.sh | 1 + 3 files changed, 28 insertions(+), 0 deletions(-) create mode 100644 regression/jvm/EmptyBasicBlockTest.j diff --git a/Makefile b/Makefile index ee1ea58..da6cb7b 100644 --- a/Makefile +++ b/Makefile @@ -302,6 +302,7 @@ REGRESSION_TEST_SUITE_CLASSES = \ JASMIN_REGRESSION_TEST_SUITE_CLASSES = \ regression/jvm/DupTest.j \ + regression/jvm/EmptyBasicBlockTest.j \ regression/jvm/PopTest.j \ regression/jvm/SubroutineTest.j \ regression/jvm/WideTest.j \ diff --git a/regression/jvm/EmptyBasicBlockTest.j b/regression/jvm/EmptyBasicBlockTest.j new file mode 100644 index 0000000..0e6057f --- /dev/null +++ b/regression/jvm/EmptyBasicBlockTest.j @@ -0,0 +1,26 @@ +.class public jvm/EmptyBasicBlockTest +.super jvm/TestCase + +.method public static one()I + .limit stack 2 + iconst_0 + iconst_1 + ifeq end + pop ; This and the next instruction generate no + iconst_1 ; LIR instructions. +end: + ireturn +.end method + +.method public static testEmptyBasicBlock()V + .limit stack 2 + iconst_1 + invokestatic jvm/EmptyBasicBlockTest/one()I + invokestatic jvm/TestCase/assertEquals(II)V + return +.end method + +.method public static main([Ljava/lang/String;)V + invokestatic jvm/EmptyBasicBlockTest/testEmptyBasicBlock()V + return +.end method diff --git a/regression/run-suite.sh b/regression/run-suite.sh index 336ba6c..65cf520 100755 --- a/regression/run-suite.sh +++ b/regression/run-suite.sh @@ -59,6 +59,7 @@ if [ -z "$CLASS_LIST" ]; then run_java jvm.ConversionTest 0 run_java jvm.DoubleArithmeticTest 0 run_java jvm.DupTest 0 + run_java jvm.EmptyBasicBlockTest 0 run_java jvm.ExceptionsTest 0 run_java jvm.ExitStatusIsOneTest 1 run_java jvm.ExitStatusIsZeroTest 0 -- 1.5.6.3 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel