Commit d4c433f9 by Nicola Pero Committed by Nicola Pero

Updated comments - no change in code

From-SVN: r170298
parent f6c51fa7
2011-01-19 Nicola Pero <nicola.pero@meta-innovation.com> 2011-01-19 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c: Updated comments.
* objc-next-runtime-abi-02.c: Same.
* objc-runtime-shared-support.c: Same.
* objc-runtime-hooks.h: Same.
* objc-act.h: Same.
* objc-gnu-runtime-abi-01.c: Same.
2011-01-19 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-gnu-runtime-abi-01.c (objc_generate_v1_gnu_metadata): Do * objc-gnu-runtime-abi-01.c (objc_generate_v1_gnu_metadata): Do
not generate metadata if there is nothing to put into it. not generate metadata if there is nothing to put into it.
......
...@@ -6553,6 +6553,7 @@ start_class (enum tree_code code, tree class_name, tree super_name, ...@@ -6553,6 +6553,7 @@ start_class (enum tree_code code, tree class_name, tree super_name,
{ {
tree name = TREE_PURPOSE (attribute); tree name = TREE_PURPOSE (attribute);
/* TODO: Document what the objc_exception attribute is/does. */
/* We handle the 'deprecated' and (undocumented) 'objc_exception' /* We handle the 'deprecated' and (undocumented) 'objc_exception'
attributes. */ attributes. */
if (is_attribute_p ("deprecated", name)) if (is_attribute_p ("deprecated", name))
...@@ -7505,10 +7506,6 @@ objc_gen_property_data (tree klass, tree class_methods) ...@@ -7505,10 +7506,6 @@ objc_gen_property_data (tree klass, tree class_methods)
/* @dynamic property - nothing to check or synthesize. */ /* @dynamic property - nothing to check or synthesize. */
if (PROPERTY_DYNAMIC (x)) if (PROPERTY_DYNAMIC (x))
continue; continue;
/* Add any property that is declared in the interface, but undeclared in the
implementation to thie implementation. These are the 'dynamic' properties.
objc_v2_merge_dynamic_property ();*/
/* @synthesize property - need to synthesize the accessors. */ /* @synthesize property - need to synthesize the accessors. */
if (PROPERTY_IVAR_NAME (x)) if (PROPERTY_IVAR_NAME (x))
...@@ -7771,7 +7768,6 @@ objc_declare_protocols (tree names, tree attributes) ...@@ -7771,7 +7768,6 @@ objc_declare_protocols (tree names, tree attributes)
add_protocol (protocol); add_protocol (protocol);
PROTOCOL_DEFINED (protocol) = 0; PROTOCOL_DEFINED (protocol) = 0;
PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE; PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
/* PROTOCOL_V2_FORWARD_DECL (protocol) = NULL_TREE;*/
if (attributes) if (attributes)
{ {
...@@ -7824,7 +7820,6 @@ start_protocol (enum tree_code code, tree name, tree list, tree attributes) ...@@ -7824,7 +7820,6 @@ start_protocol (enum tree_code code, tree name, tree list, tree attributes)
add_protocol (protocol); add_protocol (protocol);
PROTOCOL_DEFINED (protocol) = 1; PROTOCOL_DEFINED (protocol) = 1;
PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE; PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
/* PROTOCOL_V2_FORWARD_DECL (protocol) = NULL_TREE;*/
check_protocol_recursively (protocol, list); check_protocol_recursively (protocol, list);
} }
...@@ -8466,10 +8461,11 @@ void ...@@ -8466,10 +8461,11 @@ void
objc_clear_super_receiver (void) objc_clear_super_receiver (void)
{ {
if (objc_method_context if (objc_method_context
&& UOBJC_SUPER_scope == objc_get_current_scope ()) { && UOBJC_SUPER_scope == objc_get_current_scope ())
UOBJC_SUPER_decl = 0; {
UOBJC_SUPER_scope = 0; UOBJC_SUPER_decl = 0;
} UOBJC_SUPER_scope = 0;
}
} }
void void
...@@ -10357,26 +10353,32 @@ encode_field_decl (tree field_decl, int curtype, int format) ...@@ -10357,26 +10353,32 @@ encode_field_decl (tree field_decl, int curtype, int format)
encode_type (TREE_TYPE (field_decl), curtype, format); encode_type (TREE_TYPE (field_decl), curtype, format);
} }
/* This routine encodes the attribute of the input PROPERTY according to following /* This routine encodes the attribute of the input PROPERTY according
formula: to following formula:
Property attributes are stored as a comma-delimited C string. The simple attributes Property attributes are stored as a comma-delimited C string.
readonly and copies are encoded as single characters. The parametrized attributes, Simple attributes such as readonly are encoded as single
getter=name, setter=name, and ivar=name, are encoded as single characters, followed character. The parametrized attributes, getter=name and
by an identifier. Property types are also encoded as a parametrized attribute. The setter=name, are encoded as a single character followed by an
characters used to encode these attributes are defined by the following enumeration: identifier. Property types are also encoded as a parametrized
attribute. The characters used to encode these attributes are
enum PropertyAttributes { defined by the following enumeration:
kPropertyReadOnly = 'r', // property is read-only.
kPropertyCopies = 'c', // property is a copy of the value last assigned enum PropertyAttributes {
kPropertyGetter = 'g', // followed by getter selector name kPropertyReadOnly = 'R',
kPropertySetter = 's', // followed by setter selector name kPropertyBycopy = 'C',
kPropertyInstanceVariable = 'i' // followed by instance variable name kPropertyByref = '&',
kPropertyType = 't' // followed by old-style type encoding. kPropertyDynamic = 'D',
}; kPropertyGetter = 'G',
kPropertySetter = 'S',
*/ kPropertyInstanceVariable = 'V',
kPropertyType = 't',
kPropertyWeak = 'W',
kPropertyStrong = 'S',
kPropertyNonAtomic = 'N'
};
FIXME: Update the implementation to match. */
tree tree
objc_v2_encode_prop_attr (tree property) objc_v2_encode_prop_attr (tree property)
{ {
......
...@@ -165,6 +165,7 @@ typedef enum objc_property_assign_semantics { ...@@ -165,6 +165,7 @@ typedef enum objc_property_assign_semantics {
#define CLASS_PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 4) #define CLASS_PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 4)
#define TOTAL_CLASS_RAW_IVARS(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 5) #define TOTAL_CLASS_RAW_IVARS(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 5)
/* FIXME */
#define CLASS_HAS_EXCEPTION_ATTR(CLASS) ((CLASS)->type.lang_flag_0) #define CLASS_HAS_EXCEPTION_ATTR(CLASS) ((CLASS)->type.lang_flag_0)
#define PROTOCOL_NAME(CLASS) ((CLASS)->type.name) #define PROTOCOL_NAME(CLASS) ((CLASS)->type.name)
...@@ -396,6 +397,7 @@ enum objc_tree_index ...@@ -396,6 +397,7 @@ enum objc_tree_index
OCTI_GET_PROPERTY_STRUCT_DECL, OCTI_GET_PROPERTY_STRUCT_DECL,
OCTI_SET_PROPERTY_STRUCT_DECL, OCTI_SET_PROPERTY_STRUCT_DECL,
/* TODO: Add comment. */
/* "V1" stuff. */ /* "V1" stuff. */
OCTI_V1_PROP_LIST_TEMPL, OCTI_V1_PROP_LIST_TEMPL,
OCTI_V1_PROP_NAME_ATTR_CHAIN, OCTI_V1_PROP_NAME_ATTR_CHAIN,
...@@ -586,6 +588,7 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX]; ...@@ -586,6 +588,7 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX];
#define objc_setPropertyStruct_decl \ #define objc_setPropertyStruct_decl \
objc_global_trees[OCTI_SET_PROPERTY_STRUCT_DECL] objc_global_trees[OCTI_SET_PROPERTY_STRUCT_DECL]
/* TODO: Add comment. */
/* V1 stuff. */ /* V1 stuff. */
#define objc_prop_list_ptr objc_global_trees[OCTI_V1_PROP_LIST_TEMPL] #define objc_prop_list_ptr objc_global_trees[OCTI_V1_PROP_LIST_TEMPL]
#define prop_names_attr_chain objc_global_trees[OCTI_V1_PROP_NAME_ATTR_CHAIN] #define prop_names_attr_chain objc_global_trees[OCTI_V1_PROP_NAME_ATTR_CHAIN]
......
/* GNU Runtime (ABI-0/1) private. /* GNU Runtime ABI version 8
Copyright (C) 2011 Free Software Foundation, Inc. Copyright (C) 2011 Free Software Foundation, Inc.
Contributed by Iain Sandoe (split from objc-act.c) Contributed by Iain Sandoe (split from objc-act.c)
...@@ -83,6 +83,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -83,6 +83,7 @@ along with GCC; see the file COPYING3. If not see
if (VERS) \ if (VERS) \
DECL_ATTRIBUTES (DECL) = build_tree_list ((VERS), (KIND)); DECL_ATTRIBUTES (DECL) = build_tree_list ((VERS), (KIND));
/* FIXME: Remove this macro, not needed. */
#ifndef TARGET_64BIT #ifndef TARGET_64BIT
#define TARGET_64BIT 0 #define TARGET_64BIT 0
#endif #endif
...@@ -143,6 +144,10 @@ objc_gnu_runtime_abi_01_init (objc_runtime_hooks *rthooks) ...@@ -143,6 +144,10 @@ objc_gnu_runtime_abi_01_init (objc_runtime_hooks *rthooks)
flag_objc_sjlj_exceptions = 0; flag_objc_sjlj_exceptions = 0;
} }
/* TODO: Complain if -fobjc-abi-version=N was used. */
/* TODO: Complain if -fobj-nilcheck was used. */
rthooks->initialize = gnu_runtime_01_initialize; rthooks->initialize = gnu_runtime_01_initialize;
rthooks->default_constant_string_class_name = DEF_CONSTANT_STRING_CLASS_NAME; rthooks->default_constant_string_class_name = DEF_CONSTANT_STRING_CLASS_NAME;
rthooks->tag_getclass = TAG_GETCLASS; rthooks->tag_getclass = TAG_GETCLASS;
...@@ -573,7 +578,8 @@ gnu_runtime_abi_01_get_class_reference (tree ident) ...@@ -573,7 +578,8 @@ gnu_runtime_abi_01_get_class_reference (tree ident)
(IDENTIFIER_LENGTH (ident) + 1, (IDENTIFIER_LENGTH (ident) + 1,
IDENTIFIER_POINTER (ident))); IDENTIFIER_POINTER (ident)));
/* assemble_external (objc_get_class_decl);*/ /* FIXME: Do we need this assemble_external() ? */
/* assemble_external (objc_get_class_decl);*/
return build_function_call (input_location, objc_get_class_decl, params); return build_function_call (input_location, objc_get_class_decl, params);
} }
...@@ -794,7 +800,7 @@ gnu_runtime_abi_01_get_protocol_reference (location_t loc, tree p) ...@@ -794,7 +800,7 @@ gnu_runtime_abi_01_get_protocol_reference (location_t loc, tree p)
return expr; return expr;
} }
/* For ABI 0/1 and IVAR is just a fixed offset in the class struct. */ /* For ABI 8 an IVAR is just a fixed offset in the class struct. */
static tree static tree
gnu_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED, gnu_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED,
...@@ -837,7 +843,8 @@ gnu_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED, ...@@ -837,7 +843,8 @@ gnu_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED,
add_class_reference (super_name); add_class_reference (super_name);
super_class = (inst_meth ? objc_get_class_decl : objc_get_meta_class_decl); super_class = (inst_meth ? objc_get_class_decl : objc_get_meta_class_decl);
/* assemble_external (super_class);*/ /* FIXME: Do we need this assemble_external() ? */
/* assemble_external (super_class);*/
super_name = my_build_string_pointer (IDENTIFIER_LENGTH (super_name) + 1, super_name = my_build_string_pointer (IDENTIFIER_LENGTH (super_name) + 1,
IDENTIFIER_POINTER (super_name)); IDENTIFIER_POINTER (super_name));
/* super_class = get_{meta_}class("CLASS_SUPER_NAME"); */ /* super_class = get_{meta_}class("CLASS_SUPER_NAME"); */
...@@ -1475,16 +1482,10 @@ generate_category (struct imp_entry *impent) ...@@ -1475,16 +1482,10 @@ generate_category (struct imp_entry *impent)
long instance_size; long instance_size;
struct objc_ivar_list *ivars; struct objc_ivar_list *ivars;
struct objc_method_list *methods; struct objc_method_list *methods;
if (flag_next_runtime) struct sarray *dtable;
struct objc_cache *cache; struct objc_class *subclass_list;
else { struct objc_class *sibling_class;
struct sarray *dtable;
struct objc_class *subclass_list;
struct objc_class *sibling_class;
}
struct objc_protocol_list *protocols; struct objc_protocol_list *protocols;
if (flag_next_runtime)
void *sel_id;
void *gc_object_type; void *gc_object_type;
}; */ }; */
...@@ -1542,6 +1543,7 @@ build_shared_structure_initializer (tree type, tree isa, tree super, ...@@ -1542,6 +1543,7 @@ build_shared_structure_initializer (tree type, tree isa, tree super,
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
} }
/* FIXME: Remove NeXT runtime code. */
if (flag_next_runtime) if (flag_next_runtime)
{ {
ltyp = build_pointer_type (xref_tag (RECORD_TYPE, ltyp = build_pointer_type (xref_tag (RECORD_TYPE,
...@@ -1573,6 +1575,7 @@ build_shared_structure_initializer (tree type, tree isa, tree super, ...@@ -1573,6 +1575,7 @@ build_shared_structure_initializer (tree type, tree isa, tree super,
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
} }
/* FIXME: Remove NeXT runtime code. */
if (flag_next_runtime) if (flag_next_runtime)
/* sel_id = NULL */ /* sel_id = NULL */
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0));
...@@ -1864,6 +1867,7 @@ generate_static_references (void) ...@@ -1864,6 +1867,7 @@ generate_static_references (void)
char buf[BUFSIZE]; char buf[BUFSIZE];
VEC(constructor_elt,gc) *decls = NULL; VEC(constructor_elt,gc) *decls = NULL;
/* FIXME: Remove NeXT runtime code. */
if (flag_next_runtime) if (flag_next_runtime)
gcc_unreachable (); gcc_unreachable ();
...@@ -1991,6 +1995,7 @@ build_objc_symtab_template (void) ...@@ -1991,6 +1995,7 @@ build_objc_symtab_template (void)
/* short cat_def_cnt; */ /* short cat_def_cnt; */
add_field_decl (short_integer_type_node, "cat_def_cnt", &chain); add_field_decl (short_integer_type_node, "cat_def_cnt", &chain);
/* FIXME: Remove. */
if (TARGET_64BIT) if (TARGET_64BIT)
add_field_decl (integer_type_node, "_explicit_padder", &chain); add_field_decl (integer_type_node, "_explicit_padder", &chain);
...@@ -2037,6 +2042,8 @@ init_objc_symtab (tree type) ...@@ -2037,6 +2042,8 @@ init_objc_symtab (tree type)
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (short_integer_type_node, cat_count)); build_int_cst (short_integer_type_node, cat_count));
/* FIXME: Remove. */
if (TARGET_64BIT) if (TARGET_64BIT)
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (integer_type_node, 0)); build_int_cst (integer_type_node, 0));
...@@ -2044,8 +2051,11 @@ init_objc_symtab (tree type) ...@@ -2044,8 +2051,11 @@ init_objc_symtab (tree type)
/* cls_def = { ..., { &Foo, &Bar, ...}, ... } */ /* cls_def = { ..., { &Foo, &Bar, ...}, ... } */
field = TYPE_FIELDS (type); field = TYPE_FIELDS (type);
/* FIXME: Remove. */
if (TARGET_64BIT) if (TARGET_64BIT)
field = DECL_CHAIN (field); field = DECL_CHAIN (field);
field = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (field)))); field = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (field))));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, init_def_list (TREE_TYPE (field))); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, init_def_list (TREE_TYPE (field)));
......
...@@ -22,14 +22,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -22,14 +22,8 @@ along with GCC; see the file COPYING3. If not see
/* The NeXT ABI2 is used for m64 implementations on Darwin/OSX machines. /* The NeXT ABI2 is used for m64 implementations on Darwin/OSX machines.
This version is intended to match (logically) output of Apple's 4.2.1 This version is intended to match (logically) the output of Apple's
compiler. 4.2.1 compiler. */
References:
FSF GCC branches/apple/trunk.
objc4-371.2 Open Source release (Apple Computer). (objc-runtime-new.h)
gcc_42-5664 Apple Local modifications to GCC (Apple Computer).
*/
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
......
...@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
/* Objective-C supports several runtime library variants: /* Objective-C supports several runtime library variants:
"GNU" runtime selected by -fgnu-runtime (currently at API version 1). "GNU" runtime selected by -fgnu-runtime (currently at ABI version 8).
"NeXT" runtime (selected by -fnext-runtime) and installed on OSX/Darwin "NeXT" runtime (selected by -fnext-runtime) and installed on OSX/Darwin
systems at API version 1 (for m32 code) and version 2 (for m64 code). systems at API version 1 (for m32 code) and version 2 (for m64 code).
...@@ -33,8 +33,11 @@ along with GCC; see the file COPYING3. If not see ...@@ -33,8 +33,11 @@ along with GCC; see the file COPYING3. If not see
and so on, and the purpose of this interface is to abstract such and so on, and the purpose of this interface is to abstract such
differences from the parser's perspective. */ differences from the parser's perspective. */
/* TODO: Do we want the initial underscore ? */
typedef struct _objc_runtime_hooks_r typedef struct _objc_runtime_hooks_r
{ {
/* TODO: Expand comments in this file. */
/* Initialize for this runtime. */ /* Initialize for this runtime. */
void (*initialize) (void); void (*initialize) (void);
const char *default_constant_string_class_name; const char *default_constant_string_class_name;
......
...@@ -507,7 +507,10 @@ build_module_descriptor (long vers, tree attr) ...@@ -507,7 +507,10 @@ build_module_descriptor (long vers, tree attr)
/* Create an instance of "_objc_module". */ /* Create an instance of "_objc_module". */
UOBJC_MODULES_decl = start_var_decl (objc_module_template, UOBJC_MODULES_decl = start_var_decl (objc_module_template,
flag_next_runtime ? "_OBJC_Module" : "_OBJC_Module"); /* FIXME - why the conditional
if the symbol is the
same. */
flag_next_runtime ? "_OBJC_Module" : "_OBJC_Module");
/* This is the root of the metadata for defined classes and categories, it /* This is the root of the metadata for defined classes and categories, it
is referenced by the runtime and, therefore, needed. */ is referenced by the runtime and, therefore, needed. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment