aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/constants.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/java/constants.c')
-rw-r--r--gcc/java/constants.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/java/constants.c b/gcc/java/constants.c
index 5d2f678..2f4c053 100644
--- a/gcc/java/constants.c
+++ b/gcc/java/constants.c
@@ -458,8 +458,29 @@ build_ref_from_constant_pool (int index)
{
tree d = build_constant_data_ref ();
tree i = build_int_cst (NULL_TREE, index);
- return build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (d)), d, i,
+ if (flag_indirect_classes)
+ {
+ tree decl = build_class_ref (output_class);
+ tree klass = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (decl)),
+ decl);
+ tree constants = build3 (COMPONENT_REF,
+ TREE_TYPE (constants_field_decl_node), klass,
+ constants_field_decl_node,
+ NULL_TREE);
+ tree data = build3 (COMPONENT_REF,
+ TREE_TYPE (constants_data_field_decl_node),
+ constants,
+ constants_data_field_decl_node,
+ NULL_TREE);
+ data = fold_convert (build_pointer_type (TREE_TYPE (d)), data);
+ d = build1 (INDIRECT_REF, TREE_TYPE (d), data);
+ /* FIXME: These should be cached. */
+ TREE_INVARIANT (d) = 1;
+ }
+ d = build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (d)), d, i,
NULL_TREE, NULL_TREE);
+ TREE_INVARIANT (d) = 1;
+ return d;
}
/* Build an initializer for the constants field of the current constant pool.