#include "output.h"
#include "parse.h"
#include "function.h"
+#include "tm_p.h"
#include "ggc.h"
#include "stdio.h"
#include "target.h"
int prefix_len = strlen (prefix);
int suffix_len = strlen (suffix);
int i = prefix_len + old_length + suffix_len + 1;
- char *buffer = alloca (i);
+ char *buffer = (char *) alloca (i);
strcpy (buffer, prefix);
for (i = 0; i < old_length; i++)
rewriting. */
if (illegal_chars != 0)
{
- char *buffer = alloca (illegal_chars * 4 + len + 1);
+ char *buffer = (char *) alloca (illegal_chars * 4 + len + 1);
int j;
for (i = 0, j = 0; i < len; i++)
#define GEN_TABLE(TABLE, NAME, TABLE_TYPE, TYPE) \
do \
{ \
- const char *typename = IDENTIFIER_POINTER (mangled_classname ("", TYPE)); \
- char *buf = alloca (strlen (typename) + strlen (#NAME "_syms_") + 1); \
+ const char *type_name = IDENTIFIER_POINTER (mangled_classname ("", TYPE)); \
+ char *buf = (char *) alloca (strlen (type_name) \
+ + strlen (#NAME "_syms_") + 1); \
tree decl; \
\
- sprintf (buf, #NAME "_%s", typename); \
+ sprintf (buf, #NAME "_%s", type_name); \
TYPE_## TABLE ##_DECL (type) = decl = \
build_decl (VAR_DECL, get_identifier (buf), TABLE_TYPE); \
DECL_EXTERNAL (decl) = 1; \
pushdecl (decl); \
MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl); \
DECL_OWNER (decl) = TYPE; \
- sprintf (buf, #NAME "_syms_%s", typename); \
+ sprintf (buf, #NAME "_syms_%s", type_name); \
TYPE_## TABLE ##_SYMS_DECL (TYPE) = \
build_decl (VAR_DECL, get_identifier (buf), symbols_array_type); \
TREE_STATIC (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1; \
void
gen_indirect_dispatch_tables (tree type)
{
- const char *typename = IDENTIFIER_POINTER (mangled_classname ("", type));
+ const char *type_name = IDENTIFIER_POINTER (mangled_classname ("", type));
{
tree field = NULL;
- char *buf = alloca (strlen (typename) + strlen ("_catch_classes_") + 1);
+ char *buf = (char *) alloca (strlen (type_name)
+ + strlen ("_catch_classes_") + 1);
tree catch_class_type = make_node (RECORD_TYPE);
- sprintf (buf, "_catch_classes_%s", typename);
+ sprintf (buf, "_catch_classes_%s", type_name);
PUSH_FIELD (catch_class_type, field, "address", utf8const_ptr_type);
PUSH_FIELD (catch_class_type, field, "classname", ptr_type_node);
FINISH_RECORD (catch_class_type);
DECL_CONTEXT (fndecl) = this_class;
DECL_LANG_SPECIFIC (fndecl)
- = ggc_alloc_cleared (sizeof (struct lang_decl));
+ = GGC_CNEW (struct lang_decl);
DECL_LANG_SPECIFIC (fndecl)->desc = LANG_DECL_FUNC;
/* Initialize the static initializer test table. */
if (access_flags & ACC_PUBLIC) METHOD_PUBLIC (fndecl) = 1;
if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1;
if (access_flags & ACC_PRIVATE)
- METHOD_PRIVATE (fndecl) = DECL_INLINE (fndecl) = 1;
+ METHOD_PRIVATE (fndecl) = 1;
if (access_flags & ACC_NATIVE)
{
METHOD_NATIVE (fndecl) = 1;
file. */
DECL_EXTERNAL (fndecl) = CLASS_FROM_CURRENTLY_COMPILED_P (this_class) == 0;
if (access_flags & ACC_STATIC)
- METHOD_STATIC (fndecl) = DECL_INLINE (fndecl) = 1;
+ METHOD_STATIC (fndecl) = 1;
if (access_flags & ACC_FINAL)
- METHOD_FINAL (fndecl) = DECL_INLINE (fndecl) = 1;
+ METHOD_FINAL (fndecl) = 1;
if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1;
if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1;
if (access_flags & ACC_STRICT) METHOD_STRICTFP (fndecl) = 1;
}
tree
-add_field (tree class, tree name, tree field_type, int flags)
+add_field (tree klass, tree name, tree field_type, int flags)
{
int is_static = (flags & ACC_STATIC) != 0;
tree field;
field = build_decl (is_static ? VAR_DECL : FIELD_DECL, name, field_type);
- TREE_CHAIN (field) = TYPE_FIELDS (class);
- TYPE_FIELDS (class) = field;
- DECL_CONTEXT (field) = class;
+ TREE_CHAIN (field) = TYPE_FIELDS (klass);
+ TYPE_FIELDS (klass) = field;
+ DECL_CONTEXT (field) = klass;
MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field);
if (flags & ACC_PUBLIC) FIELD_PUBLIC (field) = 1;
java_hide_decl (field);
/* Considered external unless we are compiling it into this
object file. */
- DECL_EXTERNAL (field) = (is_compiled_class (class) != 2);
+ DECL_EXTERNAL (field) = (is_compiled_class (klass) != 2);
}
return field;
tree
build_utf8_ref (tree name)
{
- const char * name_ptr = IDENTIFIER_POINTER(name);
- int name_len = IDENTIFIER_LENGTH(name);
+ const char * name_ptr = IDENTIFIER_POINTER (name);
+ int name_len = IDENTIFIER_LENGTH (name), name_pad;
char buf[60];
tree ctype, field = NULL_TREE, str_type, cinit, string;
static int utf8_count = 0;
return ref;
ctype = make_node (RECORD_TYPE);
+ /* '\0' byte plus padding to utf8const_type's alignment. */
+ name_pad = TYPE_ALIGN_UNIT (utf8const_type)
+ - (name_len & (TYPE_ALIGN_UNIT (utf8const_type) - 1));
str_type = build_prim_array_type (unsigned_byte_type_node,
- name_len + 1); /* Allow for final '\0'. */
+ name_len + name_pad);
PUSH_FIELD (ctype, field, "hash", unsigned_short_type_node);
PUSH_FIELD (ctype, field, "length", unsigned_short_type_node);
PUSH_FIELD (ctype, field, "data", str_type);
{
int decl_size;
/* Ensure decl_size is a multiple of utf8const_type's alignment. */
- decl_size = (name_len + 5 + TYPE_ALIGN_UNIT (utf8const_type) - 1)
- & ~(TYPE_ALIGN_UNIT (utf8const_type) - 1);
+ decl_size = name_len + 4 + name_pad;
if (flag_merge_constants && decl_size < 256)
{
char buf[32];
TREE_CHAIN (decl) = utf8_decl_list;
layout_decl (decl, 0);
+ DECL_SIZE (decl) = TYPE_SIZE (ctype);
+ DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (ctype);
pushdecl (decl);
rest_of_decl_compilation (decl, global_bindings_p (), 0);
varpool_mark_needed_node (varpool_node (decl));
{
tree decl, decl_name;
const char *name = IDENTIFIER_POINTER (mangled_classname ("_cpool_", output_class));
- char *buf = alloca (strlen (name) + 20);
+ char *buf = (char *) alloca (strlen (name) + 20);
sprintf (buf, "%s_%d_ref", name, index);
decl_name = get_identifier (buf);
decl = IDENTIFIER_GLOBAL_VALUE (decl_name);
tree alias;
const char *method_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (method));
- char *name = alloca (strlen (method_name) + 2);
- char *buf = alloca (strlen (method_name) + 128);
+ char *name = (char *) alloca (strlen (method_name) + 2);
+ char *buf = (char *) alloca (strlen (method_name) + 128);
/* Only create aliases for local functions. */
if (DECL_EXTERNAL (method))
TREE_PUBLIC (alias) = 0;
DECL_EXTERNAL (alias) = 0;
DECL_ARTIFICIAL (alias) = 1;
- DECL_INLINE (alias) = 0;
DECL_INITIAL (alias) = error_mark_node;
TREE_ADDRESSABLE (alias) = 1;
TREE_USED (alias) = 1;
field_index = static_count++;
else if (uses_jv_markobj || !flag_reduced_reflection)
field_index = instance_count++;
+ else
+ continue;
VEC_quick_push (int, field_indexes, field_index);
}
}
rest_of_decl_compilation (TYPE_NAME (current_class), 1, 0);
}
-/* Return 2 if CLASS is compiled by this compilation job;
- return 1 if CLASS can otherwise be assumed to be compiled;
- return 0 if we cannot assume that CLASS is compiled.
+/* Return 2 if KLASS is compiled by this compilation job;
+ return 1 if KLASS can otherwise be assumed to be compiled;
+ return 0 if we cannot assume that KLASS is compiled.
Returns 1 for primitive and 0 for array types. */
int
-is_compiled_class (tree class)
+is_compiled_class (tree klass)
{
int seen_in_zip;
- if (TREE_CODE (class) == POINTER_TYPE)
- class = TREE_TYPE (class);
- if (TREE_CODE (class) != RECORD_TYPE) /* Primitive types are static. */
+ if (TREE_CODE (klass) == POINTER_TYPE)
+ klass = TREE_TYPE (klass);
+ if (TREE_CODE (klass) != RECORD_TYPE) /* Primitive types are static. */
return 1;
- if (TYPE_ARRAY_P (class))
+ if (TYPE_ARRAY_P (klass))
return 0;
- seen_in_zip = (TYPE_JCF (class) && JCF_SEEN_IN_ZIP (TYPE_JCF (class)));
- if (CLASS_FROM_CURRENTLY_COMPILED_P (class))
+ seen_in_zip = (TYPE_JCF (klass) && JCF_SEEN_IN_ZIP (TYPE_JCF (klass)));
+ if (CLASS_FROM_CURRENTLY_COMPILED_P (klass))
{
/* The class was seen in the current ZIP file and will be
available as a compiled class in the future but may not have
been loaded already. Load it if necessary. This prevent
build_class_ref () from crashing. */
- if (seen_in_zip && !CLASS_LOADED_P (class) && (class != current_class))
- load_class (class, 1);
+ if (seen_in_zip && !CLASS_LOADED_P (klass) && (klass != current_class))
+ load_class (klass, 1);
/* We return 2 for class seen in ZIP and class from files
belonging to the same compilation unit */
return 2;
}
- if (assume_compiled (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class)))))
+ if (assume_compiled (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (klass)))))
{
- if (!CLASS_LOADED_P (class))
+ if (!CLASS_LOADED_P (klass))
{
- if (class != current_class)
- load_class (class, 1);
+ if (klass != current_class)
+ load_class (klass, 1);
}
return 1;
}
about the class processed currently. */
void
-safe_layout_class (tree class)
+safe_layout_class (tree klass)
{
tree save_current_class = current_class;
location_t save_location = input_location;
- layout_class (class);
+ layout_class (klass);
current_class = save_current_class;
input_location = save_location;
obstack_grow (&temporary_obstack, buffer, strlen (buffer));
}
obstack_1grow (&temporary_obstack, '\0');
- report = obstack_finish (&temporary_obstack);
+ report = XOBFINISH (&temporary_obstack, char *);
cyclic_inheritance_report = ggc_strdup (report);
obstack_free (&temporary_obstack, report);
TYPE_SIZE (this_class) = error_mark_node;
return true;
}
-/* Generate the type assertion table for CLASS, and return its DECL. */
+/* Generate the type assertion table for KLASS, and return its DECL. */
static tree
-emit_assertion_table (tree class)
+emit_assertion_table (tree klass)
{
tree null_entry, ctor, table_decl;
tree list = NULL_TREE;
- htab_t assertions_htab = TYPE_ASSERTIONS (class);
+ htab_t assertions_htab = TYPE_ASSERTIONS (klass);
/* Iterate through the hash table. */
htab_traverse (assertions_htab, add_assertion_table_entry, &list);
list = nreverse (list);
ctor = build_constructor_from_list (assertion_table_type, list);
- table_decl = build_decl (VAR_DECL, mangled_classname ("_type_assert_", class),
+ table_decl = build_decl (VAR_DECL, mangled_classname ("_type_assert_", klass),
assertion_table_type);
TREE_STATIC (table_decl) = 1;
{
struct treetreehash_entry *e;
hashval_t hv = JAVA_TREEHASHHASH_H (t);
- e = htab_find_with_hash (ht, t, hv);
+ e = (struct treetreehash_entry *) htab_find_with_hash (ht, t, hv);
if (e == NULL)
return NULL;
else
e = htab_find_slot_with_hash (ht, t, hv, INSERT);
if (*e == NULL)
{
- tthe = (*ht->alloc_f) (1, sizeof (*tthe));
+ tthe = (struct treetreehash_entry *) (*ht->alloc_f) (1, sizeof (*tthe));
tthe->key = t;
*e = tthe;
}
char *p, *base;
int l = IDENTIFIER_LENGTH (source);
- base = alloca (l + 1);
+ base = (char *) alloca (l + 1);
memcpy (base, IDENTIFIER_POINTER (source), l + 1);
/* Breakdown NAME into REMAINDER . IDENTIFIER. */