kawa-commonlisp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Kawa-commonlisp-dev] [GSoC] Status


From: Charles Turner
Subject: Re: [Kawa-commonlisp-dev] [GSoC] Status
Date: Thu, 9 Aug 2012 23:12:31 +0100

After further testing,  I've discovered a problem with this build
procedure. The first problem is that defSntxStFld doesn't properly
export a symbol for CL:

  protected void defSntxStFld(String name, String cname, String fname)
  {
    Object property
      = hasSeparateFunctionNamespace() ? EnvironmentKey.FUNCTION : null;
    StaticFieldLocation loc =
      StaticFieldLocation.define(environ, environ.getSymbol(name), property,
                                 cname, fname);
    loc.setSyntax();
  }

that environ.getSymbol(name) isn't what we want for CL, right? You can
see the problem from the REPL by trying something like #'defpackage.

I first changed that to just getSymbol(name), which is overriden in
CommonLisp to first look the symbol up in the current package, and
only if that fails try the environment.getSymbol() lookup.That fixes
the problem in that #'defpackage does what it should, but it causes a
seemingly unrelated build error for for gnu.commonlisp.lisp.defmacro:

(compiling defmacro.lisp to gnu.commonlisp.lisp.defmacro)
(+ #!null 1) ; <- from a FORMAT in the GENSYM definition.
java.lang.NullPointerException
        at gnu.kawa.functions.Arithmetic.asIntNum(Arithmetic.java:221)
        at gnu.kawa.functions.AddOp.apply2(AddOp.java:57)
        at gnu.kawa.functions.AddOp.applyN(AddOp.java:145)
        at gnu.kawa.functions.AddOp.applyN(AddOp.java:160)
        at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
        at gnu.commonlisp.lisp.primitives.GENSYM(primitives.lisp:142)
       [ snipped ... ]
defmacro.lisp:245:3: evaluating syntax transformer 'ONCE-ONLY' threw
java.lang.NullPointerException

What's happening is that *gensym-counter*, which is defined like so:

(defvar *gensym-counter* 0)

is getting bound to the #!null. It shows up as the right public static
field from javap, so I thought I should use defAliasStFld:

defAliasStFld("*GENSYM-COUNTER*", "gnu.commonlisp.lisp.primitives");

where this two argument function is defined analogously to the two
argument version of defProcStFld. This didn't help. Finally I tried
the best of both worlds for defSntxStFld:

  protected void defSntxStFld(String name, String cname, String fname)
  {
    Object property
      = hasSeparateFunctionNamespace() ? EnvironmentKey.FUNCTION : null;
    StaticFieldLocation loc =
      StaticFieldLocation.define(environ, getSymbol(name), property,
                                 cname, fname);
      StaticFieldLocation loc2 =
      StaticFieldLocation.define(environ, environ.getSymbol(name), property,
                                 cname, fname);
    loc.setSyntax();
    loc2.setSyntax();
  }

And it *still* has a build error. The only way to build defmacro is to
use the original defSntxStFld, which means no macro bindings :-/

One thing I have found a bit weird about defmacro.lisp lately is that
in the past, when compiled, the compiler would output lots of
defmacro$frameN.class files, now it only output one defmacro.class.
Not sure if this is useful information or not, all the methods and
fields appear to still be there judging from javap (and it seems like
an appropriate size at about 71 KiB)

Any thoughts on what might be happening? Sorry about this mess!

Charlie.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]