Misplaced memset?
Angelo Corsaro
corsaro@ece.uci.edu
Mon Nov 25 21:41:00 GMT 2002
Hello Tom,
On Mon, 2002年11月25日 at 17:23, Tom Tromey wrote:
> I may be misunderstanding (and hopefully Hans will correct me if so),
> but I think in this case _Jv_AllocPtrFreeObj is not required to return
> zeroed memory for performance reasons. There are other places where
> we call this function, places where zeroing the memory would be
> redundant work (since we immediately and fully initialize the returned
> object -- e.g. see the String case).
I see. Then in this case a solution would be that of defining
something like _Jv_AllocPtrFreeObj and _Jv_AllocPtrFreeObjRaw.
The first would initialize the object and the second would not.
Otherwise in the portion of code that I reported before _Jv_AllocBytes,
and the code could look like:
__JArray *arr =(__JArray *)_Jv_AllocBytes(size + elsize * count);
*((_Jv_VTable **)arr) = klass->vtable;
This way we don't introduce the memset.
> Angelo> Otherwise there is the danger that we have in the GCJ runtime
> Angelo> code that is there only to deal with specific characteristics
> Angelo> of the Boehm GC.
>> Since our only public GC is the Boehm GC, our policy has basically
> been that we'll make changes to the interface if it makes libgcj work
> better with this GC.
Makes sense.
> I suppose in this case another option would be to add some kind of
> configury tweak -- either a define set by the collector being used
> (that would toggle whether or not the memset is required) or a new
> inline function called from that location only (which for the Boehm
> case would call memset).
Right now I have patches that tweak a little bit GCJ so to introduce
hooks in all the place where the control needs to be transfered to my
RTSJ (real-time java) implementation.
> At the very least we could document this a bit better.
>> Angelo> I detected this change since it was affecting the performances
> Angelo> of my allocators.
>> Interesting. Why do you have your own allocator? What does it do
> differently?
Since the Real-Time Java Specification supports the concept of Memory
Regions, I can use very efficient allocators (i.e. costant time) to
manage this kind of memory.
Angelo
--
Angelo Corsaro
Web - http://www.ece.uci.edu/~corsaro
Tel. - (949) 824-7548
University of California, Irvine
355 Engineering Tower
Irvine, CA 92697-2625
More information about the Java
mailing list