This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Bug with define-constant?
- From: "Dominique Boucher" <dominique dot boucher at nuecho dot com>
- To: "'Kawa List'" <kawa at sources dot redhat dot com>
- Date: Wed, 11 May 2005 14:25:50 -0400
- Subject: Bug with define-constant?
- Reply-to: <dominique dot boucher at nuecho dot com>
Hi,
I think I found a bug with 'define-constant'. It occurs when the constant is
not exported, as in:
;--------------------------------------
(module-static 'init-run)
(module-export make-object)
(define-constant *universal-constant* 42)
(define (make-object parent)
(define %parent #f)
(define %data #f)
(define (initialize-vector)
(set! %data (make-vector *universal-constant* 0)))
(lambda (index)
(set! %parent parent)
(initialize-vector)
(vector-ref %data index)))
;--------------------------------------
Using the latest Kawa with Sun's JDK 1.4.1_01 on Windows XP, I get:
#|kawa:1|# (require <module1>)
#<procedure module1>
#|kawa:2|# (make-object #f)
java.lang.VerifyError: (class: module1$frame, method: lambda1 signature:
(Ljava/lang/Object;)Ljava/lang/Object;) Accessing value from uninitialized
register 2
at module1.makeObject(module1.scm)
at module1.apply1(module1.scm:6)
at gnu.expr.ModuleMethod.apply1(ModuleMethod.java:183)
at gnu.expr.ModuleMethod.apply(ModuleMethod.java:154)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:247)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:236)
at kawa.Shell.run(Shell.java:226)
at kawa.Shell.run(Shell.java:172)
at kawa.Shell.run(Shell.java:159)
at kawa.repl.main(repl.java:673)
#|kawa:3|#
Using the 'jad' decompiler, the method 'lambda1' of class 'module1$frame'
looks like this:
public class module1$frame extends ModuleBody
{
Object lambda1(Object index)
{
this;
Object obj = <no variable>;
(Number);
intValue();
module1.Lit0;
vectors.makeVector();
$PcData;
...
Note the "<no variable>".
If you replace 'define-constant' by 'define' or export the symbol,
everything works fine. You get the following:
public class module1$frame extends ModuleBody
{
Object lambda1(Object index)
{
this;
Object obj = module1.$Stuniversal$Mnconstant$St;
(Number);
intValue();
module1.Lit0;
vectors.makeVector();
...
This is not a show stopper for me and there are workarounds. I just wanted
to let you know. Would you like me to enter it in Bugzilla?
Regards,
Dominique