This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

[Java] Replace build with buildN in gcj front-end


This patch is the second and final patch to transition the gcc/java/
directory from using the middle-end function "build", to using the
now preferred buildN functions (i.e. build0, build1, build2, etc...).
After this patch there should be no remaining uses of "build" in the
java subdirectory.  There are absolutely no functionality changes
with this patch.


The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", including java, and tested with a top-level "make
-k check" with no new failures.

Ok for mainline?


2004-07-17  Roger Sayle  <roger@eyesopen.com>

	* builtins.c (max_builtin, min_builtin,
	java_build_function_call_expr): Replace calls to build with buildN.
	* class.c (build_class_ref, build_static_field_ref,
	get_dispatch_table, make_class_data, layout_class_method): Likewise.
	* constants.c (build_ref_from_constant_pool): Likewise.
	* decl.c (update_aliases, push_jvm_slot, poplevel, finish_method,
	add_stmt_to_compound): Likewise.
	* except.c (build_exception_object_ref, expand_end_java_handler):
	Likewise.
	* java-gimplify.c (java_gimplify_case_expr,
	java_gimplify_default_expr, java_gimplify_block,
	java_gimplify_new_array_init, java_gimplify_try_expr): Likewise.
	* jcf-write.c (generate_bytecode_insns): Likewise.
	* typeck.c (convert_ieee_real_to_integer): Likewise.


Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/builtins.c,v
retrieving revision 1.24
diff -c -3 -p -r1.24 builtins.c
*** builtins.c	13 May 2004 06:40:34 -0000	1.24
--- builtins.c	17 Jul 2004 16:49:51 -0000
*************** static GTY(()) struct builtin_record jav
*** 96,112 ****
  static tree
  max_builtin (tree method_return_type, tree method_arguments)
  {
!   return fold (build (MAX_EXPR, method_return_type,
! 		      TREE_VALUE (method_arguments),
! 		      TREE_VALUE (TREE_CHAIN (method_arguments))));
  }

  static tree
  min_builtin (tree method_return_type, tree method_arguments)
  {
!   return fold (build (MIN_EXPR, method_return_type,
! 		      TREE_VALUE (method_arguments),
! 		      TREE_VALUE (TREE_CHAIN (method_arguments))));
  }

  static tree
--- 96,112 ----
  static tree
  max_builtin (tree method_return_type, tree method_arguments)
  {
!   return fold (build2 (MAX_EXPR, method_return_type,
! 		       TREE_VALUE (method_arguments),
! 		       TREE_VALUE (TREE_CHAIN (method_arguments))));
  }

  static tree
  min_builtin (tree method_return_type, tree method_arguments)
  {
!   return fold (build2 (MIN_EXPR, method_return_type,
! 		       TREE_VALUE (method_arguments),
! 		       TREE_VALUE (TREE_CHAIN (method_arguments))));
  }

  static tree
*************** java_build_function_call_expr (tree fn,
*** 123,130 ****
    tree call_expr;

    call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
!   call_expr = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)),
! 		     call_expr, arglist, NULL_TREE);
    TREE_SIDE_EFFECTS (call_expr) = 1;
    return fold (call_expr);
  }
--- 123,130 ----
    tree call_expr;

    call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
!   call_expr = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)),
! 		      call_expr, arglist, NULL_TREE);
    TREE_SIDE_EFFECTS (call_expr) = 1;
    return fold (call_expr);
  }
Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.198
diff -c -3 -p -r1.198 class.c
*** class.c	10 Jul 2004 15:53:40 -0000	1.198
--- class.c	17 Jul 2004 16:49:52 -0000
*************** build_class_ref (tree type)
*** 1050,1057 ****
  		abort ();

  	      prim_class = lookup_class (get_identifier (prim_class_name));
! 	      return build (COMPONENT_REF, NULL_TREE,
! 			    prim_class, TYPE_identifier_node, NULL_TREE);
  	    }
  	  decl_name = TYPE_NAME (type);
  	  if (TREE_CODE (decl_name) == TYPE_DECL)
--- 1050,1057 ----
  		abort ();

  	      prim_class = lookup_class (get_identifier (prim_class_name));
! 	      return build3 (COMPONENT_REF, NULL_TREE,
! 			     prim_class, TYPE_identifier_node, NULL_TREE);
  	    }
  	  decl_name = TYPE_NAME (type);
  	  if (TREE_CODE (decl_name) == TYPE_DECL)
