summaryrefslogtreecommitdiff
path: root/libjava/interpret.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-08 20:07:29 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-08 20:07:29 +0000
commit862ad8b433732c1533f670040617716f641d3a55 (patch)
treedad7dc41d043dce968c02f6043b92ddb8c7cbff7 /libjava/interpret.cc
parent35792caf91f289bd8fa2aa9a871e5865f0ed0630 (diff)
downloadgcc-862ad8b433732c1533f670040617716f641d3a55.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110763 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/interpret.cc')
-rw-r--r--libjava/interpret.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index 87d357c94c2..f95671d267b 100644
--- a/libjava/interpret.cc
+++ b/libjava/interpret.cc
@@ -3877,25 +3877,30 @@ _Jv_InterpreterEngine::do_create_ncode (jclass klass)
void
_Jv_InterpreterEngine::do_allocate_static_fields (jclass klass,
- int static_size)
+ int pointer_size,
+ int other_size)
{
_Jv_InterpClass *iclass = (_Jv_InterpClass *) klass->aux_info;
- char *static_data = (char *) _Jv_AllocBytes (static_size);
+ // Splitting the allocations here lets us scan reference fields and
+ // avoid scanning non-reference fields.
+ char *reference_fields = (char *) _Jv_AllocRawObj (pointer_size);
+ char *non_reference_fields = (char *) _Jv_AllocBytes (other_size);
for (int i = 0; i < klass->field_count; i++)
{
_Jv_Field *field = &klass->fields[i];
- if ((field->flags & java::lang::reflect::Modifier::STATIC) != 0)
+ if ((field->flags & java::lang::reflect::Modifier::STATIC) == 0)
+ continue;
+
+ char *base = field->isRef() ? reference_fields : non_reference_fields;
+ field->u.addr = base + field->u.boffset;
+
+ if (iclass->field_initializers[i] != 0)
{
- field->u.addr = static_data + field->u.boffset;
-
- if (iclass->field_initializers[i] != 0)
- {
- _Jv_Linker::resolve_field (field, klass->loader);
- _Jv_InitField (0, klass, i);
- }
+ _Jv_Linker::resolve_field (field, klass->loader);
+ _Jv_InitField (0, klass, i);
}
}