From 2934c6b590ded021f96a83dbb8b1100acedde68c Mon Sep 17 00:00:00 2001 From: aph Date: Mon, 24 Apr 2006 15:33:16 +0000 Subject: 2006-04-21 Andrew Haley * lang.c (java_init): Handle flag_indirect_classes. * jvgenmain.c: Use "class$$" instead of "class$". * mangle.c (java_mangle_decl): Accept RECORD_TYPEs sw well as DECLs. (mangle_class_field): Special case "class$$" as well as "class$". * constants.c (build_ref_from_constant_pool): If flag_indirect_classes, generate a ref into the heap. * decl.c (constants_field_decl_node, constants_data_field_decl_node): New. * class.c (build_static_class_ref): New. (build_classdollar_field): Factor out from build_class_ref(). (make_field_value): Handle static fields in heap. (make_class_data): Make sure we get a static ref to class. Make class initializer const if flag_indirect_classes. (register_class): Build a class_ref for initialization if flag_indirect_classes. (emit_indirect_register_classes): New. 2006-04-21 Andrew Haley * include/execution.h (struct _Jv_CompiledEngine): Define for compiled classes. * java/lang/natClassLoader.cc (_Jv_RegisterClasses): Call _Jv_RegisterLibForGc. (_Jv_RegisterClasses_Counted): Likewise. (_Jv_NewClassFromInitializer): New. (_Jv_RegisterNewClasses): New. * sources.am: Regenerate. * boehm.cc (_Jv_GC_has_static_roots): new. (_Jv_InitGC): Call GC_register_has_static_roots_callback. (filename_node, find_file, _Jv_print_gc_store, new_node, _Jv_GC_has_static_roots, _Jv_RegisterLibForGc): New. * scripts/makemake.tcl: Add -fno-indirect-classes. * Makefile.in: Regenerate. * link.cc (resolve_pool_entry): Allocate constant pool. Allocate fields. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113224 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/include/boehm-gc.h | 1 + libjava/include/execution.h | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'libjava/include') diff --git a/libjava/include/boehm-gc.h b/libjava/include/boehm-gc.h index e7802b68035..4e2a06b8903 100644 --- a/libjava/include/boehm-gc.h +++ b/libjava/include/boehm-gc.h @@ -19,6 +19,7 @@ extern "C" { void *_Jv_MarkObj (void *, void *, void *, void *); void *_Jv_MarkArray (void *, void *, void *, void *); + void _Jv_RegisterLibForGc (const void *); } // Enough stuff to inline _Jv_AllocObj. Ugly. diff --git a/libjava/include/execution.h b/libjava/include/execution.h index 88189f6449e..fe141e91ec9 100644 --- a/libjava/include/execution.h +++ b/libjava/include/execution.h @@ -55,9 +55,25 @@ struct _Jv_CompiledEngine : public _Jv_ExecutionEngine return NULL; } - static void do_allocate_static_fields (jclass, int, int) + static void do_allocate_static_fields (jclass klass, + int pointer_size, + int other_size) { - // Compiled classes don't need this. + // 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) + continue; + + char *base = field->isRef() ? reference_fields : non_reference_fields; + field->u.addr = base + field->u.boffset; + } } static void do_create_ncode (jclass) -- cgit v1.2.3