*************** build_static_field_ref (tree fdecl)
*** 1115,1123 ****
  	= build_int_2 (get_symbol_table_index
  		       (fdecl, &TYPE_ATABLE_METHODS (output_class)), 0);
        tree field_address
! 	= build (ARRAY_REF, build_pointer_type (TREE_TYPE (fdecl)),
! 		 TYPE_ATABLE_DECL (output_class), table_index,
! 		 NULL_TREE, NULL_TREE);
        return fold (build1 (INDIRECT_REF, TREE_TYPE (fdecl),
  			   field_address));
      }
--- 1115,1123 ----
  	= build_int_2 (get_symbol_table_index
  		       (fdecl, &TYPE_ATABLE_METHODS (output_class)), 0);
        tree field_address
! 	= build4 (ARRAY_REF, build_pointer_type (TREE_TYPE (fdecl)),
! 		  TYPE_ATABLE_DECL (output_class), table_index,
! 		  NULL_TREE, NULL_TREE);
        return fold (build1 (INDIRECT_REF, TREE_TYPE (fdecl),
  			   field_address));
      }
*************** build_static_field_ref (tree fdecl)
*** 1129,1137 ****
        tree fld;
        int field_index = 0;
        ref = build1 (INDIRECT_REF, class_type_node, ref);
!       ref = build (COMPONENT_REF, field_ptr_type_node, ref,
! 		   lookup_field (&class_type_node, fields_ident),
! 		   NULL_TREE);

        for (fld = TYPE_FIELDS (fclass); ; fld = TREE_CHAIN (fld))
  	{
--- 1129,1137 ----
        tree fld;
        int field_index = 0;
        ref = build1 (INDIRECT_REF, class_type_node, ref);
!       ref = build3 (COMPONENT_REF, field_ptr_type_node, ref,
! 		    lookup_field (&class_type_node, fields_ident),
! 		    NULL_TREE);

        for (fld = TYPE_FIELDS (fclass); ; fld = TREE_CHAIN (fld))
  	{
*************** build_static_field_ref (tree fdecl)
*** 1144,1158 ****
  	    field_index++;
  	}
        field_index *= int_size_in_bytes (field_type_node);
!       ref = fold (build (PLUS_EXPR, field_ptr_type_node,
! 			 ref, build_int_2 (field_index, 0)));
        ref = build1 (INDIRECT_REF, field_type_node, ref);
!       ref = build (COMPONENT_REF, field_info_union_node,
! 		   ref, lookup_field (&field_type_node, info_ident),
! 		   NULL_TREE);
!       ref = build (COMPONENT_REF, ptr_type_node,
! 		   ref, TREE_CHAIN (TYPE_FIELDS (field_info_union_node)),
! 		   NULL_TREE);
        ref = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (fdecl)), ref);
        return fold (build1 (INDIRECT_REF, TREE_TYPE(fdecl), ref));
      }
--- 1144,1158 ----
  	    field_index++;
  	}
        field_index *= int_size_in_bytes (field_type_node);
!       ref = fold (build2 (PLUS_EXPR, field_ptr_type_node,
! 			  ref, build_int_2 (field_index, 0)));
        ref = build1 (INDIRECT_REF, field_type_node, ref);
!       ref = build3 (COMPONENT_REF, field_info_union_node,
! 		    ref, lookup_field (&field_type_node, info_ident),
! 		    NULL_TREE);
!       ref = build3 (COMPONENT_REF, ptr_type_node,
! 		    ref, TREE_CHAIN (TYPE_FIELDS (field_info_union_node)),
! 		    NULL_TREE);
        ref = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (fdecl)), ref);
        return fold (build1 (INDIRECT_REF, TREE_TYPE(fdecl), ref));
      }
