diff options
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/java/ChangeLog.ptr | 19 | ||||
-rw-r--r-- | gcc/java/class.c | 10 | ||||
-rw-r--r-- | gcc/java/except.c | 5 | ||||
-rw-r--r-- | gcc/java/expr.c | 19 |
5 files changed, 50 insertions, 17 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index ec3807d..493fe1e 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,17 @@ +2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * class.c (make_class_data): Build the index in sizetype. + Use POINTER_PLUS_EXPR instead of PLUS_EXPR when + adding to a pointer type. + (build_symbol_entry): Likewise. + * expr.c (build_java_arrayaccess): Likewise. + (build_field_ref): Likewise. + (build_known_method_ref): Likewise. + (build_invokevirtual): Likewise. + * except.c (build_exception_object_ref): Do a + NEGATIVE and then a POINTER_PLUS_EXPR instead + of a MINUS_EXPR. + 2007-06-11 Rafael Avila de Espindola <espindola@google.com> * typeck.c (java_signed_type): Remove. diff --git a/gcc/java/ChangeLog.ptr b/gcc/java/ChangeLog.ptr new file mode 100644 index 0000000..eb2c9a9 --- /dev/null +++ b/gcc/java/ChangeLog.ptr @@ -0,0 +1,19 @@ +2007-06-14 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * except.c (build_exception_object_ref): + Use fold_build1 instead of build1 for NEGATE_EXPR. + +2007-05-12 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * class.c (make_class_data): Build the index in sizetype. + Use POINTER_PLUS_EXPR instead of PLUS_EXPR when + adding to a pointer type. + (build_symbol_entry): Likewise. + * expr.c (build_java_arrayaccess): Likewise. + (build_field_ref): Likewise. + (build_known_method_ref): Likewise. + (build_invokevirtual): Likewise. + * except.c (build_exception_object_ref): Do a + NEGATIVE and then a POINTER_PLUS_EXPR instead + of a MINUS_EXPR. + diff --git a/gcc/java/class.c b/gcc/java/class.c index d707461..3d43726 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1669,8 +1669,7 @@ make_class_data (tree type) tree id_class = get_identifier("java.lang.Class"); /** Offset from start of virtual function table declaration to where objects actually point at, following new g++ ABI. */ - tree dtable_start_offset = build_int_cst (NULL_TREE, - 2 * POINTER_SIZE / BITS_PER_UNIT); + tree dtable_start_offset = size_int (2 * POINTER_SIZE / BITS_PER_UNIT); VEC(int, heap) *field_indexes; tree first_real_field; @@ -1957,7 +1956,7 @@ make_class_data (tree type) PUSH_FIELD_VALUE (temp, "vtable", (flag_indirect_classes ? null_pointer_node - : build2 (PLUS_EXPR, dtable_ptr_type, + : build2 (POINTER_PLUS_EXPR, dtable_ptr_type, build1 (ADDR_EXPR, dtable_ptr_type, class_dtable_decl), dtable_start_offset))); @@ -2005,7 +2004,7 @@ make_class_data (tree type) else PUSH_FIELD_VALUE (cons, "vtable", dtable_decl == NULL_TREE ? null_pointer_node - : build2 (PLUS_EXPR, dtable_ptr_type, + : build2 (POINTER_PLUS_EXPR, dtable_ptr_type, build1 (ADDR_EXPR, dtable_ptr_type, dtable_decl), dtable_start_offset)); @@ -2807,7 +2806,8 @@ build_symbol_entry (tree decl, tree special) system that this is a "special" symbol, i.e. one that should bypass access controls. */ if (special != NULL_TREE) - signature = build2 (PLUS_EXPR, TREE_TYPE (signature), signature, special); + signature = build2 (POINTER_PLUS_EXPR, TREE_TYPE (signature), signature, + fold_convert (sizetype, special)); START_RECORD_CONSTRUCTOR (sym, symbol_type); PUSH_FIELD_VALUE (sym, "clname", clname); diff --git a/gcc/java/except.c b/gcc/java/except.c index 788c260..01c8a58 100644 --- a/gcc/java/except.c +++ b/gcc/java/except.c @@ -467,8 +467,9 @@ build_exception_object_ref (tree type) /* Java only passes object via pointer and doesn't require adjusting. The java object is immediately before the generic exception header. */ obj = build0 (EXC_PTR_EXPR, build_pointer_type (type)); - obj = build2 (MINUS_EXPR, TREE_TYPE (obj), obj, - TYPE_SIZE_UNIT (TREE_TYPE (obj))); + obj = build2 (POINTER_PLUS_EXPR, TREE_TYPE (obj), obj, + fold_build1 (NEGATE_EXPR, sizetype, + TYPE_SIZE_UNIT (TREE_TYPE (obj)))); obj = build1 (INDIRECT_REF, type, obj); return obj; diff --git a/gcc/java/expr.c b/gcc/java/expr.c index c915a91..d446e49 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -929,13 +929,12 @@ build_java_arrayaccess (tree array, tree type, tree index) /* Multiply the index by the size of an element to obtain a byte offset. Convert the result to a pointer to the element type. */ - index = fold_convert (TREE_TYPE (node), - build2 (MULT_EXPR, sizetype, - fold_convert (sizetype, index), - size_exp)); + index = build2 (MULT_EXPR, sizetype, + fold_convert (sizetype, index), + size_exp); /* Sum the byte offset and the address of the data field. */ - node = fold_build2 (PLUS_EXPR, TREE_TYPE (node), node, index); + node = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (node), node, index); /* Finally, return @@ -1744,7 +1743,7 @@ build_field_ref (tree self_value, tree self_class, tree name) field_offset = fold (convert (sizetype, field_offset)); self_value = java_check_reference (self_value, check); address - = fold_build2 (PLUS_EXPR, + = fold_build2 (POINTER_PLUS_EXPR, build_pointer_type (TREE_TYPE (field_decl)), self_value, field_offset); return fold_build1 (INDIRECT_REF, TREE_TYPE (field_decl), address); @@ -2228,8 +2227,8 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED, method_index++; } method_index *= int_size_in_bytes (method_type_node); - ref = fold_build2 (PLUS_EXPR, method_ptr_type_node, - ref, build_int_cst (NULL_TREE, method_index)); + ref = fold_build2 (POINTER_PLUS_EXPR, method_ptr_type_node, + ref, size_int (method_index)); ref = build1 (INDIRECT_REF, method_type_node, ref); func = build3 (COMPONENT_REF, nativecode_ptr_type_node, ref, lookup_field (&method_type_node, ncode_ident), @@ -2333,8 +2332,8 @@ build_invokevirtual (tree dtable, tree method, tree special) size_int (TARGET_VTABLE_USES_DESCRIPTORS)); } - func = fold_build2 (PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable, - convert (nativecode_ptr_ptr_type_node, method_index)); + func = fold_build2 (POINTER_PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable, + convert (sizetype, method_index)); if (TARGET_VTABLE_USES_DESCRIPTORS) func = build1 (NOP_EXPR, nativecode_ptr_type_node, func); |