Misplaced memset?

Tom Tromey tromey@redhat.com
Mon Nov 25 17:34:00 GMT 2002


>>>>> "Angelo" == Angelo Corsaro <corsaro@ece.uci.edu> writes:

Angelo> I think that the memset following in the following code should
Angelo> be moved to _Jv_AllocPtrFreeObj. I think it is better to
Angelo> assume as precondition that all the allocators give back
Angelo> zeroed memory.

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).

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.

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).

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?

Tom



More information about the Java mailing list