This is the mail archive of the
kawa@sourceware.cygnus.com
mailing list for the Kawa project.
Path for void constants
- To: "Kawa" <kawa at sourceware dot cygnus dot com>
- Subject: Path for void constants
- From: "Daniel Bonniot" <bonniot at cma dot ensmp dot fr>
- Date: Tue, 25 Jan 2000 19:07:20 +0100
- Organization: d.bonniot@mail.dotcom.fr
First, there is a bug in QuoteExp : if value is null (like for
QuoteExp.nullExp), getType fails. It should return pointer_type. Here's the
patch:
diff -u -r1.4 QuoteExp.java
--- QuoteExp.java 1998/12/23 15:19:31 1.4
+++ QuoteExp.java 2000/01/25 16:58:17
@@ -16,6 +16,8 @@
{
if (value == Values.empty)
return gnu.bytecode.Type.void_type;
+ if (value == null)
+ return gnu.bytecode.Type.pointer_type;
return gnu.bytecode.Type.make(value.getClass());
}
Second, method Compilation.compileConstant (Object value, Target target)
emits a warning when 'value' is Values.empty and 'target' is a StackTarget
with a void type. I suppose it should not, since Values.empty (well, new
QuoteExp.voidExp, which value is Values.empty) seems to be the "void
expression".
The warning I get is :
<unknown>:116:26: warning - cannot convert literal (of type
gnu.mapping.Values) to void
I'm not sure yet if this case should be treated in Compilation. In that
case, I propose this patch:
diff -u -r1.26 Compilation.java
--- Compilation.java 2000/01/24 06:53:54 1.26
+++ Compilation.java 2000/01/25 18:04:48
@@ -426,6 +426,8 @@
code.emitPushInt(val ? 1 : 0);
return;
}
+ if (sig1 == 'V' && value == Values.empty)
+ return;
}
catch (ClassCastException ex)
{
Is it ok not to generate code in this case ?
Daniel