*************** get_dispatch_table (tree type, tree this
*** 1421,1428 ****
  	  if (TARGET_VTABLE_USES_DESCRIPTORS)
  	    for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; ++j)
  	      {
! 		tree fdesc = build (FDESC_EXPR, nativecode_ptr_type_node,
! 				    method, build_int_2 (j, 0));
  		TREE_CONSTANT (fdesc) = 1;
  		TREE_INVARIANT (fdesc) = 1;
  	        list = tree_cons (NULL_TREE, fdesc, list);
--- 1421,1428 ----
  	  if (TARGET_VTABLE_USES_DESCRIPTORS)
  	    for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; ++j)
  	      {
! 		tree fdesc = build2 (FDESC_EXPR, nativecode_ptr_type_node,
! 				     method, build_int_2 (j, 0));
  		TREE_CONSTANT (fdesc) = 1;
  		TREE_INVARIANT (fdesc) = 1;
  	        list = tree_cons (NULL_TREE, fdesc, list);
*************** make_class_data (tree type)
*** 1712,1720 ****

    START_RECORD_CONSTRUCTOR (temp, object_type_node);
    PUSH_FIELD_VALUE (temp, "vtable",
! 		    build (PLUS_EXPR, dtable_ptr_type,
! 			   build1 (ADDR_EXPR, dtable_ptr_type, class_dtable_decl),
! 			   dtable_start_offset));
    if (! flag_hash_synchronization)
      PUSH_FIELD_VALUE (temp, "sync_info", null_pointer_node);
    FINISH_RECORD_CONSTRUCTOR (temp);
--- 1712,1721 ----

    START_RECORD_CONSTRUCTOR (temp, object_type_node);
    PUSH_FIELD_VALUE (temp, "vtable",
! 		    build2 (PLUS_EXPR, dtable_ptr_type,
! 			    build1 (ADDR_EXPR, dtable_ptr_type,
! 				    class_dtable_decl),
! 			    dtable_start_offset));
    if (! flag_hash_synchronization)
      PUSH_FIELD_VALUE (temp, "sync_info", null_pointer_node);
    FINISH_RECORD_CONSTRUCTOR (temp);
*************** make_class_data (tree type)
*** 1750,1758 ****
    else
      PUSH_FIELD_VALUE (cons, "vtable",
  		      dtable_decl == NULL_TREE ? null_pointer_node
! 		      : build (PLUS_EXPR, dtable_ptr_type,
! 			       build1 (ADDR_EXPR, dtable_ptr_type, dtable_decl),
! 			       dtable_start_offset));
    if (TYPE_OTABLE_METHODS (type) == NULL_TREE)
      {
        PUSH_FIELD_VALUE (cons, "otable", null_pointer_node);
--- 1751,1760 ----
    else
      PUSH_FIELD_VALUE (cons, "vtable",
  		      dtable_decl == NULL_TREE ? null_pointer_node
! 		      : build2 (PLUS_EXPR, dtable_ptr_type,
! 				build1 (ADDR_EXPR, dtable_ptr_type,
! 					dtable_decl),
! 				dtable_start_offset));
    if (TYPE_OTABLE_METHODS (type) == NULL_TREE)
      {
        PUSH_FIELD_VALUE (cons, "otable", null_pointer_node);
*************** layout_class_method (tree this_class, tr
*** 2274,2281 ****
  	       && dtable_count)
  	{
  	  set_method_index (method_decl, dtable_count);
! 	  dtable_count = fold (build (PLUS_EXPR, integer_type_node,
! 				      dtable_count, integer_one_node));
  	}
      }

--- 2276,2283 ----
  	       && dtable_count)
  	{
  	  set_method_index (method_decl, dtable_count);
! 	  dtable_count = fold (build2 (PLUS_EXPR, integer_type_node,
! 				       dtable_count, integer_one_node));
  	}
      }

Index: constants.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/constants.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 constants.c
*** constants.c	27 Jun 2004 18:16:48 -0000	1.36
--- constants.c	17 Jul 2004 16:49:52 -0000
*************** build_ref_from_constant_pool (int index)
*** 425,432 ****
  {
    tree d = build_constant_data_ref ();
    tree i = build_int_2 (index, 0);
!   return build (ARRAY_REF, TREE_TYPE (TREE_TYPE (d)), d, i,
! 		NULL_TREE, NULL_TREE);
  }

  /* Build an initializer for the constants field of the current constant pool.
--- 425,432 ----
  {
    tree d = build_constant_data_ref ();
    tree i = build_int_2 (index, 0);
!   return build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (d)), d, i,
! 		 NULL_TREE, NULL_TREE);
  }

  /* Build an initializer for the constants field of the current constant pool.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.187
diff -c -3 -p -r1.187 decl.c
*** decl.c	11 Jul 2004 09:53:05 -0000	1.187
--- decl.c	17 Jul 2004 16:49:52 -0000
*************** update_aliases (tree decl, int index)
*** 113,120 ****
  	  && TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (tmp)))
  	{
  	  tree src = build1 (NOP_EXPR, TREE_TYPE (tmp), decl);
! 	  java_add_stmt
! 	    (build (MODIFY_EXPR, TREE_TYPE (tmp), tmp, src));
  	}
        tmp = DECL_LOCAL_SLOT_CHAIN (tmp);
      }
--- 113,119 ----
  	  && TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (tmp)))
  	{
  	  tree src = build1 (NOP_EXPR, TREE_TYPE (tmp), decl);
! 	  java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (tmp), tmp, src));
  	}
        tmp = DECL_LOCAL_SLOT_CHAIN (tmp);
      }
*************** push_jvm_slot (int index, tree decl)
*** 139,146 ****
  	  /* At the point of its creation this decl inherits whatever
  	     is in the slot.  */
  	  tree src = build1 (NOP_EXPR, TREE_TYPE (decl), tmp);
