This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: a question about const and pure functions.
- From: Roger Sayle <roger at eyesopen dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Thu, 11 Nov 2004 11:23:36 -0700 (MST)
- Subject: Re: a question about const and pure functions.
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
--