Conditional Compilation Though Compile time variable / parameters/ fields / functions Annotation
Remi Forax
forax at univ-mlv.fr
Tue Apr 16 01:47:08 PDT 2013
On 04/16/2013 10:24 AM, Suminda Dharmasena wrote:
> A lto can be determined by static analysis if final fields are used.
> Need not be static as as myObj.fun(10) or myObj.fun2(myEnum.myParam)
> is determinable.
yes, but a call to fun can be full of side effects.
>
> There are packages which does this elemination:
> http://proguard.sourceforge.net/#alternatives.html
>
> What I am asking is some for of optimisation in javac similar to these
> packages.
>
> In java we do not want to eliminate. Using annotation if we mark a
> class with that static elimination should be done an hidden class can
> be created with the literal or static parameter paths are traced
> to eliminate the field or function. Exact semantics need more thought.
> A particular class can be a derived class for type preservation, etc.
>
I propose you something, given that it's a compilation transformation
you ask,
it doesn't have to be done by javac when prototyping, you can use
a bytecode transformer for that. So try to implement a bytecode transformer
that does what you ask and let see how it goes.
cheers,
Rémi
More information about the compiler-dev
mailing list