! 	  java_add_stmt
! 	    (build (MODIFY_EXPR, TREE_TYPE (decl), decl, src));
  	  break;
  	}
        tmp = DECL_LOCAL_SLOT_CHAIN (tmp);
--- 138,144 ----
  	  /* At the point of its creation this decl inherits whatever
  	     is in the slot.  */
  	  tree src = build1 (NOP_EXPR, TREE_TYPE (decl), tmp);
! 	  java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (decl), decl, src));
  	  break;
  	}
        tmp = DECL_LOCAL_SLOT_CHAIN (tmp);
*************** poplevel (int keep, int reverse, int fun
*** 1345,1351 ****
  	    }
  	  *var = NULL;

! 	  bind =  build (BIND_EXPR, TREE_TYPE (block), BLOCK_VARS (block),
  			 BLOCK_EXPR_BODY (block), block);
  	  BIND_EXPR_BODY (bind) = current_binding_level->stmts;

--- 1343,1349 ----
  	    }
  	  *var = NULL;

! 	  bind = build3 (BIND_EXPR, TREE_TYPE (block), BLOCK_VARS (block),
  			 BLOCK_EXPR_BODY (block), block);
  	  BIND_EXPR_BODY (bind) = current_binding_level->stmts;

*************** finish_method (tree fndecl)
*** 1800,1808 ****
  	lock = DECL_ARGUMENTS (fndecl);
        BUILD_MONITOR_ENTER (enter, lock);
        BUILD_MONITOR_EXIT (exit, lock);
!       *tp = build (COMPOUND_EXPR, void_type_node,
! 		   enter,
! 		   build (TRY_FINALLY_EXPR, void_type_node, *tp, exit));
      }

    /* Prepend class initialization for static methods reachable from
--- 1798,1805 ----
  	lock = DECL_ARGUMENTS (fndecl);
        BUILD_MONITOR_ENTER (enter, lock);
        BUILD_MONITOR_EXIT (exit, lock);
!       *tp = build2 (COMPOUND_EXPR, void_type_node, enter,
! 		    build2 (TRY_FINALLY_EXPR, void_type_node, *tp, exit));
      }

    /* Prepend class initialization for static methods reachable from
*************** finish_method (tree fndecl)
*** 1812,1822 ****
        && ! CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (fndecl))))
      {
        tree clas = DECL_CONTEXT (fndecl);
!       tree init = build (CALL_EXPR, void_type_node,
! 			 build_address_of (soft_initclass_node),
! 			 build_tree_list (NULL_TREE, build_class_ref (clas)),
! 			 NULL_TREE);
!       *tp = build (COMPOUND_EXPR, TREE_TYPE (*tp), init, *tp);
      }

    /* Convert function tree to GENERIC prior to inlining.  */
--- 1809,1819 ----
        && ! CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (fndecl))))
      {
        tree clas = DECL_CONTEXT (fndecl);
!       tree init = build3 (CALL_EXPR, void_type_node,
! 			  build_address_of (soft_initclass_node),
! 			  build_tree_list (NULL_TREE, build_class_ref (clas)),
! 			  NULL_TREE);
!       *tp = build2 (COMPOUND_EXPR, TREE_TYPE (*tp), init, *tp);
      }

    /* Convert function tree to GENERIC prior to inlining.  */
