Commit d5f76aba by Tom Tromey Committed by Tom Tromey

boehm.c (mark_reference_fields): Added `last_view_index' argument.

	* boehm.c (mark_reference_fields): Added `last_view_index'
	argument.  Use DECL_FIELD_OFFSET to determine field's offset.

From-SVN: r33346
parent 7841261c
2000-04-22 Tom Tromey <tromey@cygnus.com>
* boehm.c (mark_reference_fields): Added `last_view_index'
argument. Use DECL_FIELD_OFFSET to determine field's offset.
Thu Apr 20 17:41:28 2000 Mo DeJong <mdejong@cygnus.com> Thu Apr 20 17:41:28 2000 Mo DeJong <mdejong@cygnus.com>
* parse.h (INTERFACE_INNER_MODIFIERS): New macro. * parse.h (INTERFACE_INNER_MODIFIERS): New macro.
......
...@@ -31,11 +31,13 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -31,11 +31,13 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "java-tree.h" #include "java-tree.h"
#include "parse.h" #include "parse.h"
static unsigned int mark_reference_fields PARAMS ((tree, static void mark_reference_fields PARAMS ((tree,
unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *,
unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *,
unsigned int, unsigned int,
int *, int *, int *)); int *, int *,
int *,
HOST_WIDE_INT *));
static void set_bit PARAMS ((unsigned HOST_WIDE_INT *, static void set_bit PARAMS ((unsigned HOST_WIDE_INT *,
unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *,
unsigned int)); unsigned int));
...@@ -69,33 +71,45 @@ set_bit (low, high, n) ...@@ -69,33 +71,45 @@ set_bit (low, high, n)
} }
/* Recursively mark reference fields. */ /* Recursively mark reference fields. */
static unsigned int static void
mark_reference_fields (field, low, high, ubit, mark_reference_fields (field, low, high, ubit,
pointer_after_end, all_bits_set, last_set_index) pointer_after_end, all_bits_set,
last_set_index, last_view_index)
tree field; tree field;
unsigned HOST_WIDE_INT *low, *high; unsigned HOST_WIDE_INT *low, *high;
unsigned int ubit; unsigned int ubit;
int *pointer_after_end, *all_bits_set, *last_set_index; int *pointer_after_end, *all_bits_set;
int *last_set_index;
HOST_WIDE_INT *last_view_index;
{ {
unsigned int count = 0;
/* See if we have fields from our superclass. */ /* See if we have fields from our superclass. */
if (DECL_NAME (field) == NULL_TREE) if (DECL_NAME (field) == NULL_TREE)
{ {
count += mark_reference_fields (TYPE_FIELDS (TREE_TYPE (field)), mark_reference_fields (TYPE_FIELDS (TREE_TYPE (field)),
low, high, ubit, low, high, ubit,
pointer_after_end, all_bits_set, pointer_after_end, all_bits_set,
last_set_index); last_set_index, last_view_index);
field = TREE_CHAIN (field); field = TREE_CHAIN (field);
} }
for (; field != NULL_TREE; field = TREE_CHAIN (field)) for (; field != NULL_TREE; field = TREE_CHAIN (field))
{ {
HOST_WIDE_INT offset = tree_low_cst (byte_position (field), 1);
if (FIELD_STATIC (field)) if (FIELD_STATIC (field))
continue; continue;
if (JREFERENCE_TYPE_P (TREE_TYPE (field))) if (JREFERENCE_TYPE_P (TREE_TYPE (field)))
{ {
unsigned int count;
/* If this reference slot appears to overlay a slot we think
we already covered, then we are doomed. */
if (offset <= *last_view_index)
abort ();
count = offset * BITS_PER_UNIT / POINTER_SIZE;
*last_set_index = count; *last_set_index = count;
/* First word in object corresponds to most significant byte /* First word in object corresponds to most significant byte
of bitmap. */ of bitmap. */
...@@ -106,10 +120,8 @@ mark_reference_fields (field, low, high, ubit, ...@@ -106,10 +120,8 @@ mark_reference_fields (field, low, high, ubit,
else else
*all_bits_set = 0; *all_bits_set = 0;
++count; *last_view_index = offset;
} }
return count;
} }
/* Return the marking bitmap for the class TYPE. For now this is a /* Return the marking bitmap for the class TYPE. For now this is a
...@@ -121,6 +133,7 @@ get_boehm_type_descriptor (tree type) ...@@ -121,6 +133,7 @@ get_boehm_type_descriptor (tree type)
int bit; int bit;
int all_bits_set = 1; int all_bits_set = 1;
int last_set_index = 0; int last_set_index = 0;
HOST_WIDE_INT last_view_index = -1;
int pointer_after_end = 0; int pointer_after_end = 0;
unsigned HOST_WIDE_INT low = 0, high = 0; unsigned HOST_WIDE_INT low = 0, high = 0;
tree field, value; tree field, value;
...@@ -151,9 +164,9 @@ get_boehm_type_descriptor (tree type) ...@@ -151,9 +164,9 @@ get_boehm_type_descriptor (tree type)
ubit = (unsigned int) bit; ubit = (unsigned int) bit;
field = TYPE_FIELDS (type); field = TYPE_FIELDS (type);
count = mark_reference_fields (field, &low, &high, ubit, mark_reference_fields (field, &low, &high, ubit,
&pointer_after_end, &all_bits_set, &pointer_after_end, &all_bits_set,
&last_set_index); &last_set_index, &last_view_index);
/* If the object is all pointers, or if the part with pointers fits /* If the object is all pointers, or if the part with pointers fits
in our bitmap, then we are ok. Otherwise we have to allocate it in our bitmap, then we are ok. Otherwise we have to allocate it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment