aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2005-04-29 18:43:25 +0000
committerAndrew Haley <aph@gcc.gnu.org>2005-04-29 18:43:25 +0000
commit2c80f015490c820ec71549975d6276b41ed9ae4c (patch)
tree158742ad984de1e20c807a73f81b51044ae5edee /gcc/java/expr.c
parenta68b179c86764d41292502567a7b1252f4e57eae (diff)
downloadgcc-2c80f015490c820ec71549975d6276b41ed9ae4c.zip
gcc-2c80f015490c820ec71549975d6276b41ed9ae4c.tar.gz
gcc-2c80f015490c820ec71549975d6276b41ed9ae4c.tar.bz2
re PR java/19285 (Interfaces not initialized by static field access)
2005-04-28 Andrew Haley <aph@redhat.com> PR java/19285 * java-tree.h (soft_resolvepoolentry_node): New. (alloc_constant_fieldref): Declare. * expr.c (expand_java_field_op): Don't call class_init for accesses to static fields with indirect dispatch. * builtins.c (initialize_builtins): Add "__builtin_expect". * decl.c (soft_resolvepoolentry_node): New variable. (java_init_decl_processing): Create a decl for "_Jv_ResolvePoolEntry". * class.c (build_fieldref_cache_entry): New function. (build_static_field_ref): Rewrite for indirect dispatch. * constants.c (find_name_and_type_constant_tree): New function. (alloc_constant_fieldref): Likewise. (build_constants_constructor): Handle CONSTANT_Fieldref and CONSTANT_NameAndType. PR java/21115 * expr.c (force_evaluation_order): Convert outgoing args smaller than integer. From-SVN: r99010
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r--gcc/java/expr.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index ae1055e..3cc33ae 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -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));