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: invalid code for Special literals


Vladimir Tsichevski wrote:
Hi,

if you use literals of gnu.expr.Special type (literals beginning with #!), kawa generates constant init sequence that causes
java verification error. For example:


wowa at src$ cat bug.scm
#!default
wowa at src$ kawa --main -C bug.scm
(compiling bug.scm)
wowa at src$ java bug
Exception in thread "main" java.lang.VerifyError: (class: bug, method: <clinit> signature: ()V) Bad type in putfield/putstatic
wowa at src$


The origin of the error is in that the the following code are generated:

static final Special Lit0 = Special.make("default");

and Special.make() is defined as returning java.lang.Object, but not a gnu.expr.Special, as it supposed to be.

To make Special.make() to return Specials we should either:

1. Exclude the Special.eof from the list of Special constant, use gnu.lists.Sequence.eofValue instead
2. Let eof constant be Special, use Special.eof instead of gnu.lists.Sequence.eofValue (patch included)

I chose option 1 instead. The reason is that I don't to have gnu.lists depend on gnu.expr. The disadvantage is that printing eofValue is ugly, so I changed it to use a new Eofclass instead. Perhaps a better solution would be to move Special into gnu.lists, or some similar utility package, that contains helper classes but does not depend on gnu.expr. -- --Per Bothner per at bothner dot com http://per.bothner.com/



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