This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Re: Speed up array allocation
- To: Bryce McKinlay <bryce at albatross dot co dot nz>
- Subject: Re: Speed up array allocation
- From: Per Bothner <per at bothner dot com>
- Date: 05 Jan 2001 15:47:32 -0800
- Cc: java-patches at sources dot redhat dot com
- References: <3A556FCB.58FBBAC7@albatross.co.nz>
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/