aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2010-06-28 12:06:52 +0000
committerNathan Froyd <froydnj@codesourcery.com>2010-06-28 12:06:52 +0000
commit1c4c603d556f92e16ae4db2f498a8fc6cd254abf (patch)
treeaebfd63be8cd72586541ea999045763a67598c27
parent2fc98dc105990f86e8cba001b0577568cd2e6449 (diff)
* java-tree.h (struct lang_type) [catch_classes]: Change type to a
VEC. * except.c (prepare_eh_table_type): Call CONSTRUCTOR_APPEND_ELT instead of tree_cons. * class.c (make_class): Add dummy entry to TYPE_CATCH_CLASSES. (emit_catch_table): Adjust for new type of TYPE_CATCH_CLASSES. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@161487 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/java/ChangeLog9
-rw-r--r--gcc/java/class.c31
-rw-r--r--gcc/java/except.c6
-rw-r--r--gcc/java/java-tree.h2
4 files changed, 31 insertions, 17 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 0d50a7f4439..e7589638f54 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,12 @@
+2010-06-28 Nathan Froyd <froydnj@codesourcery.com>
+
+ * java-tree.h (struct lang_type) [catch_classes]: Change type to a
+ VEC.
+ * except.c (prepare_eh_table_type): Call CONSTRUCTOR_APPEND_ELT
+ instead of tree_cons.
+ * class.c (make_class): Add dummy entry to TYPE_CATCH_CLASSES.
+ (emit_catch_table): Adjust for new type of TYPE_CATCH_CLASSES.
+
2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
* lang.c: Do not include except.h
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 47b721cd7d0..7d90a032a81 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -382,6 +382,12 @@ make_class (void)
loading works. */
TYPE_BINFO (type) = make_tree_binfo (0);
MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
+ TYPE_CATCH_CLASSES (type) = NULL;
+ /* Push a dummy entry; we can't call make_catch_class_record here
+ because other infrastructure may not be set up yet. We'll come
+ back and fill it in later once said infrastructure is
+ initialized. */
+ CONSTRUCTOR_APPEND_ELT (TYPE_CATCH_CLASSES (type), NULL_TREE, NULL_TREE);
return type;
}
@@ -2960,18 +2966,17 @@ tree
emit_catch_table (tree this_class)
{
tree table, table_size, array_type;
- TYPE_CATCH_CLASSES (this_class) =
- tree_cons (NULL,
- make_catch_class_record (null_pointer_node, null_pointer_node),
- TYPE_CATCH_CLASSES (this_class));
- TYPE_CATCH_CLASSES (this_class) = nreverse (TYPE_CATCH_CLASSES (this_class));
- TYPE_CATCH_CLASSES (this_class) =
- tree_cons (NULL,
- make_catch_class_record (null_pointer_node, null_pointer_node),
- TYPE_CATCH_CLASSES (this_class));
- table_size = build_index_type
- (build_int_cst (NULL_TREE,
- list_length (TYPE_CATCH_CLASSES (this_class))));
+ int n_catch_classes;
+ constructor_elt *e;
+ /* Fill in the dummy entry that make_class created. */
+ e = VEC_index (constructor_elt, TYPE_CATCH_CLASSES (this_class), 0);
+ e->value = make_catch_class_record (null_pointer_node, null_pointer_node);
+ CONSTRUCTOR_APPEND_ELT (TYPE_CATCH_CLASSES (this_class), NULL_TREE,
+ make_catch_class_record (null_pointer_node,
+ null_pointer_node));
+ n_catch_classes = VEC_length (constructor_elt,
+ TYPE_CATCH_CLASSES (this_class));
+ table_size = build_index_type (build_int_cst (NULL_TREE, n_catch_classes));
array_type
= build_array_type (TREE_TYPE (TREE_TYPE (TYPE_CTABLE_DECL (this_class))),
table_size);
@@ -2979,7 +2984,7 @@ emit_catch_table (tree this_class)
build_decl (input_location,
VAR_DECL, DECL_NAME (TYPE_CTABLE_DECL (this_class)), array_type);
DECL_INITIAL (table) =
- build_constructor_from_list (array_type, TYPE_CATCH_CLASSES (this_class));
+ build_constructor (array_type, TYPE_CATCH_CLASSES (this_class));
TREE_STATIC (table) = 1;
TREE_READONLY (table) = 1;
DECL_IGNORED_P (table) = 1;
diff --git a/gcc/java/except.c b/gcc/java/except.c
index 2c3aead1a4c..0033da30653 100644
--- a/gcc/java/except.c
+++ b/gcc/java/except.c
@@ -419,9 +419,9 @@ prepare_eh_table_type (tree type)
layout_decl (decl, 0);
pushdecl (decl);
exp = build1 (ADDR_EXPR, build_pointer_type (utf8const_ptr_type), decl);
- TYPE_CATCH_CLASSES (output_class) =
- tree_cons (NULL, make_catch_class_record (exp, utf8_ref),
- TYPE_CATCH_CLASSES (output_class));
+ CONSTRUCTOR_APPEND_ELT (TYPE_CATCH_CLASSES (output_class),
+ NULL_TREE,
+ make_catch_class_record (exp, utf8_ref));
}
exp = convert (ptr_type_node, exp);
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index 282b5802ed9..ccaa0e34eb7 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -952,7 +952,7 @@ struct GTY((variable_size)) lang_type {
tree ctable_decl; /* The table of classes for the runtime
type matcher. */
- tree catch_classes;
+ VEC(constructor_elt,gc) *catch_classes;
htab_t GTY ((param_is (struct treetreehash_entry))) type_to_runtime_map;
/* The mapping of classes to exception region