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]

limit to length of an s-expression passed to eval?


Following up on my earlier email about using "eval", I've run into a
different problem. Part of what I'm doing involves saving my program's
data to file as an s-expression. To load in a saved file, I read the
s-expression, and then eval it in the null environment, as follows:

(define (myeval exp)
  (eval (list 'let primitive-procedures exp) (null-environment 5)))

where primitive-procedures is a list of lists, each defining a symbol and
a matching procedure for the subset of Scheme plus my own procedures,
which I use to re-create the program state when loading.

My data file consists of a series of procedures to recreate the data,
wrapped in a single "begin", so that the entire file is one (rather large)
s-expression.

This generally works fine. However, today I saved, and then loaded, a
particularly large file, and got the following error:

gnu.text.SyntaxException:
<unknown>: internal compile error - caught java.lang.ClassFormatError:
Invalid method Code length 65753 in class file atEvalLevel$333
    java.lang.ClassLoader.defineClass1(Native Method)
    java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    java.lang.ClassLoader.defineClass(ClassLoader.java:465)
    gnu.bytecode.ArrayClassLoader.loadClass(ArrayClassLoader.java:134)
    gnu.expr.ModuleExp.evalToClass(ModuleExp.java:115)
    gnu.expr.ModuleExp.evalModule1(ModuleExp.java:221)
    gnu.expr.ModuleExp.evalModule(ModuleExp.java:175)
    kawa.lang.Eval.evalBody(Eval.java:101)
    kawa.lang.Eval.eval(Eval.java:29)
    kawa.lang.Eval.eval(Eval.java:57)
    evaluator.myeval(evaluator.scm:21)

I can get around this by removing the top-level "begin", and saving a
series of s-expressions to the file, rather than a single s-expression.
However, its much easier to pass around a single s-expression internally,
which I can then write out directly to file, rather than generating a list
of s-expressions which I will then have to step through and write
sequentially to the file.

It looks like I'm hitting this bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4262078. Is there any
way around this limit besides what I suggested above?

thanks,
Alex




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