This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Google Summer of Code


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]