overhead of reflection info
Adam Megacz
megacz@gcc.gnu.org
Mon Feb 23 00:56:00 GMT 2004
Per Bothner <per@bothner.com> writes:
> I think such a flag will be worthwhile. I think it would be easier
> and do more if you also disable classloading, interpretation, and JNI,
> since those are big uses of reflection info.
> I'd keep just enough to keep the "JDK 1.0" level of reflection:
Absolutely. There are a large number of quasi-java environemnts
(jump2, etc) which support this exact level of funcitonality: jdk1.1
minus java.lang.reflect (but including Class.forName()), minus
ClassLoader.fromBytes() and minus JNI. In fact, this is the subset of
Java which XWT is designed to run on.
> have to make sure all classes can be initialized at compile-time,
> and reject any non-trivial class initialization code. I don't know
> how much of the library should have to be changed - a good chunk,
> I suspect, so this is not a trivial change.
Yeah, I think this is a pretty major change; most Java code
inadvertently relies on Java's ability to infer the order in which
<clinit>s run at runtime.
Still, it would be really great to eliminate all those
is-the-class-loaded checks. I wonder if the MMU (write-protecting
pages) could be used to do this. Put all of the methods/fields
related to a class on a contiguous set of pages and write protect them
until <clinit> runs.
- a
More information about the Java
mailing list