*************** add_stmt_to_compound (tree existing, tre
*** 1881,1889 ****
      return existing;
    else if (existing)
      {
!       tree expr = build (COMPOUND_EXPR, type, existing, stmt);
!       TREE_SIDE_EFFECTS (expr)
! 	= TREE_SIDE_EFFECTS (existing) | TREE_SIDE_EFFECTS (stmt);
        return expr;
      }
    else
--- 1878,1886 ----
      return existing;
    else if (existing)
      {
!       tree expr = build2 (COMPOUND_EXPR, type, existing, stmt);
!       TREE_SIDE_EFFECTS (expr) = TREE_SIDE_EFFECTS (existing)
! 				 | TREE_SIDE_EFFECTS (stmt);
        return expr;
      }
    else
Index: except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/except.c,v
retrieving revision 1.44
diff -c -3 -p -r1.44 except.c
*** except.c	29 Jun 2004 16:18:46 -0000	1.44
--- except.c	17 Jul 2004 16:49:52 -0000
*************** build_exception_object_ref (tree type)
*** 412,420 ****

    /* Java only passes object via pointer and doesn't require adjusting.
       The java object is immediately before the generic exception header.  */
!   obj = build (EXC_PTR_EXPR, build_pointer_type (type));
!   obj = build (MINUS_EXPR, TREE_TYPE (obj), obj,
! 	       TYPE_SIZE_UNIT (TREE_TYPE (obj)));
    obj = build1 (INDIRECT_REF, type, obj);

    return obj;
--- 412,420 ----

    /* Java only passes object via pointer and doesn't require adjusting.
       The java object is immediately before the generic exception header.  */
!   obj = build0 (EXC_PTR_EXPR, build_pointer_type (type));
!   obj = build2 (MINUS_EXPR, TREE_TYPE (obj), obj,
! 		TYPE_SIZE_UNIT (TREE_TYPE (obj)));
    obj = build1 (INDIRECT_REF, type, obj);

    return obj;
*************** expand_end_java_handler (struct eh_range
*** 441,451 ****
        type = prepare_eh_table_type (type);

        {
! 	tree catch_expr
! 	  = build (CATCH_EXPR, void_type_node, type,
! 		   build (GOTO_EXPR, void_type_node, TREE_VALUE (handler)));
! 	tree try_catch_expr = build (TRY_CATCH_EXPR, void_type_node,
! 				     *get_stmts (), catch_expr);
  	*get_stmts () = try_catch_expr;
        }
      }
--- 441,451 ----
        type = prepare_eh_table_type (type);

        {
! 	tree catch_expr = build2 (CATCH_EXPR, void_type_node, type,
! 				  build1 (GOTO_EXPR, void_type_node,
! 					  TREE_VALUE (handler)));
! 	tree try_catch_expr = build2 (TRY_CATCH_EXPR, void_type_node,
! 				      *get_stmts (), catch_expr);
  	*get_stmts () = try_catch_expr;
        }
      }
Index: java-gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-gimplify.c,v
retrieving revision 1.6
diff -c -3 -p -r1.6 java-gimplify.c
*** java-gimplify.c	22 Jun 2004 03:07:04 -0000	1.6
--- java-gimplify.c	17 Jul 2004 16:49:52 -0000
*************** static tree
*** 144,158 ****
  java_gimplify_case_expr (tree expr)
  {
    tree label = create_artificial_label ();
!   return build (CASE_LABEL_EXPR, void_type_node,
! 		TREE_OPERAND (expr, 0), NULL_TREE, label);
  }

  static tree
  java_gimplify_default_expr (tree expr ATTRIBUTE_UNUSED)
  {
    tree label = create_artificial_label ();
!   return build (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE, label);
  }

  /* Gimplify BLOCK into a BIND_EXPR.  */
--- 144,158 ----
  java_gimplify_case_expr (tree expr)
  {
    tree label = create_artificial_label ();
!   return build3 (CASE_LABEL_EXPR, void_type_node,
! 		 TREE_OPERAND (expr, 0), NULL_TREE, label);
  }

  static tree
  java_gimplify_default_expr (tree expr ATTRIBUTE_UNUSED)
  {
    tree label = create_artificial_label ();
!   return build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE, label);
  }

  /* Gimplify BLOCK into a BIND_EXPR.  */
*************** java_gimplify_block (tree java_block)
*** 187,193 ****
        BLOCK_SUBBLOCKS (outer) = chainon (BLOCK_SUBBLOCKS (outer), block);
      }

!   return build (BIND_EXPR, TREE_TYPE (java_block), decls, body, block);
  }

  /* Gimplify a NEW_ARRAY_INIT node into array/element assignments.  */
