[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Soot bug: initial values for fields



Hi,

It turns out that the Java classfile specification allows a user to
specify initial values for fields.  That's not surprising, because one
often does specify initial values in Java bytecode.  What surprised me is
that javac actually does simple constant propagation and usually
eliminates references to initial values of fields.

public class stupidtest
{
    final static double d = 2.2;
}

For instance, in the above class, any reference to stupidtest.d is
replaced by 2.2.

Soot doesn't actually have any provisions for storing initial values for
fields.  They are read in by coffi and ignored.

It would be nice if someone could fix this Soot misfeature; that is, there
should be a provision for Soot to read in the initial values, store them
somewhere (probably as a Constant value) and emit them again in jasmin.

[There is a jasmin bug which will emit incorrect values in that case, but
I'll be releasing another new improved version of jasmin soon.]

pat