* [PATCH][JAVA] Sanitize Java frontend global tree building
@ 2011-05-26 15:20 Richard Guenther
2011-06-07 13:14 ` [PING] " Richard Guenther
0 siblings, 1 reply; 2+ messages in thread
From: Richard Guenther @ 2011-05-26 15:20 UTC (permalink / raw)
To: gcc-patches; +Cc: aph, tromey
In preparation to move all frontends common tree node building to
the middle-end this makes the Java frontend actually use the
standard routines. It's still severely broken in overriding
things with stuff that does not match the targets C ABI, but well,
Java ...
Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk?
Thanks,
Richard.
2011-05-26 Richard Guenther <rguenther@suse.de>
java/
* decl.c (java_init_decl_processing): Call build_common_nodes,
set_sizetype and build_common_nodes_2 at the beginning. Remove
then duplicate initializations.
Index: gcc/java/decl.c
===================================================================
--- gcc/java/decl.c (revision 174281)
+++ gcc/java/decl.c (working copy)
@@ -566,13 +566,22 @@ java_init_decl_processing (void)
pushlevel (0); /* make the binding_level structure for global names */
global_binding_level = current_binding_level;
- /* The code here must be similar to build_common_tree_nodes{,_2} in
- tree.c, especially as to the order of initializing common nodes. */
- error_mark_node = make_node (ERROR_MARK);
- TREE_TYPE (error_mark_node) = error_mark_node;
+ /* Build common tree nodes, Java has an unsigned char. */
+ build_common_tree_nodes (false);
- /* Create sizetype first - needed for other types. */
- initialize_sizetypes ();
+ /* This is not a java type, however tree-dfa requires a definition for
+ size_type_node. */
+ size_type_node = make_unsigned_type (POINTER_SIZE);
+ set_sizetype (size_type_node);
+
+ /* Build the rest of the common tree nodes. */
+ build_common_tree_nodes_2 (0);
+
+ /* ??? Now we continue and override some of the built types again
+ with Java specific types. As the above generated types are
+ supposed to match the targets C ABI this isn't really the way
+ to go and any Java specifics should _not_ use those global types
+ if the Java ABI does not match the C one. */
byte_type_node = make_signed_type (8);
pushdecl (build_decl (BUILTINS_LOCATION,
@@ -604,11 +613,6 @@ java_init_decl_processing (void)
TYPE_DECL, get_identifier ("unsigned long"),
unsigned_long_type_node));
- /* This is not a java type, however tree-dfa requires a definition for
- size_type_node. */
- size_type_node = make_unsigned_type (POINTER_SIZE);
- set_sizetype (size_type_node);
-
/* Define these next since types below may used them. */
integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0);
integer_zero_node = build_int_cst (NULL_TREE, 0);
@@ -624,39 +628,22 @@ java_init_decl_processing (void)
= double_int_to_tree (unsigned_long_type_node,
double_int_setbit (double_int_zero, 64));
- size_zero_node = size_int (0);
- size_one_node = size_int (1);
- bitsize_zero_node = bitsize_int (0);
- bitsize_one_node = bitsize_int (1);
- bitsize_unit_node = bitsize_int (BITS_PER_UNIT);
-
long_zero_node = build_int_cst (long_type_node, 0);
- void_type_node = make_node (VOID_TYPE);
pushdecl (build_decl (BUILTINS_LOCATION,
TYPE_DECL, get_identifier ("void"), void_type_node));
- layout_type (void_type_node); /* Uses size_zero_node */
-
- ptr_type_node = build_pointer_type (void_type_node);
- const_ptr_type_node
- = build_pointer_type (build_type_variant (void_type_node, 1, 0));
t = make_node (VOID_TYPE);
layout_type (t); /* Uses size_zero_node */
return_address_type_node = build_pointer_type (t);
- null_pointer_node = build_int_cst (ptr_type_node, 0);
-
- char_type_node = make_node (INTEGER_TYPE);
+ char_type_node = make_unsigned_type (16);
TYPE_STRING_FLAG (char_type_node) = 1;
- TYPE_PRECISION (char_type_node) = 16;
- fixup_unsigned_type (char_type_node);
pushdecl (build_decl (BUILTINS_LOCATION,
TYPE_DECL, get_identifier ("char"), char_type_node));
- boolean_type_node = make_node (BOOLEAN_TYPE);
- TYPE_PRECISION (boolean_type_node) = 1;
- fixup_unsigned_type (boolean_type_node);
+ boolean_type_node = make_unsigned_type (1);
+ TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
pushdecl (build_decl (BUILTINS_LOCATION,
TYPE_DECL, get_identifier ("boolean"),
boolean_type_node));
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PING] [PATCH][JAVA] Sanitize Java frontend global tree building
2011-05-26 15:20 [PATCH][JAVA] Sanitize Java frontend global tree building Richard Guenther
@ 2011-06-07 13:14 ` Richard Guenther
0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2011-06-07 13:14 UTC (permalink / raw)
To: gcc-patches, java; +Cc: aph, tromey
On Thu, 26 May 2011, Richard Guenther wrote:
>
> In preparation to move all frontends common tree node building to
> the middle-end this makes the Java frontend actually use the
> standard routines. It's still severely broken in overriding
> things with stuff that does not match the targets C ABI, but well,
> Java ...
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk?
Ping.
> Thanks,
> Richard.
>
> 2011-05-26 Richard Guenther <rguenther@suse.de>
>
> java/
> * decl.c (java_init_decl_processing): Call build_common_nodes,
> set_sizetype and build_common_nodes_2 at the beginning. Remove
> then duplicate initializations.
>
> Index: gcc/java/decl.c
> ===================================================================
> --- gcc/java/decl.c (revision 174281)
> +++ gcc/java/decl.c (working copy)
> @@ -566,13 +566,22 @@ java_init_decl_processing (void)
> pushlevel (0); /* make the binding_level structure for global names */
> global_binding_level = current_binding_level;
>
> - /* The code here must be similar to build_common_tree_nodes{,_2} in
> - tree.c, especially as to the order of initializing common nodes. */
> - error_mark_node = make_node (ERROR_MARK);
> - TREE_TYPE (error_mark_node) = error_mark_node;
> + /* Build common tree nodes, Java has an unsigned char. */
> + build_common_tree_nodes (false);
>
> - /* Create sizetype first - needed for other types. */
> - initialize_sizetypes ();
> + /* This is not a java type, however tree-dfa requires a definition for
> + size_type_node. */
> + size_type_node = make_unsigned_type (POINTER_SIZE);
> + set_sizetype (size_type_node);
> +
> + /* Build the rest of the common tree nodes. */
> + build_common_tree_nodes_2 (0);
> +
> + /* ??? Now we continue and override some of the built types again
> + with Java specific types. As the above generated types are
> + supposed to match the targets C ABI this isn't really the way
> + to go and any Java specifics should _not_ use those global types
> + if the Java ABI does not match the C one. */
>
> byte_type_node = make_signed_type (8);
> pushdecl (build_decl (BUILTINS_LOCATION,
> @@ -604,11 +613,6 @@ java_init_decl_processing (void)
> TYPE_DECL, get_identifier ("unsigned long"),
> unsigned_long_type_node));
>
> - /* This is not a java type, however tree-dfa requires a definition for
> - size_type_node. */
> - size_type_node = make_unsigned_type (POINTER_SIZE);
> - set_sizetype (size_type_node);
> -
> /* Define these next since types below may used them. */
> integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0);
> integer_zero_node = build_int_cst (NULL_TREE, 0);
> @@ -624,39 +628,22 @@ java_init_decl_processing (void)
> = double_int_to_tree (unsigned_long_type_node,
> double_int_setbit (double_int_zero, 64));
>
> - size_zero_node = size_int (0);
> - size_one_node = size_int (1);
> - bitsize_zero_node = bitsize_int (0);
> - bitsize_one_node = bitsize_int (1);
> - bitsize_unit_node = bitsize_int (BITS_PER_UNIT);
> -
> long_zero_node = build_int_cst (long_type_node, 0);
>
> - void_type_node = make_node (VOID_TYPE);
> pushdecl (build_decl (BUILTINS_LOCATION,
> TYPE_DECL, get_identifier ("void"), void_type_node));
> - layout_type (void_type_node); /* Uses size_zero_node */
> -
> - ptr_type_node = build_pointer_type (void_type_node);
> - const_ptr_type_node
> - = build_pointer_type (build_type_variant (void_type_node, 1, 0));
>
> t = make_node (VOID_TYPE);
> layout_type (t); /* Uses size_zero_node */
> return_address_type_node = build_pointer_type (t);
>
> - null_pointer_node = build_int_cst (ptr_type_node, 0);
> -
> - char_type_node = make_node (INTEGER_TYPE);
> + char_type_node = make_unsigned_type (16);
> TYPE_STRING_FLAG (char_type_node) = 1;
> - TYPE_PRECISION (char_type_node) = 16;
> - fixup_unsigned_type (char_type_node);
> pushdecl (build_decl (BUILTINS_LOCATION,
> TYPE_DECL, get_identifier ("char"), char_type_node));
>
> - boolean_type_node = make_node (BOOLEAN_TYPE);
> - TYPE_PRECISION (boolean_type_node) = 1;
> - fixup_unsigned_type (boolean_type_node);
> + boolean_type_node = make_unsigned_type (1);
> + TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
> pushdecl (build_decl (BUILTINS_LOCATION,
> TYPE_DECL, get_identifier ("boolean"),
> boolean_type_node));
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-07 13:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 15:20 [PATCH][JAVA] Sanitize Java frontend global tree building Richard Guenther
2011-06-07 13:14 ` [PING] " Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).