--- 187,193 ----
        BLOCK_SUBBLOCKS (outer) = chainon (BLOCK_SUBBLOCKS (outer), block);
      }

!   return build3 (BIND_EXPR, TREE_TYPE (java_block), decls, body, block);
  }

  /* Gimplify a NEW_ARRAY_INIT node into array/element assignments.  */
*************** java_gimplify_new_array_init (tree exp)
*** 204,214 ****
    tree values = CONSTRUCTOR_ELTS (init);

    tree array_ptr_type = build_pointer_type (array_type);
!   tree block = build (BLOCK, array_ptr_type);
    tree tmp = build_decl (VAR_DECL, get_identifier ("<tmp>"), array_ptr_type);
!   tree array = build_decl (VAR_DECL, get_identifier ("<array>"), array_ptr_type);
!   tree body = build (MODIFY_EXPR, array_ptr_type, tmp,
! 		     build_new_array (element_type, length));

    int index = 0;

--- 204,215 ----
    tree values = CONSTRUCTOR_ELTS (init);

    tree array_ptr_type = build_pointer_type (array_type);
!   tree block = build0 (BLOCK, array_ptr_type);
    tree tmp = build_decl (VAR_DECL, get_identifier ("<tmp>"), array_ptr_type);
!   tree array = build_decl (VAR_DECL, get_identifier ("<array>"),
! 			   array_ptr_type);
!   tree body = build2 (MODIFY_EXPR, array_ptr_type, tmp,
! 		      build_new_array (element_type, length));

    int index = 0;

*************** java_gimplify_new_array_init (tree exp)
*** 220,239 ****
      {
        /* FIXME: Should use build_java_arrayaccess here, but avoid
  	 bounds checking.  */
!       tree lhs = build (COMPONENT_REF, TREE_TYPE (data_field),
! 			build_java_indirect_ref (array_type, tmp, 0),
! 			data_field, NULL_TREE);
!       tree assignment = build (MODIFY_EXPR, element_type,
!   			       build (ARRAY_REF, element_type, lhs,
! 				      build_int_2 (index++, 0),
! 				      NULL_TREE, NULL_TREE),
! 			       TREE_VALUE (values));
!       body = build (COMPOUND_EXPR, element_type, body, assignment);
        values = TREE_CHAIN (values);
      }

!   body = build (COMPOUND_EXPR, array_ptr_type, body,
! 		build (MODIFY_EXPR, array_ptr_type, array, tmp));
    TREE_CHAIN (tmp) = array;
    BLOCK_VARS (block) = tmp;
    BLOCK_EXPR_BODY (block) = body;
--- 221,240 ----
      {
        /* FIXME: Should use build_java_arrayaccess here, but avoid
  	 bounds checking.  */
!       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,
! 				build4 (ARRAY_REF, element_type, lhs,
! 					build_int_2 (index++, 0),
! 					NULL_TREE, NULL_TREE),
! 				TREE_VALUE (values));
!       body = build2 (COMPOUND_EXPR, element_type, body, assignment);
        values = TREE_CHAIN (values);
      }

!   body = build2 (COMPOUND_EXPR, array_ptr_type, body,
! 		 build2 (MODIFY_EXPR, array_ptr_type, array, tmp));
    TREE_CHAIN (tmp) = array;
    BLOCK_VARS (block) = tmp;
    BLOCK_EXPR_BODY (block) = body;
*************** java_gimplify_try_expr (tree try_expr)
*** 252,267 ****
      {
        tree java_catch = TREE_OPERAND (handler, 0);
        tree catch_type = TREE_TYPE (TREE_TYPE (BLOCK_EXPR_DECLS (java_catch)));
!       tree expr = build (CATCH_EXPR, void_type_node,
! 			 prepare_eh_table_type (catch_type),
! 			 handler);
        if (catch)
! 	catch = build (COMPOUND_EXPR, void_type_node, catch, expr);
        else
  	catch = expr;
        handler = TREE_CHAIN (handler);
      }
