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]

jc1 patch to remove BLOCK_EXPR_ORIGIN


This patch removes BLOCK_EXPR_ORIGIN, which was used in an implied
block (i.e. a declaration in the middle of a block) to point to
the surounding explicit block.  There was no need for such a pointer,
and using a flag seems cleaner.

In the future we may want to clean up BLOCK handling, by either
merging the parser-blocks (allocated by enter_block) with those
allocated at expand-time (by poplevel), or by using BIND_EXPR for the
former; in either case it is better to use a flag than
BLOCK_EXPR_ORIGIN (which used the same field a BLOCK_ABSTRACT_ORIGIN).

This is the last of tonight's set of patches.  I don't know which
one fixed the duplicate LBB0/LBE0 labels problem, but it seems to
be fixed, and this seems to be the only patch that could conceivably
explain it!  I have checked it in.

2001-03-15  Per Bothner  <per@bothner.com>

	* java-tree.h (BLOCK_IS_IMPLICIT):  New flag.
	* parse.h (BLOCK_EXPR_ORIGIN):  Removed macro.
	* parse.y (declare_local_variables, maybe_absorb_scoping_blocks):
	Use BLOCK_IS_IMPLICIT rather than BLOCK_EXPR_ORIGIN.

Index: java-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-tree.h,v
retrieving revision 1.101
diff -u -p -r1.101 java-tree.h
--- java-tree.h	2001/03/06 07:29:30	1.101
+++ java-tree.h	2001/03/16 06:14:17
@@ -48,6 +48,7 @@ struct JCF;
       IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
       COMPOUND_ASSIGN_P (in EXPR (binop_*))
       LOCAL_CLASS_P (in RECORD_TYPE)
+      BLOCK_IS_IMPLICIT (in BLOCK)
    2: RETURN_MAP_ADJUSTED (in TREE_VEC).
       QUALIFIED_P (in IDENTIFIER_NODE)
       PRIMARY_P (in EXPR_WITH_FILE_LOCATION)
@@ -1501,6 +1502,8 @@ extern tree *type_map;
 
 #define BLOCK_EXPR_DECLS(NODE)  BLOCK_VARS(NODE)
 #define BLOCK_EXPR_BODY(NODE)   BLOCK_SUBBLOCKS(NODE)
+/* True for an implicit block surrounding declaration not at start of {...}. */
+#define BLOCK_IS_IMPLICIT(NODE) TREE_LANG_FLAG_1 (NODE)
 
 #define BUILD_MONITOR_ENTER(WHERE, ARG)				\
   {								\
Index: parse.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.h,v
retrieving revision 1.65
diff -u -p -r1.65 parse.h
--- parse.h	2001/02/24 03:36:22	1.65
+++ parse.h	2001/03/16 06:14:18
@@ -603,10 +603,6 @@ typedef struct _jdeplist {
 #define GET_CURRENT_BLOCK(F) ((F) ? DECL_FUNCTION_BODY ((F)) :	\
 			     current_static_block)
 
-/* For an artificial BLOCK (created to house a local variable declaration not
-   at the start of an existing block), the parent block;  otherwise NULL. */
-#define BLOCK_EXPR_ORIGIN(NODE) BLOCK_ABSTRACT_ORIGIN(NODE)
-
 /* Merge an other line to the source line number of a decl. Used to
    remember function's end. */
 #define DECL_SOURCE_LINE_MERGE(DECL,NO) DECL_SOURCE_LINE(DECL) |= (NO << 16)
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.260
diff -u -p -r1.260 parse.y
--- parse.y	2001/03/16 06:12:53	1.260
+++ parse.y	2001/03/16 06:14:26
@@ -6909,12 +6909,11 @@ declare_local_variables (modifier, type,
   int final_p = 0;
 
   /* Push a new block if statements were seen between the last time we
-     pushed a block and now. Keep a cound of block to close */
+     pushed a block and now. Keep a count of blocks to close */
   if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl)))
     {
-      tree body = GET_CURRENT_BLOCK (current_function_decl);
       tree b = enter_block ();
-      BLOCK_EXPR_ORIGIN (b) = body;
+      BLOCK_IS_IMPLICIT (b) = 1;
     }
 
   if (modifier)
@@ -11962,7 +11961,7 @@ lookup_name_in_blocks (name)
 static void
 maybe_absorb_scoping_blocks ()
 {
-  while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl)))
+  while (BLOCK_IS_IMPLICIT (GET_CURRENT_BLOCK (current_function_decl)))
     {
       tree b = exit_block ();
       java_method_add_stmt (current_function_decl, b);

-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/


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