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, 28 Mar 2014 12:14:26 +0100
- 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>
I solved the popType problem using a StackTarget, but I don't
understand why this code does not work:
>public void compile(Compilation comp, Target target) {
> System.out.print("Compiling CaseExp\n");
>
> CodeAttr code = comp.getCode();
>
> StackTarget st = new StackTarget(PrimType.int_type);
> key.compile(comp, st);
> SwitchState sw = code.startSwitch();
>
> sw.addDefault(code);
> clauses[0].exp.compile(comp, new
> StackTarget(Compilation.typeObject)); sw.finish(code);
>at gnu.bytecode.Label.setTypes(Label.java:103)
>at gnu.bytecode.CodeAttr.emitGoto(CodeAttr.java:1601)
>at gnu.bytecode.SwitchState.finish(SwitchState.java:228)
While this works:
>public void compile(Compilation comp, Target target) {
> System.out.print("Compiling CaseExp\n");
>
> clauses[0].exp.compile(comp, new
> StackTarget(Compilation.typeObject));
Another thing I don't understand is why SwitchState.finish() raise an
Exception when you compile a switch without a default clause. It should
be allowed both in Java and Scheme.
Andrea