Bug with ConstantValueAttribute?

Erik Schnetter erik.schnetter at student.uni-tuebingen.de
Mon Apr 28 08:55:47 PDT 1997


Hello.

Let me start with the (usual) paragraph about how impressed I am by kaffe,
by its speed and yet its simplicity.  It is a great tool, and I'd like to 
see it work for the Sather compiler producing Java bytecode.

Yet there seem to be some problems... Yesterday I found at least one of 
them, and now I'm not sure whether this is an oversight in kaffe, or 
whether I misread the JVM specification.

It has to do with "final static" constants, or (probably) with the
ConstantValueAttribute.  A Java program explicitely accessing such an
attribute in a different class reads a zero instead of the true value.  It
seems that kaffe does not initialize such values. 

An example is the class java.lang.Math, containing final statics like PI. 
Accessing such a value from a method I wrote yielded the value zero. 
Programs compiled with "java" (the compiler from Sun) do not show this
problem because they always inline final static constants. 

Is a bytecode compiler required to inline final static constants?  From
the JVM specification it seems as if not.  Any clarification would help. 
If this should be a bug in kaffe -- could you give me a hint how to fix
it, such as "ConstantValueAttributes are handled there and there; just add
handling finals"? 

Thank you,
-erik

-----
Erik Schnetter, erik.schnetter at student.uni-tuebingen.de

Arthur C. Clarke saw the future.
	He knew it would be run by huge computers.
		And he was right.		Just not about the size.



More information about the kaffe mailing list