Commit 2c6c322a by Tom Tromey Committed by Tom Tromey

decl.c (init_decl_processing): Set type of `sync_info' to be pointer to Object.

	* decl.c (init_decl_processing): Set type of `sync_info' to be
	pointer to Object.

	* boehm.c (get_boehm_type_descriptor): Correctly compute `bits'.
	Correctly compute bit number for current slot.  Zero `high' and
	`low' in DS_LENGTH case.  Don't skip inherited fields.  Use
	mark_reference_fields.
	(mark_reference_fields): New function.

From-SVN: r32572
parent d7d01975
2000-03-15 Tom Tromey <tromey@cygnus.com>
* decl.c (init_decl_processing): Set type of `sync_info' to be
pointer to Object.
* boehm.c (get_boehm_type_descriptor): Correctly compute `bits'.
Correctly compute bit number for current slot. Zero `high' and
`low' in DS_LENGTH case. Don't skip inherited fields. Use
mark_reference_fields.
(mark_reference_fields): New function.
Tue Mar 14 17:15:41 2000 Alexandre Petit-Bianco <apbianco@cygnus.com> Tue Mar 14 17:15:41 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (register_incomplete_type): Fixed initialization of * parse.y (register_incomplete_type): Fixed initialization of
......
...@@ -58,6 +58,50 @@ set_bit (unsigned HOST_WIDE_INT *low, unsigned HOST_WIDE_INT *high, ...@@ -58,6 +58,50 @@ set_bit (unsigned HOST_WIDE_INT *low, unsigned HOST_WIDE_INT *high,
*which |= (HOST_WIDE_INT) 1 << n; *which |= (HOST_WIDE_INT) 1 << n;
} }
/* Recursively mark reference fields. */
static unsigned int
mark_reference_fields (field, low, high, ubit,
pointer_after_end, all_bits_set, last_set_index)
tree field;
unsigned HOST_WIDE_INT *low, *high;
unsigned int ubit;
int *pointer_after_end, *all_bits_set, *last_set_index;
{
unsigned int count = 0;
/* See if we have fields from our superclass. */
if (DECL_NAME (field) == NULL_TREE)
{
count += mark_reference_fields (TYPE_FIELDS (TREE_TYPE (field)),
low, high, ubit,
pointer_after_end, all_bits_set,
last_set_index);
field = TREE_CHAIN (field);
}
for (; field != NULL_TREE; field = TREE_CHAIN (field))
{
if (FIELD_STATIC (field))
continue;
if (JREFERENCE_TYPE_P (TREE_TYPE (field)))
{
*last_set_index = count;
/* First word in object corresponds to most significant byte
of bitmap. */
set_bit (low, high, ubit - count - 1);
if (count > ubit - 2)
*pointer_after_end = 1;
}
else
*all_bits_set = 0;
++count;
}
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
single word describing the type. */ single word describing the type. */
tree tree
...@@ -79,7 +123,7 @@ get_boehm_type_descriptor (tree type) ...@@ -79,7 +123,7 @@ get_boehm_type_descriptor (tree type)
if (int_size_in_bytes (type) == -1) if (int_size_in_bytes (type) == -1)
return PROCEDURE_OBJECT_DESCRIPTOR; return PROCEDURE_OBJECT_DESCRIPTOR;
bit = POINTER_SIZE; bit = POINTER_SIZE / BITS_PER_UNIT;
/* The size of this node has to be known. And, we only support 32 /* The size of this node has to be known. And, we only support 32
and 64 bit targets, so we need to know that the log2 is one of and 64 bit targets, so we need to know that the log2 is one of
our values. */ our values. */
...@@ -97,27 +141,9 @@ get_boehm_type_descriptor (tree type) ...@@ -97,27 +141,9 @@ get_boehm_type_descriptor (tree type)
ubit = (unsigned int) bit; ubit = (unsigned int) bit;
field = TYPE_FIELDS (type); field = TYPE_FIELDS (type);
if (DECL_NAME (field) == NULL_TREE) count = mark_reference_fields (field, &low, &high, ubit,
field = TREE_CHAIN (field); /* Skip dummy field for inherited data. */ &pointer_after_end, &all_bits_set,
for (count = 0; field != NULL_TREE; field = TREE_CHAIN (field)) &last_set_index);
{
if (FIELD_STATIC (field))
continue;
if (JREFERENCE_TYPE_P (TREE_TYPE (field)))
{
last_set_index = count;
/* First word in object corresponds to most significant byte
of bitmap. */
set_bit (&low, &high, ubit - count);
if (count > ubit - 2)
pointer_after_end = 1;
}
else
all_bits_set = 0;
++count;
}
/* 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
...@@ -129,6 +155,8 @@ get_boehm_type_descriptor (tree type) ...@@ -129,6 +155,8 @@ get_boehm_type_descriptor (tree type)
DS_LENGTH is 0. DS_LENGTH is 0.
WORDS_TO_BYTES shifts by log2(bytes-per-pointer). */ WORDS_TO_BYTES shifts by log2(bytes-per-pointer). */
count = 0; count = 0;
low = 0;
high = 0;
++last_set_index; ++last_set_index;
while (last_set_index) while (last_set_index)
{ {
......
...@@ -626,7 +626,11 @@ init_decl_processing () ...@@ -626,7 +626,11 @@ init_decl_processing ()
dtable_ptr_type = build_pointer_type (dtable_type); dtable_ptr_type = build_pointer_type (dtable_type);
PUSH_FIELD (object_type_node, field, "vtable", dtable_ptr_type); PUSH_FIELD (object_type_node, field, "vtable", dtable_ptr_type);
PUSH_FIELD (object_type_node, field, "sync_info", ptr_type_node); /* This isn't exactly true, but it is what we have in the source.
There is an unresolved issue here, which is whether the vtable
should be marked by the GC. */
PUSH_FIELD (object_type_node, field, "sync_info",
build_pointer_type (object_type_node));
for (t = TYPE_FIELDS (object_type_node); t != NULL_TREE; t = TREE_CHAIN (t)) for (t = TYPE_FIELDS (object_type_node); t != NULL_TREE; t = TREE_CHAIN (t))
FIELD_PRIVATE (t) = 1; FIELD_PRIVATE (t) = 1;
FINISH_RECORD (object_type_node); FINISH_RECORD (object_type_node);
......
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