patch to bring java vtables closer to g++ abi conformance
Per Bothner
per@bothner.com
Wed Jan 23 20:51:00 GMT 2002
Bryce McKinlay wrote:
>> > type_info is for C++ type info, not the java class object, right?
>>
>> It could be both.
>
> Ahh, I see. Although that wouldn't work if we were to put static class
> data in class objects (for improved performance and better JLS
> compliance), because the size of the class then wouldn't be constant.
I'm suggesting the following: (Note that _si_class_type_info is a
standard sub-class of type_info specified by the C++ V3 ABI - see
http://www.codesourcery.com/cxx-abi/abi.html.)
class __jv_class_type_info : public __si_class_type_info {
jclass getJavaClass() { return (jclass) (this - CONSTANT); }
jclass operator() () { return getJavaClass(); }
};
class java:lang:Class
: public java:lang:Object, public _jv_class_type_info
{
... fields of Class, as before
}
This basically merges a (fixed-size) __jv_class_type_info
instance in each Class object. Converting from __jv_class_type_info
to Class or vice versa is a single subtraction/addition of a constant.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
More information about the Java
mailing list