Commit c7d08869 by Anatoly Sokolov Committed by Anatoly Sokolov

decl.c (java_init_decl_processing): Use double_int_to_tree instead of build_int_cst_wide.

/java
	* decl.c (java_init_decl_processing): Use double_int_to_tree instead
	of build_int_cst_wide.
	* boehm.c (set_bit): Remove.
	(mark_reference_fields): Use double_int type for 'mask' argument.
	Use double_int_setbit instead of set_bit.
	(get_boehm_type_descriptor): Use double_int_setbit instead of
	set_bit. Use double_int_to_tree instead of build_int_cst_wide.

From-SVN: r161288
parent bc051083
2010-06-23 Anatoly Sokolov <aesok@post.ru>
* decl.c (java_init_decl_processing): Use double_int_to_tree instead
of build_int_cst_wide.
* boehm.c (set_bit): Remove.
(mark_reference_fields): Use double_int type for 'mask' argument.
Use double_int_setbit instead of set_bit.
(get_boehm_type_descriptor): Use double_int_setbit instead of
set_bit. Use double_int_to_tree instead of build_int_cst_wide.
2010-06-10 Gerald Pfeifer <gerald@pfeifer.com> 2010-06-10 Gerald Pfeifer <gerald@pfeifer.com>
* gcj.texi: Move to GFDL version 1.3. Fix copyright years. * gcj.texi: Move to GFDL version 1.3. Fix copyright years.
......
...@@ -27,17 +27,15 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -27,17 +27,15 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "system.h" #include "system.h"
#include "coretypes.h" #include "coretypes.h"
#include "double-int.h"
#include "tm.h" #include "tm.h"
#include "tree.h" #include "tree.h"
#include "java-tree.h" #include "java-tree.h"
#include "parse.h" #include "parse.h"
#include "toplev.h" #include "toplev.h"
static void mark_reference_fields (tree, unsigned HOST_WIDE_INT *, static void mark_reference_fields (tree, double_int *, unsigned int,
unsigned HOST_WIDE_INT *, unsigned int,
int *, int *, int *, HOST_WIDE_INT *); int *, int *, int *, HOST_WIDE_INT *);
static void set_bit (unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *,
unsigned int);
/* A procedure-based object descriptor. We know that our /* A procedure-based object descriptor. We know that our
`kind' is 0, and `env' is likewise 0, so we have a simple `kind' is 0, and `env' is likewise 0, so we have a simple
...@@ -47,30 +45,10 @@ static void set_bit (unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *, ...@@ -47,30 +45,10 @@ static void set_bit (unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *,
Here DS_PROC == 2. */ Here DS_PROC == 2. */
#define PROCEDURE_OBJECT_DESCRIPTOR 2 #define PROCEDURE_OBJECT_DESCRIPTOR 2
/* Treat two HOST_WIDE_INT's as a contiguous bitmap, with bit 0 being
the least significant. This function sets bit N in the bitmap. */
static void
set_bit (unsigned HOST_WIDE_INT *low, unsigned HOST_WIDE_INT *high,
unsigned int n)
{
unsigned HOST_WIDE_INT *which;
if (n >= HOST_BITS_PER_WIDE_INT)
{
n -= HOST_BITS_PER_WIDE_INT;
which = high;
}
else
which = low;
*which |= (unsigned HOST_WIDE_INT) 1 << n;
}
/* Recursively mark reference fields. */ /* Recursively mark reference fields. */
static void static void
mark_reference_fields (tree field, mark_reference_fields (tree field,
unsigned HOST_WIDE_INT *low, double_int *mask,
unsigned HOST_WIDE_INT *high,
unsigned int ubit, unsigned int ubit,
int *pointer_after_end, int *pointer_after_end,
int *all_bits_set, int *all_bits_set,
...@@ -81,7 +59,7 @@ mark_reference_fields (tree field, ...@@ -81,7 +59,7 @@ mark_reference_fields (tree field,
if (DECL_NAME (field) == NULL_TREE) if (DECL_NAME (field) == NULL_TREE)
{ {
mark_reference_fields (TYPE_FIELDS (TREE_TYPE (field)), mark_reference_fields (TYPE_FIELDS (TREE_TYPE (field)),
low, high, ubit, mask, ubit,
pointer_after_end, all_bits_set, pointer_after_end, all_bits_set,
last_set_index, last_view_index); last_set_index, last_view_index);
field = TREE_CHAIN (field); field = TREE_CHAIN (field);
...@@ -130,7 +108,7 @@ mark_reference_fields (tree field, ...@@ -130,7 +108,7 @@ mark_reference_fields (tree field,
bits for all words in the record. This is conservative, but the bits for all words in the record. This is conservative, but the
size_words != 1 case is impossible in regular java code. */ size_words != 1 case is impossible in regular java code. */
for (i = 0; i < size_words; ++i) for (i = 0; i < size_words; ++i)
set_bit (low, high, ubit - count - i - 1); *mask = double_int_setbit (*mask, ubit - count - i - 1);
if (count >= ubit - 2) if (count >= ubit - 2)
*pointer_after_end = 1; *pointer_after_end = 1;
...@@ -159,9 +137,11 @@ get_boehm_type_descriptor (tree type) ...@@ -159,9 +137,11 @@ get_boehm_type_descriptor (tree type)
int last_set_index = 0; int last_set_index = 0;
HOST_WIDE_INT last_view_index = -1; 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; double_int mask;
tree field, value, value_type; tree field, value, value_type;
mask = double_int_zero;
/* If the GC wasn't requested, just use a null pointer. */ /* If the GC wasn't requested, just use a null pointer. */
if (! flag_use_boehm_gc) if (! flag_use_boehm_gc)
return null_pointer_node; return null_pointer_node;
...@@ -192,7 +172,7 @@ get_boehm_type_descriptor (tree type) ...@@ -192,7 +172,7 @@ get_boehm_type_descriptor (tree type)
goto procedure_object_descriptor; goto procedure_object_descriptor;
field = TYPE_FIELDS (type); field = TYPE_FIELDS (type);
mark_reference_fields (field, &low, &high, ubit, mark_reference_fields (field, &mask, ubit,
&pointer_after_end, &all_bits_set, &pointer_after_end, &all_bits_set,
&last_set_index, &last_view_index); &last_set_index, &last_view_index);
...@@ -215,23 +195,22 @@ get_boehm_type_descriptor (tree type) ...@@ -215,23 +195,22 @@ get_boehm_type_descriptor (tree type)
that we don't have to emit reflection data for run time that we don't have to emit reflection data for run time
marking. */ marking. */
count = 0; count = 0;
low = 0; mask = double_int_zero;
high = 0;
++last_set_index; ++last_set_index;
while (last_set_index) while (last_set_index)
{ {
if ((last_set_index & 1)) if ((last_set_index & 1))
set_bit (&low, &high, log2_size + count); mask = double_int_setbit (mask, log2_size + count);
last_set_index >>= 1; last_set_index >>= 1;
++count; ++count;
} }
value = build_int_cst_wide (value_type, low, high); value = double_int_to_tree (value_type, mask);
} }
else if (! pointer_after_end) else if (! pointer_after_end)
{ {
/* Bottom two bits for bitmap mark type are 01. */ /* Bottom two bits for bitmap mark type are 01. */
set_bit (&low, &high, 0); mask = double_int_setbit (mask, 0);
value = build_int_cst_wide (value_type, low, high); value = double_int_to_tree (value_type, mask);
} }
else else
{ {
......
...@@ -619,15 +619,9 @@ java_init_decl_processing (void) ...@@ -619,15 +619,9 @@ java_init_decl_processing (void)
/* A few values used for range checking in the lexer. */ /* A few values used for range checking in the lexer. */
decimal_int_max = build_int_cstu (unsigned_int_type_node, 0x80000000); decimal_int_max = build_int_cstu (unsigned_int_type_node, 0x80000000);
#if HOST_BITS_PER_WIDE_INT == 64 decimal_long_max
decimal_long_max = build_int_cstu (unsigned_long_type_node, = double_int_to_tree (unsigned_long_type_node,
0x8000000000000000LL); double_int_setbit (double_int_zero, 64));
#elif HOST_BITS_PER_WIDE_INT == 32
decimal_long_max = build_int_cst_wide (unsigned_long_type_node,
0, 0x80000000);
#else
#error "unsupported size"
#endif
size_zero_node = size_int (0); size_zero_node = size_int (0);
size_one_node = size_int (1); size_one_node = size_int (1);
......
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