C++/Java: Don't use type size in object allocation

Bryce McKinlay mckinlay@redhat.com
Thu Apr 15 23:26:00 GMT 2004


Currently, calls to the Java object allocation routines (eg 
_Jv_AllocObject) pass both a class parameter and a size parameter. Hard 
coding the size parameter at the call site contradicts binary 
compatibility, since the size of the object being created may change at 
runtime. Even without binary compatibility, passing the size parameter 
is redundant because the size of the type can be trivially obtained from 
class metadata.

As a side benefit, this change shaves 70k off libgcj.so sinces it 
reduces the code needed to push parameters for each "new".

This patch consists of front-end and runtime changes. Since C++ also 
calls _Jv_AllocObject for extern "Java" types, it needed to be updated 
as well. So, I need approval from a C++ maintainer for this, please! OK 
to commit?

Regards

Bryce


-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc-args.patch
Type: text/x-patch
Size: 11405 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20040415/a8c703b8/attachment.bin>


More information about the Java-patches mailing list