/* Process declarations and variables for the GNU compiler for the
Java(TM) language.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007,
- 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GCC.
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tm.h"
#include "tree.h"
-#include "rtl.h"
-#include "real.h"
+#include "diagnostic-core.h"
#include "toplev.h"
#include "flags.h"
#include "java-tree.h"
#include "jcf.h"
-#include "function.h"
-#include "expr.h"
#include "libfuncs.h"
-#include "except.h"
#include "java-except.h"
#include "ggc.h"
-#include "timevar.h"
#include "cgraph.h"
#include "tree-inline.h"
#include "target.h"
#include "version.h"
#include "tree-iterator.h"
#include "langhooks.h"
+#include "cgraph.h"
#if defined (DEBUG_JAVA_BINDING_LEVELS)
extern void indent (void);
tree name;
sprintf (buf, "#slot#%d#%d", index, uniq++);
name = get_identifier (buf);
- decl = build_decl (VAR_DECL, name, type);
+ decl = build_decl (input_location, VAR_DECL, name, type);
DECL_IGNORED_P (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
decl = push_jvm_slot (index, decl);
name = get_identifier (buf);
base_decl
= TREE_VEC_ELT (base_decl_map, index)
- = build_decl (VAR_DECL, name, ptr_type_node);
+ = build_decl (input_location, VAR_DECL, name, ptr_type_node);
pushdecl_function_level (base_decl);
DECL_IGNORED_P (base_decl) = 1;
DECL_ARTIFICIAL (base_decl) = 1;
return decl;
}
-/* Called during gimplification for every variable. If the variable
+/* Called during genericization for every variable. If the variable
is a temporary of pointer type, replace it with a common variable
thath is used to hold all pointer types that are ever stored in
that slot. Set WANT_LVALUE if you want a variable that is to be
written to. */
-tree
+static tree
java_replace_reference (tree var_decl, bool want_lvalue)
{
tree decl_type;
return var_decl;
}
+/* Helper for java_genericize. */
+
+tree
+java_replace_references (tree *tp, int *walk_subtrees,
+ void *data ATTRIBUTE_UNUSED)
+{
+ if (TREE_CODE (*tp) == MODIFY_EXPR)
+ {
+ source_location loc = EXPR_LOCATION (*tp);
+ tree lhs = TREE_OPERAND (*tp, 0);
+ /* This is specific to the bytecode compiler. If a variable has
+ LOCAL_SLOT_P set, replace an assignment to it with an assignment
+ to the corresponding variable that holds all its aliases. */
+ if (TREE_CODE (lhs) == VAR_DECL
+ && DECL_LANG_SPECIFIC (lhs)
+ && LOCAL_SLOT_P (lhs)
+ && TREE_CODE (TREE_TYPE (lhs)) == POINTER_TYPE)
+ {
+ tree new_lhs = java_replace_reference (lhs, /* want_lvalue */ true);
+ tree new_rhs = build1 (NOP_EXPR, TREE_TYPE (new_lhs),
+ TREE_OPERAND (*tp, 1));
+ tree tem = build2 (MODIFY_EXPR, TREE_TYPE (new_lhs),
+ new_lhs, new_rhs);
+ *tp = build1 (NOP_EXPR, TREE_TYPE (lhs), tem);
+ SET_EXPR_LOCATION (tem, loc);
+ SET_EXPR_LOCATION (new_rhs, loc);
+ SET_EXPR_LOCATION (*tp, loc);
+ }
+ }
+ if (TREE_CODE (*tp) == VAR_DECL)
+ {
+ *tp = java_replace_reference (*tp, /* want_lvalue */ false);
+ *walk_subtrees = 0;
+ }
+
+ return NULL_TREE;
+}
/* Same as find_local_index, except that INDEX is a stack index. */
type, -1);
}
-struct binding_level GTY(())
- {
+struct GTY(())
+ binding_level {
/* A chain of _DECL nodes for all variables, constants, functions,
* and typedef types. These are in the reverse of the order supplied.
*/
/* Binding depth at which this level began. Used only for debugging. */
unsigned binding_depth;
+
+ /* The location at which this level began. */
+ source_location loc;
};
#define NULL_BINDING_LEVEL (struct binding_level *) NULL
NULL, /* stmts */
NULL, /* exception_range */
0, /* binding_depth */
+ 0, /* loc */
};
tree java_global_trees[JTI_MAX];
-
+
/* Build (and pushdecl) a "promoted type" for all standard
types shorter than int. */
TYPE_PRECISION (type) = TYPE_PRECISION (int_type_node);
TYPE_STRING_FLAG (type) = TYPE_STRING_FLAG (actual_type);
layout_type (type);
- pushdecl (build_decl (TYPE_DECL, get_identifier (name), type));
+ pushdecl (build_decl (input_location,
+ TYPE_DECL, get_identifier (name), type));
return type;
}
char buf[50];
sprintf (buf, "_Jv_%sVTable", name);
- r = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node);
+ r = build_decl (input_location,
+ VAR_DECL, get_identifier (buf), ptr_type_node);
DECL_EXTERNAL (r) = 1;
return r;
}
-static tree
-do_nothing (tree t)
-{
- return t;
-}
-
/* Parse the version string and compute the ABI version number. */
static void
parse_version (void)
void
java_init_decl_processing (void)
{
- tree endlink;
tree field = NULL_TREE;
tree t;
pushlevel (0); /* make the binding_level structure for global names */
global_binding_level = current_binding_level;
- /* The code here must be similar to build_common_tree_nodes{,_2} in
- tree.c, especially as to the order of initializing common nodes. */
- error_mark_node = make_node (ERROR_MARK);
- TREE_TYPE (error_mark_node) = error_mark_node;
+ /* Build common tree nodes, Java has an unsigned char. */
+ build_common_tree_nodes (false, false);
- /* Create sizetype first - needed for other types. */
- initialize_sizetypes (false);
+ /* ??? Now we continue and override some of the built types again
+ with Java specific types. As the above generated types are
+ supposed to match the targets C ABI this isn't really the way
+ to go and any Java specifics should _not_ use those global types
+ if the Java ABI does not match the C one. */
byte_type_node = make_signed_type (8);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("byte"), byte_type_node));
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("byte"), byte_type_node));
short_type_node = make_signed_type (16);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("short"), short_type_node));
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("short"), short_type_node));
int_type_node = make_signed_type (32);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("int"), int_type_node));
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("int"), int_type_node));
long_type_node = make_signed_type (64);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("long"), long_type_node));
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("long"), long_type_node));
unsigned_byte_type_node = make_unsigned_type (8);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned byte"),
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("unsigned byte"),
unsigned_byte_type_node));
unsigned_short_type_node = make_unsigned_type (16);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned short"),
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("unsigned short"),
unsigned_short_type_node));
unsigned_int_type_node = make_unsigned_type (32);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"),
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("unsigned int"),
unsigned_int_type_node));
unsigned_long_type_node = make_unsigned_type (64);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned long"),
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("unsigned long"),
unsigned_long_type_node));
- /* This is not a java type, however tree-dfa requires a definition for
- size_type_node. */
- size_type_node = make_unsigned_type (POINTER_SIZE);
- set_sizetype (size_type_node);
-
/* Define these next since types below may used them. */
integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0);
integer_zero_node = build_int_cst (NULL_TREE, 0);
integer_one_node = build_int_cst (NULL_TREE, 1);
integer_two_node = build_int_cst (NULL_TREE, 2);
+ integer_three_node = build_int_cst (NULL_TREE, 3);
integer_four_node = build_int_cst (NULL_TREE, 4);
integer_minus_one_node = build_int_cst (NULL_TREE, -1);
/* A few values used for range checking in the lexer. */
decimal_int_max = build_int_cstu (unsigned_int_type_node, 0x80000000);
-#if HOST_BITS_PER_WIDE_INT == 64
- decimal_long_max = build_int_cstu (unsigned_long_type_node,
- 0x8000000000000000LL);
-#elif HOST_BITS_PER_WIDE_INT == 32
- decimal_long_max = build_int_cst_wide (unsigned_long_type_node,
- 0, 0x80000000);
-#else
- #error "unsupported size"
-#endif
-
- size_zero_node = size_int (0);
- size_one_node = size_int (1);
- bitsize_zero_node = bitsize_int (0);
- bitsize_one_node = bitsize_int (1);
- bitsize_unit_node = bitsize_int (BITS_PER_UNIT);
+ decimal_long_max
+ = double_int_to_tree (unsigned_long_type_node,
+ double_int_setbit (double_int_zero, 64));
long_zero_node = build_int_cst (long_type_node, 0);
- void_type_node = make_node (VOID_TYPE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("void"), void_type_node));
- layout_type (void_type_node); /* Uses size_zero_node */
-
- ptr_type_node = build_pointer_type (void_type_node);
- const_ptr_type_node
- = build_pointer_type (build_type_variant (void_type_node, 1, 0));
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("void"), void_type_node));
t = make_node (VOID_TYPE);
layout_type (t); /* Uses size_zero_node */
return_address_type_node = build_pointer_type (t);
- null_pointer_node = build_int_cst (ptr_type_node, 0);
-
- char_type_node = make_node (INTEGER_TYPE);
+ char_type_node = make_unsigned_type (16);
TYPE_STRING_FLAG (char_type_node) = 1;
- TYPE_PRECISION (char_type_node) = 16;
- fixup_unsigned_type (char_type_node);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("char"), char_type_node));
-
- boolean_type_node = make_node (BOOLEAN_TYPE);
- TYPE_PRECISION (boolean_type_node) = 1;
- fixup_unsigned_type (boolean_type_node);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("boolean"),
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("char"), char_type_node));
+
+ boolean_type_node = make_unsigned_type (1);
+ TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("boolean"),
boolean_type_node));
boolean_false_node = TYPE_MIN_VALUE (boolean_type_node);
boolean_true_node = TYPE_MAX_VALUE (boolean_type_node);
float_type_node = make_node (REAL_TYPE);
TYPE_PRECISION (float_type_node) = 32;
- pushdecl (build_decl (TYPE_DECL, get_identifier ("float"),
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("float"),
float_type_node));
layout_type (float_type_node);
double_type_node = make_node (REAL_TYPE);
TYPE_PRECISION (double_type_node) = 64;
- pushdecl (build_decl (TYPE_DECL, get_identifier ("double"),
+ pushdecl (build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("double"),
double_type_node));
layout_type (double_type_node);
one_elt_array_domain_type = build_index_type (integer_one_node);
utf8const_type = make_node (RECORD_TYPE);
- PUSH_FIELD (utf8const_type, field, "hash", unsigned_short_type_node);
- PUSH_FIELD (utf8const_type, field, "length", unsigned_short_type_node);
+ PUSH_FIELD (input_location,
+ utf8const_type, field, "hash", unsigned_short_type_node);
+ PUSH_FIELD (input_location,
+ utf8const_type, field, "length", unsigned_short_type_node);
FINISH_RECORD (utf8const_type);
utf8const_ptr_type = build_pointer_type (utf8const_type);
itable_ptr_type = build_pointer_type (itable_type);
symbol_type = make_node (RECORD_TYPE);
- PUSH_FIELD (symbol_type, field, "clname", utf8const_ptr_type);
- PUSH_FIELD (symbol_type, field, "name", utf8const_ptr_type);
- PUSH_FIELD (symbol_type, field, "signature", utf8const_ptr_type);
+ PUSH_FIELD (input_location,
+ symbol_type, field, "clname", utf8const_ptr_type);
+ PUSH_FIELD (input_location, symbol_type, field, "name", utf8const_ptr_type);
+ PUSH_FIELD (input_location,
+ symbol_type, field, "signature", utf8const_ptr_type);
FINISH_RECORD (symbol_type);
symbols_array_type = build_array_type (symbol_type,
symbols_array_ptr_type = build_pointer_type (symbols_array_type);
assertion_entry_type = make_node (RECORD_TYPE);
- PUSH_FIELD (assertion_entry_type, field, "assertion_code", integer_type_node);
- PUSH_FIELD (assertion_entry_type, field, "op1", utf8const_ptr_type);
- PUSH_FIELD (assertion_entry_type, field, "op2", utf8const_ptr_type);
+ PUSH_FIELD (input_location,
+ assertion_entry_type, field, "assertion_code", integer_type_node);
+ PUSH_FIELD (input_location,
+ assertion_entry_type, field, "op1", utf8const_ptr_type);
+ PUSH_FIELD (input_location,
+ assertion_entry_type, field, "op2", utf8const_ptr_type);
FINISH_RECORD (assertion_entry_type);
assertion_table_type = build_array_type (assertion_entry_type,
methodtable_type = make_node (RECORD_TYPE);
layout_type (methodtable_type);
- build_decl (TYPE_DECL, get_identifier ("methodtable"), methodtable_type);
+ build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("methodtable"), methodtable_type);
methodtable_ptr_type = build_pointer_type (methodtable_type);
TYPE_identifier_node = get_identifier ("TYPE");
init_expr_processing();
constants_type_node = make_node (RECORD_TYPE);
- PUSH_FIELD (constants_type_node, field, "size", unsigned_int_type_node);
- PUSH_FIELD (constants_type_node, field, "tags", ptr_type_node);
- PUSH_FIELD (constants_type_node, field, "data", ptr_type_node);
+ PUSH_FIELD (input_location,
+ constants_type_node, field, "size", unsigned_int_type_node);
+ PUSH_FIELD (input_location,
+ constants_type_node, field, "tags", ptr_type_node);
+ PUSH_FIELD (input_location,
+ constants_type_node, field, "data", ptr_type_node);
constants_data_field_decl_node = field;
FINISH_RECORD (constants_type_node);
- build_decl (TYPE_DECL, get_identifier ("constants"), constants_type_node);
+ build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("constants"), constants_type_node);
access_flags_type_node = unsigned_short_type_node;
TYPE_NONALIASED_COMPONENT (otable_type) = 1;
otable_ptr_type = build_pointer_type (otable_type);
- PUSH_FIELD (object_type_node, field, "vtable", dtable_ptr_type);
+ PUSH_FIELD (input_location,
+ object_type_node, field, "vtable", dtable_ptr_type);
DECL_FCONTEXT (field) = object_type_node;
TYPE_VFIELD (object_type_node) = field;
There is an unresolved issue here, which is whether the vtable
should be marked by the GC. */
if (! flag_hash_synchronization)
- PUSH_FIELD (object_type_node, field, "sync_info",
+ PUSH_FIELD (input_location, object_type_node, field, "sync_info",
build_pointer_type (object_type_node));
- for (t = TYPE_FIELDS (object_type_node); t != NULL_TREE; t = TREE_CHAIN (t))
+ for (t = TYPE_FIELDS (object_type_node); t != NULL_TREE; t = DECL_CHAIN (t))
FIELD_PRIVATE (t) = 1;
FINISH_RECORD (object_type_node);
set_super_info (0, string_type_node, object_type_node, 0);
class_ptr_type = build_pointer_type (class_type_node);
- PUSH_FIELD (class_type_node, field, "next_or_version", class_ptr_type);
- PUSH_FIELD (class_type_node, field, "name", utf8const_ptr_type);
- PUSH_FIELD (class_type_node, field, "accflags", access_flags_type_node);
- PUSH_FIELD (class_type_node, field, "superclass", class_ptr_type);
- PUSH_FIELD (class_type_node, field, "constants", constants_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "next_or_version", class_ptr_type);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "name", utf8const_ptr_type);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "accflags", access_flags_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "superclass", class_ptr_type);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "constants", constants_type_node);
constants_field_decl_node = field;
- PUSH_FIELD (class_type_node, field, "methods", method_ptr_type_node);
- PUSH_FIELD (class_type_node, field, "method_count", short_type_node);
- PUSH_FIELD (class_type_node, field, "vtable_method_count", short_type_node);
- PUSH_FIELD (class_type_node, field, "fields", field_ptr_type_node);
- PUSH_FIELD (class_type_node, field, "size_in_bytes", int_type_node);
- PUSH_FIELD (class_type_node, field, "field_count", short_type_node);
- PUSH_FIELD (class_type_node, field, "static_field_count", short_type_node);
- PUSH_FIELD (class_type_node, field, "vtable", dtable_ptr_type);
- PUSH_FIELD (class_type_node, field, "otable", otable_ptr_type);
- PUSH_FIELD (class_type_node, field, "otable_syms",
+ PUSH_FIELD (input_location,
+ class_type_node, field, "methods", method_ptr_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "method_count", short_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "vtable_method_count", short_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "fields", field_ptr_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "size_in_bytes", int_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "field_count", short_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "static_field_count", short_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "vtable", dtable_ptr_type);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "otable", otable_ptr_type);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "otable_syms",
symbols_array_ptr_type);
- PUSH_FIELD (class_type_node, field, "atable", atable_ptr_type);
- PUSH_FIELD (class_type_node, field, "atable_syms",
+ PUSH_FIELD (input_location,
+ class_type_node, field, "atable", atable_ptr_type);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "atable_syms",
symbols_array_ptr_type);
- PUSH_FIELD (class_type_node, field, "itable", itable_ptr_type);
- PUSH_FIELD (class_type_node, field, "itable_syms",
+ PUSH_FIELD (input_location,
+ class_type_node, field, "itable", itable_ptr_type);
+ PUSH_FIELD (input_location, class_type_node, field, "itable_syms",
symbols_array_ptr_type);
- PUSH_FIELD (class_type_node, field, "catch_classes", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "interfaces",
+ PUSH_FIELD (input_location,
+ class_type_node, field, "catch_classes", ptr_type_node);
+ PUSH_FIELD (input_location, class_type_node, field, "interfaces",
build_pointer_type (class_ptr_type));
- PUSH_FIELD (class_type_node, field, "loader", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "interface_count", short_type_node);
- PUSH_FIELD (class_type_node, field, "state", byte_type_node);
- PUSH_FIELD (class_type_node, field, "thread", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "depth", short_type_node);
- PUSH_FIELD (class_type_node, field, "ancestors", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "idt", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "arrayclass", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "protectionDomain", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "assertion_table", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "hack_signers", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "chain", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "aux_info", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "engine", ptr_type_node);
- PUSH_FIELD (class_type_node, field, "reflection_data", ptr_type_node);
- for (t = TYPE_FIELDS (class_type_node); t != NULL_TREE; t = TREE_CHAIN (t))
+ PUSH_FIELD (input_location, class_type_node, field, "loader", ptr_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "interface_count", short_type_node);
+ PUSH_FIELD (input_location, class_type_node, field, "state", byte_type_node);
+ PUSH_FIELD (input_location, class_type_node, field, "thread", ptr_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "depth", short_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "ancestors", ptr_type_node);
+ PUSH_FIELD (input_location, class_type_node, field, "idt", ptr_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "arrayclass", ptr_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "protectionDomain", ptr_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "assertion_table", ptr_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "hack_signers", ptr_type_node);
+ PUSH_FIELD (input_location, class_type_node, field, "chain", ptr_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "aux_info", ptr_type_node);
+ PUSH_FIELD (input_location, class_type_node, field, "engine", ptr_type_node);
+ PUSH_FIELD (input_location,
+ class_type_node, field, "reflection_data", ptr_type_node);
+ for (t = TYPE_FIELDS (class_type_node); t != NULL_TREE; t = DECL_CHAIN (t))
FIELD_PRIVATE (t) = 1;
push_super_field (class_type_node, object_type_node);
FINISH_RECORD (class_type_node);
- build_decl (TYPE_DECL, get_identifier ("Class"), class_type_node);
+ build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("Class"), class_type_node);
field_info_union_node = make_node (UNION_TYPE);
- PUSH_FIELD (field_info_union_node, field, "boffset", int_type_node);
- PUSH_FIELD (field_info_union_node, field, "addr", ptr_type_node);
+ PUSH_FIELD (input_location,
+ field_info_union_node, field, "boffset", int_type_node);
+ PUSH_FIELD (input_location,
+ field_info_union_node, field, "addr", ptr_type_node);
layout_type (field_info_union_node);
- PUSH_FIELD (field_type_node, field, "name", utf8const_ptr_type);
- PUSH_FIELD (field_type_node, field, "type", class_ptr_type);
- PUSH_FIELD (field_type_node, field, "accflags", access_flags_type_node);
- PUSH_FIELD (field_type_node, field, "bsize", unsigned_short_type_node);
- PUSH_FIELD (field_type_node, field, "info", field_info_union_node);
+ PUSH_FIELD (input_location,
+ field_type_node, field, "name", utf8const_ptr_type);
+ PUSH_FIELD (input_location, field_type_node, field, "type", class_ptr_type);
+ PUSH_FIELD (input_location,
+ field_type_node, field, "accflags", access_flags_type_node);
+ PUSH_FIELD (input_location,
+ field_type_node, field, "bsize", unsigned_short_type_node);
+ PUSH_FIELD (input_location,
+ field_type_node, field, "info", field_info_union_node);
FINISH_RECORD (field_type_node);
- build_decl (TYPE_DECL, get_identifier ("Field"), field_type_node);
+ build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("Field"), field_type_node);
nativecode_ptr_array_type_node
= build_array_type (nativecode_ptr_type_node, one_elt_array_domain_type);
- PUSH_FIELD (dtable_type, field, "class", class_ptr_type);
- PUSH_FIELD (dtable_type, field, "methods", nativecode_ptr_array_type_node);
+ PUSH_FIELD (input_location,
+ dtable_type, field, "class", class_ptr_type);
+ PUSH_FIELD (input_location,
+ dtable_type, field, "methods", nativecode_ptr_array_type_node);
FINISH_RECORD (dtable_type);
- build_decl (TYPE_DECL, get_identifier ("dispatchTable"), dtable_type);
+ build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("dispatchTable"), dtable_type);
jexception_type = make_node (RECORD_TYPE);
- PUSH_FIELD (jexception_type, field, "start_pc", ptr_type_node);
- PUSH_FIELD (jexception_type, field, "end_pc", ptr_type_node);
- PUSH_FIELD (jexception_type, field, "handler_pc", ptr_type_node);
- PUSH_FIELD (jexception_type, field, "catch_type", class_ptr_type);
+ PUSH_FIELD (input_location,
+ jexception_type, field, "start_pc", ptr_type_node);
+ PUSH_FIELD (input_location, jexception_type, field, "end_pc", ptr_type_node);
+ PUSH_FIELD (input_location,
+ jexception_type, field, "handler_pc", ptr_type_node);
+ PUSH_FIELD (input_location,
+ jexception_type, field, "catch_type", class_ptr_type);
FINISH_RECORD (jexception_type);
- build_decl (TYPE_DECL, get_identifier ("jexception"), field_type_node);
+ build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("jexception"), field_type_node);
jexception_ptr_type = build_pointer_type (jexception_type);
lineNumberEntry_type = make_node (RECORD_TYPE);
- PUSH_FIELD (lineNumberEntry_type, field, "line_nr", unsigned_short_type_node);
- PUSH_FIELD (lineNumberEntry_type, field, "start_pc", ptr_type_node);
+ PUSH_FIELD (input_location,
+ lineNumberEntry_type, field, "line_nr", unsigned_short_type_node);
+ PUSH_FIELD (input_location,
+ lineNumberEntry_type, field, "start_pc", ptr_type_node);
FINISH_RECORD (lineNumberEntry_type);
lineNumbers_type = make_node (RECORD_TYPE);
- PUSH_FIELD (lineNumbers_type, field, "length", unsigned_int_type_node);
+ PUSH_FIELD (input_location,
+ lineNumbers_type, field, "length", unsigned_int_type_node);
FINISH_RECORD (lineNumbers_type);
- PUSH_FIELD (method_type_node, field, "name", utf8const_ptr_type);
- PUSH_FIELD (method_type_node, field, "signature", utf8const_ptr_type);
- PUSH_FIELD (method_type_node, field, "accflags", access_flags_type_node);
- PUSH_FIELD (method_type_node, field, "index", unsigned_short_type_node);
- PUSH_FIELD (method_type_node, field, "ncode", nativecode_ptr_type_node);
- PUSH_FIELD (method_type_node, field, "throws", ptr_type_node);
+ PUSH_FIELD (input_location,
+ method_type_node, field, "name", utf8const_ptr_type);
+ PUSH_FIELD (input_location,
+ method_type_node, field, "signature", utf8const_ptr_type);
+ PUSH_FIELD (input_location,
+ method_type_node, field, "accflags", access_flags_type_node);
+ PUSH_FIELD (input_location,
+ method_type_node, field, "index", unsigned_short_type_node);
+ PUSH_FIELD (input_location,
+ method_type_node, field, "ncode", nativecode_ptr_type_node);
+ PUSH_FIELD (input_location,
+ method_type_node, field, "throws", ptr_type_node);
FINISH_RECORD (method_type_node);
- build_decl (TYPE_DECL, get_identifier ("Method"), method_type_node);
+ build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("Method"), method_type_node);
- endlink = end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
+ end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
- t = tree_cons (NULL_TREE, class_ptr_type, endlink);
- alloc_object_node = add_builtin_function ("_Jv_AllocObject",
- build_function_type (ptr_type_node, t),
+ t = build_function_type_list (ptr_type_node, class_ptr_type, NULL_TREE);
+ alloc_object_node = add_builtin_function ("_Jv_AllocObject", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_IS_MALLOC (alloc_object_node) = 1;
alloc_no_finalizer_node =
- add_builtin_function ("_Jv_AllocObjectNoFinalizer",
- build_function_type (ptr_type_node, t),
+ add_builtin_function ("_Jv_AllocObjectNoFinalizer", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_IS_MALLOC (alloc_no_finalizer_node) = 1;
- t = tree_cons (NULL_TREE, ptr_type_node, endlink);
- soft_initclass_node = add_builtin_function ("_Jv_InitClass",
- build_function_type (void_type_node,
- t),
+ t = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
+ soft_initclass_node = add_builtin_function ("_Jv_InitClass", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, class_ptr_type,
- tree_cons (NULL_TREE, int_type_node, endlink));
+ t = build_function_type_list (ptr_type_node,
+ class_ptr_type, int_type_node, NULL_TREE);
soft_resolvepoolentry_node
- = add_builtin_function ("_Jv_ResolvePoolEntry",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_ResolvePoolEntry", t,
0,NOT_BUILT_IN, NULL, NULL_TREE);
DECL_PURE_P (soft_resolvepoolentry_node) = 1;
- throw_node = add_builtin_function ("_Jv_Throw",
- build_function_type (void_type_node, t),
+ t = build_function_type_list (void_type_node,
+ class_ptr_type, int_type_node, NULL_TREE);
+ throw_node = add_builtin_function ("_Jv_Throw", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
/* Mark throw_nodes as `noreturn' functions with side effects. */
TREE_THIS_VOLATILE (throw_node) = 1;
TREE_SIDE_EFFECTS (throw_node) = 1;
- t = build_function_type (void_type_node, tree_cons (NULL_TREE, ptr_type_node,
- endlink));
+ t = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
soft_monitorenter_node
= add_builtin_function ("_Jv_MonitorEnter", t, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
= add_builtin_function ("_Jv_MonitorExit", t, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink));
+ t = build_function_type_list (ptr_type_node,
+ ptr_type_node, int_type_node, NULL_TREE);
soft_newarray_node
- = add_builtin_function ("_Jv_NewPrimArray",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_NewPrimArray", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_IS_MALLOC (soft_newarray_node) = 1;
- t = tree_cons (NULL_TREE, int_type_node,
- tree_cons (NULL_TREE, class_ptr_type,
- tree_cons (NULL_TREE, object_ptr_type_node,
- endlink)));
+ t = build_function_type_list (ptr_type_node,
+ int_type_node, class_ptr_type,
+ object_ptr_type_node, NULL_TREE);
soft_anewarray_node
- = add_builtin_function ("_Jv_NewObjectArray",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_NewObjectArray", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_IS_MALLOC (soft_anewarray_node) = 1;
- /* There is no endlink here because _Jv_NewMultiArray is a varargs
- function. */
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, int_type_node, NULL_TREE));
+ t = build_varargs_function_type_list (ptr_type_node,
+ ptr_type_node, int_type_node,
+ NULL_TREE);
soft_multianewarray_node
- = add_builtin_function ("_Jv_NewMultiArray",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_NewMultiArray", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_IS_MALLOC (soft_multianewarray_node) = 1;
- t = build_function_type (void_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink));
+ t = build_function_type_list (void_type_node, int_type_node, NULL_TREE);
soft_badarrayindex_node
= add_builtin_function ("_Jv_ThrowBadArrayIndex", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
TREE_THIS_VOLATILE (soft_badarrayindex_node) = 1;
TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1;
+ t = build_function_type_list (void_type_node, NULL_TREE);
soft_nullpointer_node
- = add_builtin_function ("_Jv_ThrowNullPointerException",
- build_function_type (void_type_node, endlink),
+ = add_builtin_function ("_Jv_ThrowNullPointerException", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
/* Mark soft_nullpointer_node as a `noreturn' function with side
effects. */
TREE_SIDE_EFFECTS (soft_nullpointer_node) = 1;
soft_abstractmethod_node
- = add_builtin_function ("_Jv_ThrowAbstractMethodError",
- build_function_type (void_type_node, endlink),
+ = add_builtin_function ("_Jv_ThrowAbstractMethodError", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
/* Mark soft_abstractmethod_node as a `noreturn' function with side
effects. */
TREE_SIDE_EFFECTS (soft_abstractmethod_node) = 1;
soft_nosuchfield_node
- = add_builtin_function ("_Jv_ThrowNoSuchFieldError",
- build_function_type (void_type_node, endlink),
+ = add_builtin_function ("_Jv_ThrowNoSuchFieldError", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
/* Mark soft_nosuchfield_node as a `noreturn' function with side
effects. */
TREE_THIS_VOLATILE (soft_nosuchfield_node) = 1;
TREE_SIDE_EFFECTS (soft_nosuchfield_node) = 1;
- t = tree_cons (NULL_TREE, class_ptr_type,
- tree_cons (NULL_TREE, object_ptr_type_node, endlink));
+ t = build_function_type_list (ptr_type_node,
+ class_ptr_type, object_ptr_type_node,
+ NULL_TREE);
soft_checkcast_node
- = add_builtin_function ("_Jv_CheckCast",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_CheckCast", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, object_ptr_type_node,
- tree_cons (NULL_TREE, class_ptr_type, endlink));
+ t = build_function_type_list (boolean_type_node,
+ object_ptr_type_node, class_ptr_type,
+ NULL_TREE);
soft_instanceof_node
- = add_builtin_function ("_Jv_IsInstanceOf",
- build_function_type (boolean_type_node, t),
+ = add_builtin_function ("_Jv_IsInstanceOf", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_PURE_P (soft_instanceof_node) = 1;
- t = tree_cons (NULL_TREE, object_ptr_type_node,
- tree_cons (NULL_TREE, object_ptr_type_node, endlink));
+ t = build_function_type_list (void_type_node,
+ object_ptr_type_node, object_ptr_type_node,
+ NULL_TREE);
soft_checkarraystore_node
- = add_builtin_function ("_Jv_CheckArrayStore",
- build_function_type (void_type_node, t),
+ = add_builtin_function ("_Jv_CheckArrayStore", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink)));
+ t = build_function_type_list (ptr_type_node,
+ ptr_type_node, ptr_type_node, int_type_node,
+ NULL_TREE);
soft_lookupinterfacemethod_node
- = add_builtin_function ("_Jv_LookupInterfaceMethodIdx",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_LookupInterfaceMethodIdx", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_PURE_P (soft_lookupinterfacemethod_node) = 1;
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node, endlink)));
+
+ t = build_function_type_list (ptr_type_node,
+ ptr_type_node, ptr_type_node, ptr_type_node,
+ NULL_TREE);
soft_lookupinterfacemethodbyname_node
- = add_builtin_function ("_Jv_LookupInterfaceMethod",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_LookupInterfaceMethod", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, object_ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, int_type_node,
- endlink))));
+ t = build_function_type_list (ptr_type_node,
+ object_ptr_type_node, ptr_type_node,
+ ptr_type_node, int_type_node, NULL_TREE);
soft_lookupjnimethod_node
- = add_builtin_function ("_Jv_LookupJNIMethod",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_LookupJNIMethod", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, ptr_type_node, endlink);
+ t = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE);
soft_getjnienvnewframe_node
- = add_builtin_function ("_Jv_GetJNIEnvNewFrame",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_GetJNIEnvNewFrame", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
+ t = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
soft_jnipopsystemframe_node
- = add_builtin_function ("_Jv_JNI_PopSystemFrame",
- build_function_type (void_type_node, t),
+ = add_builtin_function ("_Jv_JNI_PopSystemFrame", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, object_ptr_type_node, endlink);
+ t = build_function_type_list (object_ptr_type_node,
+ object_ptr_type_node, NULL_TREE);
soft_unwrapjni_node
- = add_builtin_function ("_Jv_UnwrapJNIweakReference",
- build_function_type (object_ptr_type_node, t),
+ = add_builtin_function ("_Jv_UnwrapJNIweakReference", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, int_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink));
+ t = build_function_type_list (int_type_node,
+ int_type_node, int_type_node, NULL_TREE);
soft_idiv_node
- = add_builtin_function ("_Jv_divI",
- build_function_type (int_type_node, t),
+ = add_builtin_function ("_Jv_divI", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
soft_irem_node
- = add_builtin_function ("_Jv_remI",
- build_function_type (int_type_node, t),
+ = add_builtin_function ("_Jv_remI", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, long_type_node,
- tree_cons (NULL_TREE, long_type_node, endlink));
+ t = build_function_type_list (long_type_node,
+ long_type_node, long_type_node, NULL_TREE);
soft_ldiv_node
- = add_builtin_function ("_Jv_divJ",
- build_function_type (long_type_node, t),
+ = add_builtin_function ("_Jv_divJ", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
soft_lrem_node
- = add_builtin_function ("_Jv_remJ",
- build_function_type (long_type_node, t),
+ = add_builtin_function ("_Jv_remJ", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- /* Initialize variables for except.c. */
- eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS
- ? "__gcj_personality_sj0"
- : "__gcj_personality_v0");
- if (targetm.arm_eabi_unwinder)
- unwind_resume_libfunc = init_one_libfunc ("__cxa_end_cleanup");
- else
- default_init_unwind_resume_libfunc ();
-
- lang_eh_runtime_type = do_nothing;
-
initialize_builtins ();
- soft_fmod_node = built_in_decls[BUILT_IN_FMOD];
+
+ soft_fmod_node = builtin_decl_explicit (BUILT_IN_FMOD);
parse_version ();
}
if (IDENTIFIER_LOCAL_VALUE (name) == 0)
return 0;
- for (t = current_binding_level->names; t; t = TREE_CHAIN (t))
+ for (t = current_binding_level->names; t; t = DECL_CHAIN (t))
if (DECL_NAME (t) == name)
break;
/* Put decls on list in reverse order.
We will reverse them later if necessary. */
- TREE_CHAIN (x) = b->names;
+ DECL_CHAIN (x) = b->names;
b->names = x;
return x;
return t;
}
-/* Nonzero if we are currently in the global binding level. */
+/* Return true if we are in the global binding level. */
-int
+bool
global_bindings_p (void)
{
return current_binding_level == global_binding_level;
make_binding_level (void)
{
/* NOSTRICT */
- return ggc_alloc_cleared (sizeof (struct binding_level));
+ return ggc_alloc_cleared_binding_level ();
}
void
*newlevel = clear_binding_level;
newlevel->level_chain = current_binding_level;
- current_binding_level = newlevel;
+ newlevel->loc = input_location;
+ current_binding_level = newlevel;
#if defined(DEBUG_JAVA_BINDING_LEVELS)
newlevel->binding_depth = binding_depth;
indent ();
else
decls = current_binding_level->names;
- for (decl = decls; decl; decl = TREE_CHAIN (decl))
+ for (decl = decls; decl; decl = DECL_CHAIN (decl))
if (TREE_CODE (decl) == VAR_DECL
&& DECL_LANG_SPECIFIC (decl) != NULL
&& DECL_LOCAL_SLOT_NUMBER (decl))
block = 0;
if (keep || functionbody)
- {
- block = make_node (BLOCK);
- TREE_TYPE (block) = void_type_node;
- }
+ block = make_node (BLOCK);
if (current_binding_level->exception_range)
expand_end_java_handler (current_binding_level->exception_range);
/* Copy decls from names list, ignoring labels. */
while (decl)
{
- tree next = TREE_CHAIN (decl);
+ tree next = DECL_CHAIN (decl);
if (TREE_CODE (decl) != LABEL_DECL)
{
*var = decl;
- var = &TREE_CHAIN (decl);
+ var = &DECL_CHAIN (decl);
}
decl = next;
}
*var = NULL;
- bind = build3 (BIND_EXPR, TREE_TYPE (block), BLOCK_VARS (block),
+ bind = build3 (BIND_EXPR, void_type_node, BLOCK_VARS (block),
BLOCK_EXPR_BODY (block), block);
BIND_EXPR_BODY (bind) = current_binding_level->stmts;
if (BIND_EXPR_BODY (bind) == NULL)
BIND_EXPR_BODY (bind) = build_java_empty_stmt ();
+ SET_EXPR_LOCATION (bind, current_binding_level->loc);
+
current_binding_level->stmts = NULL;
}
else
/* In each subblock, record that this is its superior. */
- for (link = subblocks; link; link = TREE_CHAIN (link))
+ for (link = subblocks; link; link = BLOCK_CHAIN (link))
BLOCK_SUPERCONTEXT (link) = block;
/* Clear out the meanings of the local variables of this level. */
- for (link = decls; link; link = TREE_CHAIN (link))
+ for (link = decls; link; link = DECL_CHAIN (link))
{
tree name = DECL_NAME (link);
if (name != 0 && IDENTIFIER_LOCAL_VALUE (name) == link)
if (block)
{
current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
+ = block_chainon (current_binding_level->blocks, block);
}
/* If we did not make a block for the level just exited,
any blocks made for inner levels
of something else. */
else if (subblocks)
current_binding_level->blocks
- = chainon (current_binding_level->blocks, subblocks);
+ = block_chainon (current_binding_level->blocks, subblocks);
if (bind)
java_add_stmt (bind);
while (*ptr != NULL_TREE
&& DECL_LOCAL_START_PC (*ptr) <= pc
&& DECL_LOCAL_END_PC (*ptr) == end_pc)
- ptr = &TREE_CHAIN (*ptr);
+ ptr = &DECL_CHAIN (*ptr);
pending_local_decls = *ptr;
*ptr = NULL_TREE;
{
tree t;
end_pc = current_binding_level->end_pc;
- for (t = decl; t != NULL_TREE; t = TREE_CHAIN (t))
+ for (t = decl; t != NULL_TREE; t = DECL_CHAIN (t))
DECL_LOCAL_END_PC (t) = end_pc;
}
{
int index = DECL_LOCAL_SLOT_NUMBER (decl);
tree base_decl;
- next = TREE_CHAIN (decl);
+ next = DECL_CHAIN (decl);
push_jvm_slot (index, decl);
pushdecl (decl);
base_decl
return;
lang_decl_size = sizeof (struct lang_decl);
- x = ggc_alloc (lang_decl_size);
+ x = ggc_alloc_lang_decl (lang_decl_size);
memcpy (x, DECL_LANG_SPECIFIC (node), lang_decl_size);
DECL_LANG_SPECIFIC (node) = x;
}
{
tree *ptr;
int end_pc = start_pc + length;
- tree decl = build_decl (VAR_DECL, name, type);
+ tree decl = build_decl (input_location, VAR_DECL, name, type);
if (end_pc > DECL_CODE_LENGTH (current_function_decl))
{
warning (0, "bad PC range for debug info for local %q+D",
&& (DECL_LOCAL_START_PC (*ptr) > start_pc
|| (DECL_LOCAL_START_PC (*ptr) == start_pc
&& DECL_LOCAL_END_PC (*ptr) < end_pc)))
- ptr = &TREE_CHAIN (*ptr);
- TREE_CHAIN (decl) = *ptr;
+ ptr = &DECL_CHAIN (*ptr);
+ DECL_CHAIN (decl) = *ptr;
*ptr = decl;
}
}
/* Fill in default names for the parameters. */
for (parm = DECL_ARGUMENTS (current_function_decl), i = 0;
- parm != NULL_TREE; parm = TREE_CHAIN (parm), i++)
+ parm != NULL_TREE; parm = DECL_CHAIN (parm), i++)
{
if (DECL_NAME (parm) == NULL_TREE)
{
tree result = DECL_RESULT (fndecl);
if (! result)
{
- /* To be compatible with C_PROMOTING_INTEGER_TYPE_P in cc1/cc1plus. */
- if (INTEGRAL_TYPE_P (restype)
- && TYPE_PRECISION (restype) < TYPE_PRECISION (integer_type_node))
- restype = integer_type_node;
- result = build_decl (RESULT_DECL, NULL_TREE, restype);
+ result = build_decl (DECL_SOURCE_LOCATION (fndecl),
+ RESULT_DECL, NULL_TREE, restype);
DECL_ARTIFICIAL (result) = 1;
DECL_IGNORED_P (result) = 1;
DECL_CONTEXT (result) = fndecl;
i = DECL_MAX_LOCALS(fndecl) + DECL_MAX_STACK(fndecl);
decl_map = make_tree_vec (i);
base_decl_map = make_tree_vec (i);
- type_map = xrealloc (type_map, i * sizeof (tree));
+ type_map = XRESIZEVEC (tree, type_map, i);
#if defined(DEBUG_JAVA_BINDING_LEVELS)
fprintf (stderr, "%s:\n", lang_printable_name (fndecl, 2));
tree parm_type = TREE_VALUE (tem);
gcc_assert (i < DECL_MAX_LOCALS (fndecl));
- parm_decl = build_decl (PARM_DECL, parm_name, parm_type);
+ parm_decl = build_decl (input_location, PARM_DECL, parm_name, parm_type);
DECL_CONTEXT (parm_decl) = fndecl;
if (targetm.calls.promote_prototypes (parm_type)
&& TYPE_PRECISION (parm_type) < TYPE_PRECISION (integer_type_node)
DECL_ARG_TYPE (parm_decl) = parm_type;
*ptr = parm_decl;
- ptr = &TREE_CHAIN (parm_decl);
+ ptr = &DECL_CHAIN (parm_decl);
/* Add parm_decl to the decl_map. */
push_jvm_slot (i, parm_decl);
+ /* The this parameter of methods is artificial. */
+ if (TREE_CODE (TREE_TYPE (fndecl)) == METHOD_TYPE && i == 0)
+ DECL_ARTIFICIAL (parm_decl) = 1;
+
type_map[i] = TREE_TYPE (parm_decl);
if (TYPE_IS_WIDE (TREE_TYPE (parm_decl)))
{
type_map[i++] = NULL_TREE;
build_result_decl (fndecl);
+ DECL_SOURCE_LOCATION (fndecl) = input_location;
/* Push local variables. */
pushlevel (2);
finish_method (fndecl);
- if (! flag_unit_at_a_time)
- {
- /* Nulling these fields when we no longer need them saves
- memory. */
- DECL_SAVED_TREE (fndecl) = NULL;
- DECL_STRUCT_FUNCTION (fndecl) = NULL;
- DECL_INITIAL (fndecl) = NULL_TREE;
- }
current_function_decl = NULL_TREE;
+ base_decl_map = NULL_TREE;
}
/* Prepare a method for expansion. */
{
DECL_EXTERNAL (decl) = 0;
- /* If we've already constructed DECL_RTL, give encode_section_info
- a second chance, now that we've changed the flags. */
- /* ??? Ideally, we'd have flag_unit_at_a_time set, and not have done
- anything that would have referenced DECL_RTL so far. But at the
- moment we force flag_unit_at_a_time off due to excessive memory
- consumption when compiling large jar files. Which probably means
- that we need to re-order how we process jar files... */
- if (DECL_RTL_SET_P (decl))
- make_decl_rtl (decl);
+#ifdef ENABLE_CHECKING
+ /* Double check that we didn't pass the function to the callgraph early. */
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ struct cgraph_node *node = cgraph_get_node (decl);
+ gcc_assert (!node || !node->local.finalized);
+ }
+#endif
+ gcc_assert (!DECL_RTL_SET_P (decl));
}
/* Given appropriate target support, G++ will emit hidden aliases for native
/* Use the preceding two functions and mark all members of the class. */
void
-java_mark_class_local (tree class)
+java_mark_class_local (tree klass)
{
tree t;
- for (t = TYPE_FIELDS (class); t ; t = TREE_CHAIN (t))
+ for (t = TYPE_FIELDS (klass); t ; t = DECL_CHAIN (t))
if (FIELD_STATIC (t))
- java_mark_decl_local (t);
+ {
+ if (DECL_EXTERNAL (t))
+ VEC_safe_push (tree, gc, pending_static_fields, t);
+ java_mark_decl_local (t);
+ }
- for (t = TYPE_METHODS (class); t ; t = TREE_CHAIN (t))
+ for (t = TYPE_METHODS (klass); t ; t = DECL_CHAIN (t))
if (!METHOD_ABSTRACT (t))
{
if (METHOD_NATIVE (t) && !flag_jni)
return stmt;
}
+/* If this node is an expr, mark its input location. Called from
+ walk_tree(). */
+
+static tree
+set_input_location (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ tree t = *tp;
+
+ if (CAN_HAVE_LOCATION_P (t))
+ {
+ if (EXPR_HAS_LOCATION(t))
+ return t; /* Don't walk any further into this expr. */
+ else
+ SET_EXPR_LOCATION (t, input_location);
+ }
+
+ return NULL_TREE; /* Continue walking this expr. */
+}
+
/* Add a statement to the statement_list currently being constructed.
If the statement_list is null, we don't create a singleton list.
This is necessary because poplevel() assumes that adding a
tree_stmt_iterator i;
if (input_filename)
- SET_EXPR_LOCATION (new_stmt, input_location);
-
+ walk_tree (&new_stmt, set_input_location, NULL, NULL);
+
if (stmts == NULL)
return current_binding_level->stmts = new_stmt;
{
tree *vars = ¤t_binding_level->names;
tree next = *vars;
- TREE_CHAIN (decl) = next;
+ DECL_CHAIN (decl) = next;
*vars = decl;
DECL_CONTEXT (decl) = current_function_decl;
MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);