This is the mail archive of the kawa@sources.redhat.com 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: a new bug when compiling object statement, patch candidate included


Here's a similar bug:

    (module-name <Foo>)

    (define-simple-class <Bar> ()
      ((get-x) 'x)
      ((get-y) (get-x)))

When compiled this gives:

    java.lang.NullPointerException
            at gnu.bytecode.CodeAttr.emitLoad(CodeAttr.java:1046)
            at gnu.expr.LambdaExp.loadHeapFrame(LambdaExp.java:427)
            at gnu.expr.ApplyExp.compile(ApplyExp.java:193)

Using Vladimir's fix as a template, I'll provide a patch:

Index: LambdaExp.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/LambdaExp.java,v
retrieving revision 1.70
diff -u -r1.70 LambdaExp.java
--- LambdaExp.java	3 Mar 2003 20:05:25 -0000	1.70
+++ LambdaExp.java	1 Apr 2003 23:06:26 -0000
@@ -424,7 +424,10 @@
       }
     else
       {
-	code.emitLoad(curLambda.closureEnv);
+        if (curLambda.closureEnv == null)
+          code.emitPushThis();
+        else
+          code.emitLoad(curLambda.closureEnv);
 	LambdaExp parent = curLambda.outerLambda();
 	while (parent != this)
 	  {




Regards,
Chris Dean

Vladimir Tsichevski <wowa at jet dot msk dot su> wrote:
> I provide a patch which at least allows the compilation and PROBABLY
> (!) creates right codes.


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