/* Next Runtime (ABI-2) private.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2020 Free Software Foundation, Inc.
Contributed by Iain Sandoe and based, in part, on an implementation in
'branches/apple/trunk' contributed by Apple Computer Inc.
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tm.h"
#include "tree.h"
+#include "stringpool.h"
+#include "attribs.h"
#ifdef OBJCPLUS
#include "cp/cp-tree.h"
#include "objcp-decl.h"
#endif /* OBJCPLUS */
-#include "ggc.h"
#include "target.h"
#include "tree-iterator.h"
bool
objc_next_runtime_abi_02_init (objc_runtime_hooks *rthooks)
{
- extern_names = ggc_alloc_cleared_vec_hash (SIZEHASHTABLE);
+ extern_names = ggc_cleared_vec_alloc<hash> (SIZEHASHTABLE);
if (flag_objc_exceptions && flag_objc_sjlj_exceptions)
{
- inform (UNKNOWN_LOCATION, "%<-fobjc-sjlj-exceptions%> is ignored for "
- "%<-fnext-runtime%> when %<-fobjc-abi-version%> >= 2");
+ inform (UNKNOWN_LOCATION,
+ "%<-fobjc-sjlj-exceptions%> is ignored for "
+ "%<-fnext-runtime%> when %<-fobjc-abi-version%> "
+ "greater than 1");
flag_objc_sjlj_exceptions = 0;
}
meta_ehtype = get_identifier ("V2_EHTY");
meta_const_str = get_identifier ("V2_CSTR");
+
+ meta_ivar_ref = get_identifier ("V2_IVRF");
}
static void next_runtime_02_initialize (void)
hash obj;
int slot = IDENTIFIER_HASH_VALUE (DECL_NAME (id)) % SIZEHASHTABLE;
- obj = ggc_alloc_hashed_entry ();
+ obj = ggc_alloc<hashed_entry> ();
obj->list = 0;
obj->next = hashlist[slot];
obj->key = id;
/* NOTE --- entry --- */
-typedef struct GTY(()) ident_data_tuple {
+struct GTY(()) ident_data_tuple {
tree ident;
tree data;
-} ident_data_tuple ;
+};
/* This routine creates a file scope static variable of type 'Class'
to hold the address of a class. */
t = my_build_string_pointer (IDENTIFIER_LENGTH (ident) + 1,
IDENTIFIER_POINTER (ident));
v->quick_push (t);
- t = build_function_call_vec (input_location, objc_get_class_decl, v, 0);
+ t = build_function_call_vec (input_location, vNULL, objc_get_class_decl,
+ v, 0);
vec_free (v);
return t;
}
return decl;
}
-typedef struct GTY(()) msgref_entry {
+struct GTY(()) msgref_entry {
tree func;
tree selname;
tree refdecl;
-} msgref_entry;
+};
static GTY (()) vec<msgref_entry, va_gc> *msgrefs;
return decl;
}
-typedef struct GTY(()) prot_list_entry {
+struct GTY(()) prot_list_entry {
tree id;
tree refdecl;
-} prot_list_entry;
+};
static GTY (()) vec<prot_list_entry, va_gc> *protrefs;
static tree
/* ??? CHECKME. */
ret_val = build_conditional_expr (input_location,
ifexp, 1,
- ret_val, NULL_TREE,
- ftree, NULL_TREE);
+ ret_val, NULL_TREE, input_location,
+ ftree, NULL_TREE, input_location);
#endif
}
return ret_val;
/* This routine declares a variable to hold the offset for ivar
FIELD_DECL. Variable name is .objc_ivar.ClassName.IvarName. */
-typedef struct GTY(()) ivarref_entry
+struct GTY(()) ivarref_entry
{
tree decl;
tree offset;
-} ivarref_entry;
+};
static GTY (()) vec<ivarref_entry, va_gc> *ivar_offset_refs;
else
decl = create_hidden_decl (TREE_TYPE (size_zero_node), buf);
- /* Make sure it ends up in an ObjC section. */
- OBJCMETA (decl, objc_meta, meta_base);
+ /* Identify so that we can indirect these where the ABI requires. */
+ OBJCMETA (decl, objc_meta, meta_ivar_ref);
e.decl = decl;
e.offset = byte_position (field_decl);
if (field && TREE_CODE (field) == FIELD_DECL)
instanceSize = int_byte_position (field) * BITS_PER_UNIT
- + tree_low_cst (DECL_SIZE (field), 0);
+ + tree_to_shwi (DECL_SIZE (field));
else
instanceSize = 0;
instanceSize /= BITS_PER_UNIT;
finish_var_decl (ref->decl, ref->offset);
}
-/* static int _OBJC_IMAGE_INFO[2] = { 0, 16 | flags }; */
-
-static void
-generate_v2_objc_image_info (void)
-{
- tree decl, array_type;
- vec<constructor_elt, va_gc> *v = NULL;
- int flags =
- ((flag_replace_objc_classes && imp_count ? 1 : 0)
- | (flag_objc_gc ? 2 : 0));
-
- flags |= 16;
-
- array_type = build_sized_array_type (integer_type_node, 2);
-
- decl = start_var_decl (array_type, "_OBJC_ImageInfo");
-
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, integer_zero_node);
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, flags));
- /* The Runtime wants this. */
- DECL_PRESERVE_P (decl) = 1;
- OBJCMETA (decl, objc_meta, meta_info);
- finish_var_decl (decl, objc_build_constructor (TREE_TYPE (decl), v));
-}
-
static void
objc_generate_v2_next_metadata (void)
{
build_v2_address_table (nonlazy_category_list, "_OBJC_NonLazyCategoryList$",
meta_label_nonlazy_categorylist);
- /* This conveys information on GC usage and zero-link. */
- generate_v2_objc_image_info ();
-
/* Generate catch objects for eh, if any are needed. */
build_v2_eh_catch_objects ();
case, we use c++'s typeinfo decl. */
return build_eh_type_type (type);
#else
- error ("non-objective-c type '%T' cannot be caught", type);
+ error ("non-objective-c type %qT cannot be caught", type);
goto err_mark_in;
#endif
}
tree t;
if (rethrown)
/* We have a separate re-throw entry. */
- t = build_function_call_vec (loc, objc_rethrow_exception_decl, NULL, NULL);
+ t = build_function_call_vec (loc, vNULL, objc_rethrow_exception_decl,
+ NULL, NULL);
else
{
/* Throw like the others... */
vec<tree, va_gc> *parms;
vec_alloc (parms, 1);
parms->quick_push (throw_expr);
- t = build_function_call_vec (loc, objc_exception_throw_decl, parms, 0);
+ t = build_function_call_vec (loc, vNULL, objc_exception_throw_decl,
+ parms, 0);
vec_free (parms);
}
return add_stmt (t);
/* Pick up the new context we made in begin_try above... */
ct = *cur_try_context;
- func = build_function_call_vec (loc, objc2_end_catch_decl, NULL, NULL);
+ func = build_function_call_vec (loc, vNULL, objc2_end_catch_decl, NULL,
+ NULL);
append_to_statement_list (func, &ct->finally_body);
try_exp = build_stmt (loc, TRY_FINALLY_EXPR, ct->try_body, ct->finally_body);
*cur_try_context = ct->outer;