diff options
author | Tom Tromey <tromey@redhat.com> | 2006-02-08 20:07:29 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2006-02-08 20:07:29 +0000 |
commit | 8b1753e3ec0f38a18b8bcd3c13e2b6b55f799099 (patch) | |
tree | dad7dc41d043dce968c02f6043b92ddb8c7cbff7 /libjava/defineclass.cc | |
parent | b5642e202974f356bc85dafe0dfb4ab79736a48e (diff) | |
download | gcc-8b1753e3ec0f38a18b8bcd3c13e2b6b55f799099.zip gcc-8b1753e3ec0f38a18b8bcd3c13e2b6b55f799099.tar.gz gcc-8b1753e3ec0f38a18b8bcd3c13e2b6b55f799099.tar.bz2 |
PR libgcj/26063, PR libgcj/17978, PR libgcj/10598:
* defineclass.cc (parse): Use _Jv_AllocRawObj.
(read_constpool): Likewise.
(read_one_code_attribute): Use internal function name.
(handleConstantPool): Use _Jv_AllocRawObj.
(handleInterfacesBegin): Likewise.
(handleFieldsBegin): Likewise.
(handleMethodsBegin): Likewise.
(handleCodeAttribute): Likewise.
(handleMethodsEnd): Likewise.
* include/jvm.h (new_vtable): Use _Jv_AllocRawObj.
* interpret.cc (do_allocate_static_fields): Use _Jv_AllocRawObj.
Allocate reference fields separately.
* link.cc (prepare_constant_time_tables): Use _Jv_AllocRawObj.
(add_miranda_methods): Likewise.
(generate_itable): Use _Jv_AllocBytes.
(find_iindex): Likewise.
(struct method_closure): New structure.
(create_error_method): Use struct method_closure; allocate with
_Jv_AllocBytes.
(ensure_fields_laid_out): Separate reference fields from
non-reference fields.
* boehm.cc (_Jv_MarkObj): Mark vtable. Only mark direct fields
of Class.
(_Jv_MarkArray): Mark vtable.
(_Jv_AllocRawObj): Don't allocate objects of size 0.
* include/execution.h
(_Jv_ExecutionEngine::allocate_static_fields): Added 'int'
parameter.
(struct _Jv_CompiledEngine): Updated.
(class _Jv_InterpreterEngine): Updated.
From-SVN: r110763
Diffstat (limited to 'libjava/defineclass.cc')
-rw-r--r-- | libjava/defineclass.cc | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc index 89e0636f..c15cc22 100644 --- a/libjava/defineclass.cc +++ b/libjava/defineclass.cc @@ -1,6 +1,6 @@ // defineclass.cc - defining a class from .class format. -/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation +/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation This file is part of libgcj. @@ -350,7 +350,7 @@ _Jv_ClassReader::parse () // Allocate our aux_info here, after the name is set, to fulfill our // contract with the collector interface. - def->aux_info = (void *) _Jv_AllocBytes (sizeof (_Jv_InterpClass)); + def->aux_info = (void *) _Jv_AllocRawObj (sizeof (_Jv_InterpClass)); def_interp = (_Jv_InterpClass *) def->aux_info; int interfaces_count = read2u (); @@ -387,8 +387,7 @@ _Jv_ClassReader::parse () void _Jv_ClassReader::read_constpool () { tags = (unsigned char*) _Jv_AllocBytes (pool_count); - offsets = (unsigned int *) _Jv_AllocBytes (sizeof (int) - * pool_count) ; + offsets = (unsigned int *) _Jv_AllocBytes (sizeof (int) * pool_count) ; /** first, we scan the constant pool, collecting tags and offsets */ tags[0] = JV_CONSTANT_Undefined; @@ -656,8 +655,8 @@ void _Jv_ClassReader::read_one_code_attribute (int method_index) int table_len = read2u (); _Jv_LineTableEntry* table - = (_Jv_LineTableEntry *) JvAllocBytes (table_len - * sizeof (_Jv_LineTableEntry)); + = (_Jv_LineTableEntry *) _Jv_AllocBytes (table_len + * sizeof (_Jv_LineTableEntry)); for (int i = 0; i < table_len; i++) { table[i].bytecode_pc = read2u (); @@ -702,11 +701,10 @@ void _Jv_ClassReader::handleConstantPool () { /** now, we actually define the class' constant pool */ - // the pool is scanned explicitly by the collector jbyte *pool_tags = (jbyte*) _Jv_AllocBytes (pool_count); _Jv_word *pool_data - = (_Jv_word*) _Jv_AllocBytes (pool_count * sizeof (_Jv_word)); - + = (_Jv_word*) _Jv_AllocRawObj (pool_count * sizeof (_Jv_word)); + def->constants.tags = pool_tags; def->constants.data = pool_data; def->constants.size = pool_count; @@ -1046,7 +1044,7 @@ _Jv_ClassReader::checkExtends (jclass sub, jclass super) void _Jv_ClassReader::handleInterfacesBegin (int count) { - def->interfaces = (jclass*) _Jv_AllocBytes (count*sizeof (jclass)); + def->interfaces = (jclass*) _Jv_AllocRawObj (count*sizeof (jclass)); def->interface_count = count; } @@ -1112,11 +1110,10 @@ _Jv_ClassReader::checkImplements (jclass sub, jclass super) void _Jv_ClassReader::handleFieldsBegin (int count) { - def->fields = (_Jv_Field*) - _Jv_AllocBytes (count * sizeof (_Jv_Field)); + def->fields = (_Jv_Field*) _Jv_AllocRawObj (count * sizeof (_Jv_Field)); def->field_count = count; - def_interp->field_initializers = (_Jv_ushort*) - _Jv_AllocBytes (count * sizeof (_Jv_ushort)); + def_interp->field_initializers + = (_Jv_ushort*) _Jv_AllocRawObj (count * sizeof (_Jv_ushort)); for (int i = 0; i < count; i++) def_interp->field_initializers[i] = (_Jv_ushort) 0; } @@ -1256,11 +1253,11 @@ void _Jv_ClassReader::handleFieldsEnd () void _Jv_ClassReader::handleMethodsBegin (int count) { - def->methods = (_Jv_Method *) _Jv_AllocBytes (sizeof (_Jv_Method) * count); + def->methods = (_Jv_Method *) _Jv_AllocRawObj (sizeof (_Jv_Method) * count); def_interp->interpreted_methods - = (_Jv_MethodBase **) _Jv_AllocBytes (sizeof (_Jv_MethodBase *) - * count); + = (_Jv_MethodBase **) _Jv_AllocRawObj (sizeof (_Jv_MethodBase *) + * count); for (int i = 0; i < count; i++) { @@ -1331,7 +1328,7 @@ void _Jv_ClassReader::handleCodeAttribute { int size = _Jv_InterpMethod::size (exc_table_length, code_length); _Jv_InterpMethod *method = - (_Jv_InterpMethod*) (_Jv_AllocBytes (size)); + (_Jv_InterpMethod*) (_Jv_AllocRawObj (size)); method->max_stack = max_stack; method->max_locals = max_locals; @@ -1390,7 +1387,7 @@ void _Jv_ClassReader::handleMethodsEnd () else { _Jv_JNIMethod *m = (_Jv_JNIMethod *) - _Jv_AllocBytes (sizeof (_Jv_JNIMethod)); + _Jv_AllocRawObj (sizeof (_Jv_JNIMethod)); m->defining_class = def; m->self = method; m->function = NULL; |