C++/Java: Don't use type size in object allocation
Per Bothner
per@bothner.com
Thu Apr 15 23:35:00 GMT 2004
Bryce McKinlay wrote:
> 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.
I think the reason was so _Jv_AllocObject could also be used to allocate
arrays. As long as arrays no longer use _Jv_AllocObject, it's fine to
remove the size perhaps.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Java-patches
mailing list