This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Problem with modules compiled with --full-tailcalls
- From: "Dominique Boucher" <dominique dot boucher at nuecho dot com>
- To: "'Kawa List'" <kawa at sources dot redhat dot com>
- Date: Mon, 9 May 2005 20:42:15 -0400
- Subject: Problem with modules compiled with --full-tailcalls
- Reply-to: <dominique dot boucher at nuecho dot com>
Hi,
While porting some code that ran with kawa 1.7 to kawa 1.7.91, I noticed a
problem with --full-tailcalls. It seems to be related to a (somewhat) recent
optimization to infer the type of variables declared with a let. Take the
following two modules:
;; -----------------------------------------
(module-name <A>)
(define (foo x)
(if (< x 0)
x
(- x)))
;; -----------------------------------------
(module-name <B>)
(require <A>)
(define (test)
(let ((x (foo 4)))
(format #t "x = ~S~%" x)))
;; -----------------------------------------
If module A is compiled with --full-tailcalls, the "foo" function becomes a
Java static method that returns "void" instead of Object. When module B is
compiled, you get the following compile-time error:
testB.scm:5:3: internal compile error - caught java.lang.Error: popType
called
with empty stack B.testB$X(gnu.mapping.CallContext)void
java.lang.Error: popType called with empty stack
B.tesBt$X(gnu.mapping.CallContext)void
at
gnu.mapping.WrappedException.wrapIfNeeded(WrappedException.java:104)
at gnu.expr.Compilation.compile(Compilation.java:908)
at gnu.expr.Compilation.compileToFiles(Compilation.java:939)
at kawa.lang.CompileFile.compile_to_files(CompileFile.java:70)
at kawa.repl.processArgs(repl.java:407)
at kawa.repl.main(repl.java:657)
Caused by: java.lang.Error: popType called with empty stack
B.testB$X(gnu.mapping.CallContext)void
at gnu.bytecode.CodeAttr.popType(CodeAttr.java:307)
at gnu.bytecode.CodeAttr.emitStore(CodeAttr.java:1192)
at gnu.expr.Declaration.compileStore(Declaration.java:242)
Dominique Boucher