This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Google Summer of Code
- From: Andrea Bernardini <andrebask at gmail dot com>
- To: kawa at sourceware dot org
- Date: Sun, 13 Apr 2014 18:03:07 +0200
- Subject: Re: Google Summer of Code
- Authentication-results: sourceware.org; auth=none
- References: <20140305094242 dot 349492d0 at debian-andrebask> <5316F956 dot 8040303 at gmail dot com> <20140305132208 dot 3081f8dc at debian-andrebask> <m2lhwo48vi dot fsf at gmail dot com> <5319088C dot 5060401 at bothner dot com> <7B118191-4144-4937-B679-89392D5463EE at theptrgroup dot com> <20140316012026 dot 4e0ebfef at debian-andrebask> <53269580 dot 8040205 at bothner dot com> <20140320204856 dot 5aa0b4d3 at debian-andrebask> <532BAA5F dot 3000606 at bothner dot com> <20140328121426 dot 74f3e92d at vaio> <5337BD0C dot 8030301 at bothner dot com> <20140403021150 dot 0dc0f6f4 at vaio> <533F0CC5 dot 1060108 at bothner dot com>
I think I solved the problem, besides the stack size inconsistency
there was a missing return statement at the end of the switch bytecode,
and after each case. The code handling the numCases > 1 case
automatically inserts the return statements, instead when numCases <=
1 they have to be inserted explicitly.
I changed only few lines of code in SwitchState.java (see the
attachment). I compiled kawa with these changes and it seems to work.
Do you see some problem in this code?
Now I can start to look at the type-checking in InlineCalls.
Andrea
--- Programmazione/Projects/Kawa/code/gnu/bytecode/SwitchState.java 2014-03-09 17:57:31.358834943 +0100
+++ Programmazione/Projects/Kawa/code_mod/gnu/bytecode/SwitchState.java 2014-04-13 17:05:06.886136667 +0200
@@ -183,7 +183,7 @@
{
if (outerTry != code.try_stack)
throw new Error("exitSwitch cannot exit through a try");
- code.emitGoto(after_label);
+ code.emitReturn();
}
/** Handle the end of the switch statement.
@@ -204,9 +204,13 @@
code.emitInvokeSpecial(con);
code.emitThrow();
}
+ if (numCases <= 1)
+ code.emitReturn();
code.fixupChain(switch_label, after_label);
if (numCases <= 1)
{
+ if (code.getSP() == 1)
+ code.popType();
code.pushType(Type.intType);
if (numCases == 1)
{