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: Fri, 4 Apr 2014 23:04:03 +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>
On Fri, 04 Apr 2014 12:49:25 -0700
Per Bothner <per@bothner.com> wrote:
> Is this numCases==0? If so I don't see where the bug is.
> Perhaps you could put System.println("line N SP:"+SP) on
> various lines and see if you can figure out what the problem is.
Also with numCases == 1
> // only an else clause
> numCases: 0
> Before code.pushType(Type.intType); SP:1
> After code.pushType(Type.intType); SP:2
> Before code.emitPop(1); SP:2
> After code.emitPop(1); SP:1
> Before code.emitGoto(defaultLabel); SP:1
> Exception in thread "main" java.lang.InternalError: setTypes for
> Label#7-pos:31 SP:0 code.SP:1
> // one clause with an else clause
> numCases: 1
> Before code.pushType(Type.intType); SP:1
> After code.pushType(Type.intType); SP:2
> Before code.emitIfIntEqZero(); SP:2
> After code.emitIfIntEqZero(); SP:1
> Before code.emitGoto(labels[0]); SP:1
> Exception in thread "main" java.lang.InternalError: setTypes for
> Label#7-pos:31 SP:0 code.SP:1
> // one clouse without an else clause
> numCases: 1
> Before code.pushType(Type.intType); SP:0
> After code.pushType(Type.intType); SP:1
> Before code.emitIfIntEqZero(); SP:1
> After code.emitIfIntEqZero(); SP:0
> Before code.emitGoto(labels[0]); SP:0
> After code.emitGoto(labels[0]); SP:0
> Before code.emitElse(); SP:0
> After code.emitElse(); SP:0
> Before code.emitGoto(defaultLabel); SP:0
> After code.emitGoto(defaultLabel); SP:0
> Before code.emitFi(); SP:0
> After code.emitFi(); SP:0
>
> No error during compilation
> Executes the right case expression correctly
> After execution: DEBUG MESSAGE: unimplemented bytecode
> java.lang.NullPointerException
> at it.polimi.kawacase.syntax.run(syntax.scm:69)
> at gnu.expr.ModuleBody.runAsMain(ModuleBody.java:152)
> at it.polimi.kawacase.syntax.main(syntax.scm)
Maybe there is some problem with my code. I think the problem is the
SP:1 at the starting point of finish(). I suppose from the emitPop(1)
in the code that at that point is always expected an SP:0. There SP is 1
because the default clause expression is compiled with a StackTarget,
so the result is expected to be put on the stack.
Concerning the "unimplemented bytecode" message, I have no idea. When I
have no else clause I add a default void case:
>sw.addDefault(code);
>QuoteExp.voidExp.compile(comp, new StackTarget(PrimType.void_type));
>sw.finish(code);
Andrea