This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: invalid code for Special literals
- From: Per Bothner <per at bothner dot com>
- To: wowa1 at online dot ru
- Cc: kawa at sources dot redhat dot com
- Date: Tue, 08 Apr 2003 11:21:34 -0700
- Subject: Re: invalid code for Special literals
- References: <3E8EF796.2080702@online.ru>
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/