This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tuples] the tuplification of java


Hi folks!

Here are the changes for the java front end.

The only bit I touched, apart from the obvious, was the definition of
EXPR_WFL_LINECOL in java-tree.h.  I have changed it to use the EXPR_LOCUS macro
instead of accessing exp.locus directly.  The macro has the added benefit of
finding the locus field in both trees and tuples.

Now we can bootstrap with java.

Unfortunately, there is one regression:

	FAIL: PR27908 -O3 execution - source compiled test

I am currently looking into it, but I seem to be spending my time trying
to figure out how to reproduce it with the java machinery and all that
CLASSPATH business. :).

Committed to branch.

	* java/java-tree.h (lang_tree_node): Handle gimple tuples.
	(EXPR_WFL_EMIT_LINE_NOTE): Look inside base.
	(EXPR_WFL_LINECOL): Use EXPR_LOCUS macro instead of exp.locus.
	* java/java-gimplify.c (java_gimplify_expr): Comment on why we do
	not handle GIMPLE_MODIFY_STMT in the switch statement.
	(java_gimplify_modify_expr): Call build2 with GIMPLE_MODIFY_STMT.
	(java_gimplify_new_array_init): Same.

Index: java/java-tree.h
===================================================================
--- java/java-tree.h	(revision 118382)
+++ java/java-tree.h	(working copy)
@@ -725,7 +725,8 @@ struct lang_identifier GTY(())
 /* The resulting tree type.  */
 union lang_tree_node 
   GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
-       chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
+       chain_next ("(GIMPLE_STMT_P (&%h.generic) ? (union lang_tree_node *) 0 : (union lang_tree_node *)TREE_CHAIN (&%h.generic))")))
+
 {
   union tree_node GTY ((tag ("0"), 
 			desc ("tree_node_structure (&%h)"))) 
@@ -1881,12 +1882,12 @@ enum
 
 /* In an EXPR_WITH_FILE_LOCATION node.  */
 #define EXPR_WFL_EMIT_LINE_NOTE(NODE) \
-  (EXPR_WITH_FILE_LOCATION_CHECK (NODE)->common.public_flag)
+  (EXPR_WITH_FILE_LOCATION_CHECK (NODE)->base.public_flag)
 #undef EXPR_WFL_NODE
 #define EXPR_WFL_NODE(NODE) \
   TREE_OPERAND (EXPR_WITH_FILE_LOCATION_CHECK (NODE), 0)
 #ifdef USE_MAPPED_LOCATION
-#define EXPR_WFL_LINECOL(NODE) ((NODE)->exp.locus)
+#define EXPR_WFL_LINECOL(NODE) EXPR_LOCUS(NODE)
 #define EXPR_WFL_FILENAME(NODE) EXPR_FILENAME (NODE)
 #define EXPR_WFL_LINENO(NODE) EXPR_LINENO (NODE)
 extern tree build_expr_wfl (tree, source_location);
Index: java/java-gimplify.c
===================================================================
--- java/java-gimplify.c	(revision 118179)
+++ java/java-gimplify.c	(working copy)
@@ -120,6 +120,9 @@ java_gimplify_expr (tree *expr_p, tree *
       *expr_p = java_replace_reference (*expr_p, /* want_lvalue */ false);
       return GS_UNHANDLED;
 
+      /* We don't handle GIMPLE_MODIFY_STMT, as MODIFY_EXPRs with java
+         semantics should only be generated by the front-end, and never
+         by anything after gimplification.  */
     case MODIFY_EXPR:
       return java_gimplify_modify_expr (expr_p, pre_p, post_p);
 
@@ -326,7 +329,7 @@ java_gimplify_modify_expr (tree *modify_
     {
       tree new_lhs = java_replace_reference (lhs, /* want_lvalue */ true);
       tree new_rhs = build1 (NOP_EXPR, TREE_TYPE (new_lhs), rhs);
-      modify_expr = build2 (MODIFY_EXPR, TREE_TYPE (new_lhs),
+      modify_expr = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (new_lhs),
 			    new_lhs, new_rhs);
       modify_expr = build1 (NOP_EXPR, lhs_type, modify_expr);
     }
@@ -424,7 +427,7 @@ java_gimplify_new_array_init (tree exp)
 
   tree array_ptr_type = build_pointer_type (array_type);
   tree tmp = create_tmp_var (array_ptr_type, "array");
-  tree body = build2 (MODIFY_EXPR, array_ptr_type, tmp,
+  tree body = build2 (GIMPLE_MODIFY_STMT, array_ptr_type, tmp,
 		      build_new_array (element_type, length));
 
   int index = 0;
@@ -437,7 +440,7 @@ java_gimplify_new_array_init (tree exp)
       tree lhs = build3 (COMPONENT_REF, TREE_TYPE (data_field),    
 			 build_java_indirect_ref (array_type, tmp, 0),
 			 data_field, NULL_TREE);
-      tree assignment = build2 (MODIFY_EXPR, element_type,
+      tree assignment = build2 (GIMPLE_MODIFY_STMT, element_type,
 				build4 (ARRAY_REF, element_type, lhs,
 					build_int_cst (NULL_TREE, index++),
 					NULL_TREE, NULL_TREE),


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]