Speed up array allocation

Per Bothner per@bothner.com
Fri Jan 5 15:44:00 GMT 2001

While this is a reasonable patch, I ask myself: Why is
_Jv_GetArrayElementFromElementType being called for on each plain
(non-reflective) array allocation (judging from the benchmark)?
Two alternatives come to mind:

(1) Call _Jv_GetArrayElementFromElementType at class loading time,
and cache the result in a word, which the compiler uses.

(2)  Create a suitable mangling for array classes, and have the
compiler emit references just like it does for classes.  Have
the linker when it seems references to array types patch them up.
(Requires the hypothetical Java-aware linker.)

Actually, I'm happy with your choice of caching the array type
in a word in the element type - it is probably as good as (1)
and simpler.  But once we have our Java-aware linker, then (2)
should be considered.
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

More information about the Java-patches mailing list