diff options
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/java/class.c | 21 | ||||
-rw-r--r-- | gcc/java/expr.c | 7 | ||||
-rw-r--r-- | gcc/java/java-tree.h | 9 | ||||
-rw-r--r-- | gcc/java/jcf-write.c | 5 | ||||
-rw-r--r-- | gcc/java/parse.y | 31 | ||||
-rw-r--r-- | gcc/java/typeck.c | 5 | ||||
-rw-r--r-- | gcc/java/verify.c | 8 |
8 files changed, 63 insertions, 42 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index bfe435d..46251af 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,22 @@ +2004-07-07 Nathan Sidwell <nathan@codesourcery.com> + + * java-tree.h (CLASSTYPE_SPUER): Adjust BINFO macros. + (TYPE_NVIRTUALS, TYPE_VTABLE): Likewise. + * java/class.c (set_super_info, class_depth, interface_of_p, + maybe_add_interface, add_interface, make_class_data, + layout_class, add_miranda_methods): Adjust BINFO macros. + * expr.c (can_widen_reference_to, lookup_field): Likewise. + * jcf-write.c (generate_classfile): Likewise. + * parse.y (patch_anonymous_class, + check_inner_circular_reference, check_circular_reference, + java_complete_class, check_abstract_method_definitions, + java_check_abstract_method_definitions, + check_interface_throws_clauses, java_check_abstract_methods, + lookup_java_interface_method2, + find_applicable_accessible_methods_list): Likewise. + * typeck.c (find_method_in_interface): Likewise. + * verify.c (merge_types): Likewise. + 2004-07-06 Nathan Sidwell <nathan@codesourcery.com> * java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. diff --git a/gcc/java/class.c b/gcc/java/class.c index be4b3fd..48f6b86 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -477,13 +477,13 @@ set_super_info (int access_flags, tree this_class, total_supers++; TYPE_VFIELD (this_class) = TYPE_VFIELD (object_type_node); - TYPE_BINFO_BASETYPES (this_class) = make_tree_vec (total_supers); + BINFO_BASE_BINFOS (TYPE_BINFO (this_class)) = make_tree_vec (total_supers); if (super_class) { tree super_binfo = make_tree_binfo (0); BINFO_TYPE (super_binfo) = super_class; BINFO_OFFSET (super_binfo) = integer_zero_node; - TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (this_class)), 0) + TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (this_class)), 0) = super_binfo; CLASS_HAS_SUPER (this_class) = 1; } @@ -519,7 +519,7 @@ class_depth (tree clas) while (clas != object_type_node) { depth++; - clas = TYPE_BINFO_BASETYPE (clas, 0); + clas = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (clas), 0)); } return depth; } @@ -532,7 +532,7 @@ interface_of_p (tree type1, tree type2) int n, i; tree basetype_vec; - if (!(basetype_vec = TYPE_BINFO_BASETYPES (type2))) + if (!(basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (type2)))) return 0; n = TREE_VEC_LENGTH (basetype_vec); for (i = 0; i < n; i++) @@ -627,7 +627,7 @@ add_interface_do (tree basetype_vec, tree interface_class, int i) tree maybe_add_interface (tree this_class, tree interface_class) { - tree basetype_vec = TYPE_BINFO_BASETYPES (this_class); + tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (this_class)); int i; int n = TREE_VEC_LENGTH (basetype_vec); for (i = 0; ; i++) @@ -651,7 +651,7 @@ maybe_add_interface (tree this_class, tree interface_class) void add_interface (tree this_class, tree interface_class) { - tree basetype_vec = TYPE_BINFO_BASETYPES (this_class); + tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (this_class)); int i; int n = TREE_VEC_LENGTH (basetype_vec); for (i = 0; ; i++) @@ -1627,7 +1627,8 @@ make_class_data (tree type) /* Build and emit the array of implemented interfaces. */ if (type != object_type_node) - interface_len = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type)) - 1; + interface_len = BINFO_N_BASE_BINFOS (TYPE_BINFO (type)) - 1; + if (interface_len > 0) { tree init = NULL_TREE; @@ -1639,7 +1640,7 @@ make_class_data (tree type) interface_array_type); for (i = interface_len; i > 0; i--) { - tree child = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), i); + tree child = TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (type)), i); tree iclass = BINFO_TYPE (child); tree index; if (! flag_indirect_dispatch @@ -2032,7 +2033,7 @@ layout_class (tree this_class) of this itself. */ if (!CLASS_FROM_SOURCE_P (this_class)) { - tree basetype_vec = TYPE_BINFO_BASETYPES (this_class); + tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (this_class)); if (basetype_vec) { @@ -2068,7 +2069,7 @@ layout_class (tree this_class) static void add_miranda_methods (tree base_class, tree search_class) { - tree basetype_vec = TYPE_BINFO_BASETYPES (search_class); + tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (search_class)); int i, n = TREE_VEC_LENGTH (basetype_vec); for (i = 1; i < n; ++i) { diff --git a/gcc/java/expr.c b/gcc/java/expr.c index c998a68..f2df129 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -427,7 +427,7 @@ can_widen_reference_to (tree source_type, tree target_type) /* target_type is OK if source_type or source_type ancestors implement target_type. We handle multiple sub-interfaces */ - tree basetype_vec = TYPE_BINFO_BASETYPES (source_type); + tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (source_type)); int n = TREE_VEC_LENGTH (basetype_vec), i; for (i=0 ; i < n; i++) if (can_widen_reference_to @@ -440,7 +440,8 @@ can_widen_reference_to (tree source_type, tree target_type) for ( ; source_depth > target_depth; source_depth--) { - source_type = TYPE_BINFO_BASETYPE (source_type, 0); + source_type + = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (source_type), 0)); } return source_type == target_type; } @@ -1466,7 +1467,7 @@ lookup_field (tree *typep, tree name) return field; /* Process implemented interfaces. */ - basetype_vec = TYPE_BINFO_BASETYPES (*typep); + basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (*typep)); n = TREE_VEC_LENGTH (basetype_vec); save_field = NULL_TREE; for (i = 0; i < n; i++) diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 04a8f1f..a07f575 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -125,8 +125,9 @@ struct JCF; #define CLASS_HAS_SUPER(TYPE) CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE)) /* Return the supertype of class TYPE, or NULL_TREE is it has none. */ -#define CLASSTYPE_SUPER(TYPE) (CLASS_HAS_SUPER (TYPE) ? \ - BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (TYPE), 0)) : NULL_TREE) +#define CLASSTYPE_SUPER(TYPE) (CLASS_HAS_SUPER (TYPE) \ + ? BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (TYPE), 0)) \ + : NULL_TREE) /* True if the class we are compiling is a .java source file; false if it is a .class bytecode file. */ @@ -1433,11 +1434,11 @@ extern int in_same_package (tree, tree); /* The number of virtual methods in this class's dispatch table. Does not include initial two dummy entries (one points to the Class object, and the other is for G++ -fvtable-thunks compatibility). */ -#define TYPE_NVIRTUALS(TYPE) TYPE_BINFO_VIRTUALS (TYPE) +#define TYPE_NVIRTUALS(TYPE) BINFO_VIRTUALS (TYPE_BINFO (TYPE)) /* A TREE_VEC (indexed by DECL_VINDEX) containing this class's virtual methods. */ -#define TYPE_VTABLE(TYPE) TYPE_BINFO_VTABLE(TYPE) +#define TYPE_VTABLE(TYPE) BINFO_VTABLE(TYPE_BINFO (TYPE)) /* Use CLASS_LOADED_P? FIXME */ #define CLASS_COMPLETE_P(DECL) DECL_LANG_FLAG_2 (DECL) diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 09b39da..c95df1e 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -2921,8 +2921,7 @@ generate_classfile (tree clas, struct jcf_partial *state) int methods_count = 0; tree part; int total_supers - = clas == object_type_node ? 0 - : TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (clas)); + = clas == object_type_node ? 0 : BINFO_N_BASE_BINFOS (TYPE_BINFO (clas)); ptr = append_chunk (NULL, 8, state); PUT4 (0xCafeBabe); /* Magic number */ @@ -2948,7 +2947,7 @@ generate_classfile (tree clas, struct jcf_partial *state) } else { - tree basetypes = TYPE_BINFO_BASETYPES (clas); + tree basetypes = BINFO_BASE_BINFOS (TYPE_BINFO (clas)); tree base = BINFO_TYPE (TREE_VEC_ELT (basetypes, 0)); int j = find_class_constant (&state->cpool, base); PUT2 (j); /* super_class */ diff --git a/gcc/java/parse.y b/gcc/java/parse.y index adac725..3df330d 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -3889,10 +3889,10 @@ patch_anonymous_class (tree type_decl, tree class_decl, tree wfl) if (parser_check_super_interface (type_decl, class_decl, wfl)) return; - s_binfo = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (class)), 0); - length = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (class))+1; - TYPE_BINFO_BASETYPES (class) = make_tree_vec (length); - TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (class)), 0) = s_binfo; + s_binfo = TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (class)), 0); + length = TREE_VEC_LENGTH (BINFO_BASE_BINFOS (TYPE_BINFO (class)))+1; + BINFO_BASE_BINFOS (TYPE_BINFO (class)) = make_tree_vec (length); + TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (class)), 0) = s_binfo; /* And add the interface */ parser_add_interface (class_decl, type_decl, wfl); } @@ -3901,7 +3901,7 @@ patch_anonymous_class (tree type_decl, tree class_decl, tree wfl) { if (parser_check_super (type_decl, class_decl, wfl)) return; - BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (binfo), 0)) = type; + BINFO_TYPE (TREE_VEC_ELT (BINFO_BASE_BINFOS (binfo), 0)) = type; } } @@ -5214,7 +5214,7 @@ register_incomplete_type (int kind, tree wfl, tree decl, tree ptr) static tree check_inner_circular_reference (tree source, tree target) { - tree basetype_vec = TYPE_BINFO_BASETYPES (source); + tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (source)); tree ctx, cl; int i; @@ -5260,7 +5260,7 @@ check_inner_circular_reference (tree source, tree target) static tree check_circular_reference (tree type) { - tree basetype_vec = TYPE_BINFO_BASETYPES (type); + tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (type)); int i; if (!basetype_vec) @@ -5569,7 +5569,7 @@ java_complete_class (void) /* Simply patch super */ if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep))) continue; - BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO + BINFO_TYPE (TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl); break; @@ -6198,7 +6198,7 @@ check_abstract_method_definitions (int do_interface, tree class_decl, { /* Check for implemented interfaces. */ int i; - tree vector = TYPE_BINFO_BASETYPES (type); + tree vector = BINFO_BASE_BINFOS (TYPE_BINFO (type)); for (i = 1; ok && vector && i < TREE_VEC_LENGTH (vector); i++) { tree super = BINFO_TYPE (TREE_VEC_ELT (vector, i)); @@ -6230,7 +6230,7 @@ java_check_abstract_method_definitions (tree class_decl) } while (super != object_type_node); /* Check for implemented interfaces. */ - vector = TYPE_BINFO_BASETYPES (class); + vector = BINFO_BASE_BINFOS (TYPE_BINFO (class)); for (i = 1; i < TREE_VEC_LENGTH (vector); i++) { super = BINFO_TYPE (TREE_VEC_ELT (vector, i)); @@ -6505,7 +6505,7 @@ check_interface_throws_clauses (tree check_class_decl, tree class_decl) load_class (class_decl, 1); } - bases = TYPE_BINFO_BASETYPES (class_decl); + bases = BINFO_BASE_BINFOS (TYPE_BINFO (class_decl)); iface_len = TREE_VEC_LENGTH (bases) - 1; for (i = iface_len; i > 0; --i) { @@ -6637,7 +6637,7 @@ java_check_abstract_methods (tree interface_decl) } /* 4- Inherited methods can't differ by their returned types */ - if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface))) + if (!(basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (interface)))) return; n = TREE_VEC_LENGTH (basetype_vec); for (i = 0; i < n; i++) @@ -6677,7 +6677,8 @@ static tree lookup_java_interface_method2 (tree class, tree method_decl) { int i, n; - tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return; + tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (class)); + tree to_return; if (!basetype_vec) return NULL_TREE; @@ -11023,7 +11024,7 @@ find_applicable_accessible_methods_list (int lc, tree class, tree name, && CLASS_INTERFACE (TYPE_NAME (class))) { int i, n; - tree basetype_vec = TYPE_BINFO_BASETYPES (class); + tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (class)); search_applicable_methods_list (lc, TYPE_METHODS (class), name, arglist, &list, &all_list); n = TREE_VEC_LENGTH (basetype_vec); @@ -11056,7 +11057,7 @@ find_applicable_accessible_methods_list (int lc, tree class, tree name, /* We must search all interfaces of this class */ if (!lc) { - tree basetype_vec = TYPE_BINFO_BASETYPES (class); + tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (class)); int n = TREE_VEC_LENGTH (basetype_vec), i; for (i = 1; i < n; i++) { diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index cf91667..8cfe5e4 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -797,12 +797,11 @@ find_method_in_interfaces (tree searched_class, int flags, tree method_name, { int i; int interface_len = - TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (searched_class)) - 1; + TREE_VEC_LENGTH (BINFO_BASE_BINFOS (TYPE_BINFO (searched_class))) - 1; for (i = interface_len; i > 0; i--) { - tree child = - TREE_VEC_ELT (TYPE_BINFO_BASETYPES (searched_class), i); + tree child = BINFO_BASE_BINFO (TYPE_BINFO (searched_class), i); tree iclass = BINFO_TYPE (child); tree method; diff --git a/gcc/java/verify.c b/gcc/java/verify.c index 06f834d..8482469 100644 --- a/gcc/java/verify.c +++ b/gcc/java/verify.c @@ -226,13 +226,13 @@ merge_types (tree type1, tree type2) depth1 = class_depth (type1); depth2 = class_depth (type2); for ( ; depth1 > depth2; depth1--) - type1 = TYPE_BINFO_BASETYPE (type1, 0); + type1 = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type1), 0)); for ( ; depth2 > depth1; depth2--) - type2 = TYPE_BINFO_BASETYPE (type2, 0); + type2 = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type2), 0)); while (type1 != type2) { - type1 = TYPE_BINFO_BASETYPE (type1, 0); - type2 = TYPE_BINFO_BASETYPE (type2, 0); + type1 = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type1), 0)); + type2 = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type2), 0)); } return promote_type (type1); } |