Commit c2beaa02 by Nicola Pero Committed by Nicola Pero

Updated comments

From-SVN: r170308
parent 54ba9323
2011-01-19 Nicola Pero <nicola.pero@meta-innovation.com> 2011-01-19 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-next-runtime-abi-01.c: Updated comments.
* objc-next-runtime-abi-02.c: Same.
2011-01-19 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_init, generate_struct_by_value_array): Updated * objc-act.c (objc_init, generate_struct_by_value_array): Updated
comments. comments.
......
...@@ -18,10 +18,10 @@ You should have received a copy of the GNU General Public License ...@@ -18,10 +18,10 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
/* This implements the original NeXT ABI (0) used for m32 code and indicated /* This implements the original NeXT ABI (0) used for m32 code and
by module version 6. It also implements the small number of additions made indicated by module version 6. It also implements the small number
for properties and optional protocol methods as ABI=1 of additions made for properties and optional protocol methods as
(module version 7). */ ABI=1 (module version 7). */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
...@@ -39,8 +39,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -39,8 +39,9 @@ along with GCC; see the file COPYING3. If not see
#include "c-family/c-objc.h" #include "c-family/c-objc.h"
#include "objc-act.h" #include "objc-act.h"
/* When building Objective-C++, we are not linking against the C front-end /* When building Objective-C++, we are not linking against the C
and so need to replicate the C tree-construction functions in some way. */ front-end and so need to replicate the C tree-construction
functions in some way. */
#ifdef OBJCPLUS #ifdef OBJCPLUS
#define OBJCP_REMAP_FUNCTIONS #define OBJCP_REMAP_FUNCTIONS
#include "objcp-decl.h" #include "objcp-decl.h"
...@@ -85,9 +86,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -85,9 +86,9 @@ along with GCC; see the file COPYING3. If not see
#define TAG_MSGSEND_FAST "objc_msgSend_Fast" #define TAG_MSGSEND_FAST "objc_msgSend_Fast"
#define TAG_ASSIGNIVAR_FAST "objc_assign_ivar_Fast" #define TAG_ASSIGNIVAR_FAST "objc_assign_ivar_Fast"
/* The version identifies which language generation and runtime /* The version identifies which language generation and runtime the
the module (file) was compiled for, and is recorded in the module (file) was compiled for, and is recorded in the module
module descriptor. */ descriptor. */
#define OBJC_VERSION (flag_objc_abi >= 1 ? 7 : 6) #define OBJC_VERSION (flag_objc_abi >= 1 ? 7 : 6)
#define UTAG_CLASS_EXT "_objc_class_ext" #define UTAG_CLASS_EXT "_objc_class_ext"
...@@ -96,10 +97,10 @@ along with GCC; see the file COPYING3. If not see ...@@ -96,10 +97,10 @@ along with GCC; see the file COPYING3. If not see
#define CLS_HAS_CXX_STRUCTORS 0x2000L #define CLS_HAS_CXX_STRUCTORS 0x2000L
/* rt_trees identifiers - shared between NeXT implementations. These allow /* rt_trees identifiers - shared between NeXT implementations. These
the FE to tag meta-data in a manner that survives LTO and can be used when allow the FE to tag meta-data in a manner that survives LTO and can
the runtime requires that certain meta-data items appear in particular be used when the runtime requires that certain meta-data items
named sections. */ appear in particular named sections. */
#include "objc-next-metadata-tags.h" #include "objc-next-metadata-tags.h"
extern GTY(()) tree objc_rt_trees[OCTI_RT_META_MAX]; extern GTY(()) tree objc_rt_trees[OCTI_RT_META_MAX];
...@@ -187,14 +188,15 @@ objc_next_runtime_abi_01_init (objc_runtime_hooks *rthooks) ...@@ -187,14 +188,15 @@ objc_next_runtime_abi_01_init (objc_runtime_hooks *rthooks)
return true; return true;
} }
/* We need a way to convey what kind of meta-data are represented by a given /* We need a way to convey what kind of meta-data are represented by a
variable, since each type is expected (by the runtime) to be found in a given variable, since each type is expected (by the runtime) to be
specific named section. The solution must be usable with LTO. found in a specific named section. The solution must be usable
with LTO.
The scheme used for NeXT ABI 0/1 (partial matching of variable names) is not The scheme used for NeXT ABI 0/1 (partial matching of variable
satisfactory for LTO & ABI-2. We now tag ObjC meta-data with identification names) is not satisfactory for LTO & ABI-2. We now tag ObjC
attributes in the front end. The back-end may choose to act on these as it meta-data with identification attributes in the front end. The
requires. */ back-end may choose to act on these as it requires. */
static void static void
next_runtime_abi_01_init_metadata_attributes (void) next_runtime_abi_01_init_metadata_attributes (void)
...@@ -252,7 +254,8 @@ static void next_runtime_01_initialize (void) ...@@ -252,7 +254,8 @@ static void next_runtime_01_initialize (void)
tree type; tree type;
#ifdef OBJCPLUS #ifdef OBJCPLUS
/* For all NeXT objc ABIs -fobjc-call-cxx-cdtors is on by default. */ /* For all NeXT objc ABIs -fobjc-call-cxx-cdtors is on by
default. */
if (!global_options_set.x_flag_objc_call_cxx_cdtors) if (!global_options_set.x_flag_objc_call_cxx_cdtors)
global_options.x_flag_objc_call_cxx_cdtors = 1; global_options.x_flag_objc_call_cxx_cdtors = 1;
#endif #endif
...@@ -265,7 +268,8 @@ static void next_runtime_01_initialize (void) ...@@ -265,7 +268,8 @@ static void next_runtime_01_initialize (void)
objc_prop_list_ptr = build_pointer_type (xref_tag (RECORD_TYPE, objc_prop_list_ptr = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier ("_prop_list_t"))); get_identifier ("_prop_list_t")));
/* Declare type of selector-objects that represent an operation name. */ /* Declare type of selector-objects that represent an operation
name. */
/* `struct objc_selector *' */ /* `struct objc_selector *' */
objc_selector_type = build_pointer_type (xref_tag (RECORD_TYPE, objc_selector_type = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (TAG_SELECTOR))); get_identifier (TAG_SELECTOR)));
...@@ -306,8 +310,8 @@ static void next_runtime_01_initialize (void) ...@@ -306,8 +310,8 @@ static void next_runtime_01_initialize (void)
NULL, NULL_TREE); NULL, NULL_TREE);
/* These can throw, because the function that gets called can throw /* These can throw, because the function that gets called can throw
in Obj-C++, or could itself call something that can throw even in Obj-C++, or could itself call something that can throw even in
in Obj-C. */ Obj-C. */
TREE_NOTHROW (umsg_decl) = 0; TREE_NOTHROW (umsg_decl) = 0;
TREE_NOTHROW (umsg_nonnil_decl) = 0; TREE_NOTHROW (umsg_nonnil_decl) = 0;
TREE_NOTHROW (umsg_stret_decl) = 0; TREE_NOTHROW (umsg_stret_decl) = 0;
...@@ -357,7 +361,8 @@ static void next_runtime_01_initialize (void) ...@@ -357,7 +361,8 @@ static void next_runtime_01_initialize (void)
objc_get_meta_class_decl objc_get_meta_class_decl
= add_builtin_function (TAG_GETMETACLASS, type, 0, NOT_BUILT_IN, NULL, NULL_TREE); = add_builtin_function (TAG_GETMETACLASS, type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
/* This is the type of all of the following functions objc_copyStruct(). */ /* This is the type of all of the following functions
objc_copyStruct(). */
type = build_function_type_list (void_type_node, type = build_function_type_list (void_type_node,
ptr_type_node, ptr_type_node,
const_ptr_type_node, const_ptr_type_node,
...@@ -385,7 +390,8 @@ static void next_runtime_01_initialize (void) ...@@ -385,7 +390,8 @@ static void next_runtime_01_initialize (void)
/* --- templates --- */ /* --- templates --- */
/* struct _objc_class { /* struct _objc_class
{
struct _objc_class *isa; struct _objc_class *isa;
struct _objc_class *super_class; struct _objc_class *super_class;
char *name; char *name;
...@@ -405,8 +411,9 @@ static void next_runtime_01_initialize (void) ...@@ -405,8 +411,9 @@ static void next_runtime_01_initialize (void)
#endif #endif
}; */ }; */
/* The 'sel_id' & 'gc_object_type' fields are not used by the NeXT runtime. /* The 'sel_id' & 'gc_object_type' fields are not used by the NeXT
We generate them for ABI==0 to maintain backward binary compatibility. */ runtime. We generate them for ABI==0 to maintain backward binary
compatibility. */
static void static void
build_v1_class_template (void) build_v1_class_template (void)
...@@ -474,16 +481,17 @@ build_v1_class_template (void) ...@@ -474,16 +481,17 @@ build_v1_class_template (void)
objc_finish_struct (objc_class_template, decls); objc_finish_struct (objc_class_template, decls);
} }
/* struct _objc_category { /* struct _objc_category
{
char *category_name; char *category_name;
char *class_name; char *class_name;
struct _objc_method_list *instance_methods; struct _objc_method_list *instance_methods;
struct _objc_method_list *class_methods; struct _objc_method_list *class_methods;
struct _objc_protocol_list *protocols; struct _objc_protocol_list *protocols;
if ABI=1 #if ABI=1
uint32_t size; // sizeof (struct _objc_category) uint32_t size; // sizeof (struct _objc_category)
struct _objc_property_list *instance_properties; // category's own @property decl. struct _objc_property_list *instance_properties; // category's own @property decl.
END #endif
}; */ }; */
static void static void
...@@ -526,11 +534,13 @@ build_v1_category_template (void) ...@@ -526,11 +534,13 @@ build_v1_category_template (void)
/* Begin code generation for protocols... /* Begin code generation for protocols...
Modified for ObjC #1 extensions. */ Modified for ObjC #1 extensions. */
/* struct _objc_protocol { /* struct _objc_protocol
IF ABI=1 {
#if ABI=1
struct _objc_protocol_extension *isa; struct _objc_protocol_extension *isa;
ElSE #else
struct _objc_class *isa; struct _objc_class *isa;
#endif
char *protocol_name; char *protocol_name;
struct _objc_protocol **protocol_list; struct _objc_protocol **protocol_list;
...@@ -1789,8 +1799,7 @@ generate_v1_category (struct imp_entry *impent) ...@@ -1789,8 +1799,7 @@ generate_v1_category (struct imp_entry *impent)
impent->class_decl = cat_decl; impent->class_decl = cat_decl;
} }
/* This routine builds the class extension used by v1 NeXT. /* This routine builds the class extension used by v1 NeXT. */
*/
static tree static tree
generate_objc_class_ext (tree property_list, tree context) generate_objc_class_ext (tree property_list, tree context)
...@@ -2357,6 +2366,9 @@ objc_generate_v1_next_metadata (void) ...@@ -2357,6 +2366,9 @@ objc_generate_v1_next_metadata (void)
tree chain, attr; tree chain, attr;
long vers; long vers;
/* FIXME: Make sure that we generate no metadata if there is nothing
to put into it. */
if (objc_static_instances) if (objc_static_instances)
gcc_unreachable (); /* Not for NeXT */ gcc_unreachable (); /* Not for NeXT */
......
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