aboutsummaryrefslogtreecommitdiff
path: root/libjava/defineclass.cc
diff options
context:
space:
mode:
authorBryce McKinlay <mckinlay@redhat.com>2004-04-20 01:38:46 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2004-04-20 02:38:46 +0100
commitf531010820afc86bde3e7d4b98850ee51c735de5 (patch)
treede88ceabf2ba85e265495894813895ad9f7f43cb /libjava/defineclass.cc
parent712faa50dd829c2e813a7169ef71ec20a6465666 (diff)
downloadgcc-f531010820afc86bde3e7d4b98850ee51c735de5.zip
gcc-f531010820afc86bde3e7d4b98850ee51c735de5.tar.gz
gcc-f531010820afc86bde3e7d4b98850ee51c735de5.tar.bz2
class.c (make_class_data): Add new field aux_info.
2004-04-19 Bryce McKinlay <mckinlay@redhat.com> * class.c (make_class_data): Add new field aux_info. * decl.c (java_init_decl_processing): Push type and decl for `aux_info'. 2004-04-19 Bryce McKinlay <mckinlay@redhat.com> * gcj/cni.h (JvAllocObject): Remove these obsolete, undocumented CNI calls. * include/java-interp.h (_Jv_InterpClass): No longer extends java.lang.Class. * java/lang/Class.h (Class): Add new field `aux_info'. * boehm.cc (_Jv_MarkObj): Update java.lang.Class marking. * defineclass.cc: Remove Class<->_Jv_InterpClass casts. Use Class->aux_info instead. * jni.cc (_Jv_JNI_AllocObject): Use _Jv_AllocObject. * resolve.cc: Remove Class<->_Jv_InterpClass casts. Use Class->aux_info instead. * java/io/natObjectInputStream.cc (allocateObject): Use _Jv_AllocObject. * java/lang/natClass.cc (newInstance): Likewise. * java/lang/natClassLoader.cc (_Jv_NewClass): Likewise. * java/lang/natObject.cc (clone): Likewise. * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise. * java/lang/natVMClassLoader.cc (defineClass): Don't use JvAllocObject. Allocate klass->aux_info here for interpreted class. From-SVN: r80875
Diffstat (limited to 'libjava/defineclass.cc')
-rw-r--r--libjava/defineclass.cc32
1 files changed, 18 insertions, 14 deletions
diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc
index 2e8b4d9..156efb5 100644
--- a/libjava/defineclass.cc
+++ b/libjava/defineclass.cc
@@ -96,7 +96,10 @@ struct _Jv_ClassReader {
unsigned int *offsets;
// the class to define (see java-interp.h)
- _Jv_InterpClass *def;
+ jclass def;
+
+ // the classes associated interpreter data.
+ _Jv_InterpClass *def_interp;
/* check that the given number of input bytes are available */
inline void check (int num)
@@ -221,7 +224,8 @@ struct _Jv_ClassReader {
bytes = (unsigned char*) (elements (data)+offset);
len = length;
pos = 0;
- def = (_Jv_InterpClass*) klass;
+ def = klass;
+ def_interp = (_Jv_InterpClass *) def->aux_info;
}
/** and here goes the parser members defined out-of-line */
@@ -1047,10 +1051,10 @@ void _Jv_ClassReader::handleFieldsBegin (int count)
def->fields = (_Jv_Field*)
_Jv_AllocBytes (count * sizeof (_Jv_Field));
def->field_count = count;
- def->field_initializers = (_Jv_ushort*)
+ def_interp->field_initializers = (_Jv_ushort*)
_Jv_AllocBytes (count * sizeof (_Jv_ushort));
for (int i = 0; i < count; i++)
- def->field_initializers[i] = (_Jv_ushort) 0;
+ def_interp->field_initializers[i] = (_Jv_ushort) 0;
}
void _Jv_ClassReader::handleField (int field_no,
@@ -1133,7 +1137,7 @@ void _Jv_ClassReader::handleConstantValueAttribute (int field_index,
throw_class_format_error ("field has multiple ConstantValue attributes");
field->flags |= _Jv_FIELD_CONSTANT_VALUE;
- def->field_initializers[field_index] = value;
+ def_interp->field_initializers[field_index] = value;
/* type check the initializer */
@@ -1153,7 +1157,7 @@ void _Jv_ClassReader::handleFieldsEnd ()
int low = 0;
int high = def->field_count-1;
_Jv_Field *fields = def->fields;
- _Jv_ushort *inits = def->field_initializers;
+ _Jv_ushort *inits = def_interp->field_initializers;
// this is kind of a raw version of quicksort.
while (low < high)
@@ -1195,13 +1199,13 @@ _Jv_ClassReader::handleMethodsBegin (int count)
{
def->methods = (_Jv_Method *) _Jv_AllocBytes (sizeof (_Jv_Method) * count);
- def->interpreted_methods
+ def_interp->interpreted_methods
= (_Jv_MethodBase **) _Jv_AllocBytes (sizeof (_Jv_MethodBase *)
* count);
for (int i = 0; i < count; i++)
{
- def->interpreted_methods[i] = 0;
+ def_interp->interpreted_methods[i] = 0;
def->methods[i].index = (_Jv_ushort) -1;
}
@@ -1284,7 +1288,7 @@ void _Jv_ClassReader::handleCodeAttribute
(void*) (bytes+code_start),
code_length);
- def->interpreted_methods[method_index] = method;
+ def_interp->interpreted_methods[method_index] = method;
if ((method->self->accflags & java::lang::reflect::Modifier::STATIC))
{
@@ -1301,7 +1305,7 @@ void _Jv_ClassReader::handleExceptionTableEntry
int start_pc, int end_pc, int handler_pc, int catch_type)
{
_Jv_InterpMethod *method = reinterpret_cast<_Jv_InterpMethod *>
- (def->interpreted_methods[method_index]);
+ (def_interp->interpreted_methods[method_index]);
_Jv_InterpException *exc = method->exceptions ();
exc[exc_index].start_pc.i = start_pc;
@@ -1319,7 +1323,7 @@ void _Jv_ClassReader::handleMethodsEnd ()
_Jv_Method *method = &def->methods[i];
if ((method->accflags & Modifier::NATIVE) != 0)
{
- if (def->interpreted_methods[i] != 0)
+ if (def_interp->interpreted_methods[i] != 0)
throw_class_format_error ("code provided for native method");
else
{
@@ -1328,7 +1332,7 @@ void _Jv_ClassReader::handleMethodsEnd ()
m->defining_class = def;
m->self = method;
m->function = NULL;
- def->interpreted_methods[i] = m;
+ def_interp->interpreted_methods[i] = m;
m->deferred = NULL;
if ((method->accflags & Modifier::STATIC))
@@ -1344,12 +1348,12 @@ void _Jv_ClassReader::handleMethodsEnd ()
}
else if ((method->accflags & Modifier::ABSTRACT) != 0)
{
- if (def->interpreted_methods[i] != 0)
+ if (def_interp->interpreted_methods[i] != 0)
throw_class_format_error ("code provided for abstract method");
}
else
{
- if (def->interpreted_methods[i] == 0)
+ if (def_interp->interpreted_methods[i] == 0)
throw_class_format_error ("method with no code");
}
}