a question about const and pure functions.
Roger Sayle
roger@eyesopen.com
Thu Nov 11 19:38:00 GMT 2004
On 11 Nov 2004, Tom Tromey wrote:
> I don't have an immediate plan to implement any of this, but I've
> been thinking about it in the context of tree-ssa. I've read that
> some folks would like there to be a clean handoff from the front ends
> to the GENERIC parts of the compiler -- so I've been trying to think
> of situations where this causes problems for java.
Another possibility is to make the class initialization behaviour
far more explicit in the gimple when handing off to the middle-end.
For example, in the following:
extern void _Jv_InitClass();
void foo()
{
int i = 0;
if (!i)
{
_Jv_InitClass();
i = 1;
}
if (!i)
{
_Jv_InitClass();
i = 1;
}
if (!i)
{
_Jv_InitClass();
i = 1;
}
}
The current optimizers are able to optimize the local variable "i"
completely away. Something similar may be possible in the Java
front-end, where the initial gimple containing these local init
flags one per class explicitly needing initialization in the function.
With a clever bit of hackery, the call of _Jv_InitClass (x) can set
the initialized flag for all of x's superclasses.
Just a thought.
Roger
--
More information about the Gcc
mailing list