!   return build (TRY_CATCH_EXPR, void_type_node, body, catch);
  }

  /* Dump a tree of some kind.  This is a convenience wrapper for the
--- 253,268 ----
      {
        tree java_catch = TREE_OPERAND (handler, 0);
        tree catch_type = TREE_TYPE (TREE_TYPE (BLOCK_EXPR_DECLS (java_catch)));
!       tree expr = build2 (CATCH_EXPR, void_type_node,
! 			  prepare_eh_table_type (catch_type),
! 			  handler);
        if (catch)
! 	catch = build2 (COMPOUND_EXPR, void_type_node, catch, expr);
        else
  	catch = expr;
        handler = TREE_CHAIN (handler);
      }
!   return build2 (TRY_CATCH_EXPR, void_type_node, body, catch);
  }

  /* Dump a tree of some kind.  This is a convenience wrapper for the
Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.151
diff -c -3 -p -r1.151 jcf-write.c
*** jcf-write.c	10 Jul 2004 05:38:15 -0000	1.151
--- jcf-write.c	17 Jul 2004 16:49:53 -0000
*************** generate_bytecode_insns (tree exp, int t
*** 2067,2074 ****

  	    /* This function correctly handles the case where the LHS
  	       of a binary expression is NULL_TREE.  */
! 	    rhs = build (TREE_CODE (rhs), TREE_TYPE (rhs),
! 			 NULL_TREE, TREE_OPERAND (rhs, 1));
  	  }

  	generate_bytecode_insns (rhs, STACK_TARGET, state);
--- 2067,2074 ----

  	    /* This function correctly handles the case where the LHS
  	       of a binary expression is NULL_TREE.  */
! 	    rhs = build2 (TREE_CODE (rhs), TREE_TYPE (rhs),
! 			  NULL_TREE, TREE_OPERAND (rhs, 1));
  	  }

  	generate_bytecode_insns (rhs, STACK_TARGET, state);
*************** generate_bytecode_insns (tree exp, int t
*** 2490,2498 ****
  	tree x;
  	if (TREE_SIDE_EFFECTS (op0) || TREE_SIDE_EFFECTS (op1))
  	  abort ();
! 	x = build (COND_EXPR, TREE_TYPE (exp),
! 		   build (code, boolean_type_node, op0, op1),
! 		   op0, op1);
  	generate_bytecode_insns (x, target, state);
  	break;
        }
--- 2490,2498 ----
  	tree x;
  	if (TREE_SIDE_EFFECTS (op0) || TREE_SIDE_EFFECTS (op1))
  	  abort ();
! 	x = build3 (COND_EXPR, TREE_TYPE (exp),
! 		    build2 (code, boolean_type_node, op0, op1),
! 		    op0, op1);
  	generate_bytecode_insns (x, target, state);
  	break;
        }
Index: typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/typeck.c,v
retrieving revision 1.65
diff -c -3 -p -r1.65 typeck.c
*** typeck.c	7 Jul 2004 10:21:03 -0000	1.65
--- typeck.c	17 Jul 2004 16:49:53 -0000
*************** convert_ieee_real_to_integer (tree type,
*** 83,104 ****
    tree result;
    expr = save_expr (expr);

!   result = build (COND_EXPR, type,
! 		  build (NE_EXPR, boolean_type_node, expr, expr),
! 		  convert (type, integer_zero_node),
! 		  convert_to_integer (type, expr));

!   result = build (COND_EXPR, type,
! 		  build (LE_EXPR, boolean_type_node, expr,
! 			 convert (TREE_TYPE (expr), TYPE_MIN_VALUE (type))),
! 		  TYPE_MIN_VALUE (type),
! 		  result);
!
!   result = build (COND_EXPR, type,
! 		  build (GE_EXPR, boolean_type_node, expr,
! 			 convert (TREE_TYPE (expr), TYPE_MAX_VALUE (type))),
! 		  TYPE_MAX_VALUE (type),
! 		  result);

    return result;
  }
--- 83,104 ----
    tree result;
    expr = save_expr (expr);

!   result = build3 (COND_EXPR, type,
! 		   build2 (NE_EXPR, boolean_type_node, expr, expr),
! 		   convert (type, integer_zero_node),
! 		   convert_to_integer (type, expr));

!   result = build3 (COND_EXPR, type,
! 		   build2 (LE_EXPR, boolean_type_node, expr,
! 			   convert (TREE_TYPE (expr), TYPE_MIN_VALUE (type))),
! 		   TYPE_MIN_VALUE (type),
! 		   result);
!
!   result = build3 (COND_EXPR, type,
! 		   build2 (GE_EXPR, boolean_type_node, expr,
! 			   convert (TREE_TYPE (expr), TYPE_MAX_VALUE (type))),
! 		   TYPE_MAX_VALUE (type),
! 		   result);

    return result;
  }


Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833


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