OSDN Git Service

2005-04-28 Andrew Haley <aph@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / java / expr.c
index ae1055e..3cc33ae 100644 (file)
@@ -2715,7 +2715,8 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
     }
 
   field_ref = build_field_ref (field_ref, self_type, field_name);
-  if (is_static)
+  if (is_static
+      && ! flag_indirect_dispatch)
     field_ref = build_class_init (self_type, field_ref);
   if (is_putting)
     {
@@ -3484,7 +3485,8 @@ maybe_adjust_start_pc (struct JCF *jcf, int code_offset,
    For method invocation, we modify the arguments so that a
    left-to-right order evaluation is performed. Saved expressions
    will, in CALL_EXPR order, be reused when the call will be expanded.
-*/
+
+   We also promote outgoing args if needed.  */
 
 tree
 force_evaluation_order (tree node)
@@ -3518,6 +3520,15 @@ force_evaluation_order (tree node)
       /* This reverses the evaluation order. This is a desired effect. */
       for (cmp = NULL_TREE; arg; arg = TREE_CHAIN (arg))
        {
+         /* Promote types smaller than integer.  This is required by
+            some ABIs.  */
+         tree type = TREE_TYPE (TREE_VALUE (arg));
+         if (targetm.calls.promote_prototypes (type)
+             && INTEGRAL_TYPE_P (type)
+             && INT_CST_LT_UNSIGNED (TYPE_SIZE (type),
+                                     TYPE_SIZE (integer_type_node)))
+           TREE_VALUE (arg) = fold_convert (integer_type_node, TREE_VALUE (arg));
+
          tree saved = save_expr (force_evaluation_order (TREE_VALUE (arg)));
          cmp = (cmp == NULL_TREE ? saved :
                 build2 (COMPOUND_EXPR, void_type_node, cmp, saved));