From patchwork Fri Feb 18 23:48:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 83667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 501BFB708B for ; Sat, 19 Feb 2011 10:48:58 +1100 (EST) Received: (qmail 21869 invoked by alias); 18 Feb 2011 23:48:56 -0000 Received: (qmail 21861 invoked by uid 22791); 18 Feb 2011 23:48:54 -0000 X-SWARE-Spam-Status: No, hits=-0.1 required=5.0 tests=AWL, BAYES_50, TW_BJ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Feb 2011 23:48:46 +0000 Received: from eggs.gnu.org ([140.186.70.92]:35577) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Pqa44-0003DZ-P4 for gcc-patches@gnu.org; Fri, 18 Feb 2011 18:48:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pqa42-0005kp-QL for gcc-patches@gnu.org; Fri, 18 Feb 2011 18:48:44 -0500 Received: from smtp181.iad.emailsrvr.com ([207.97.245.181]:60735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pqa42-0005kj-Kt for gcc-patches@gnu.org; Fri, 18 Feb 2011 18:48:42 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp38.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id D72013482F8 for ; Fri, 18 Feb 2011 18:48:41 -0500 (EST) Received: from dynamic1.wm-web.iad.mlsrvr.com (dynamic1.wm-web.iad1a.rsapps.net [192.168.2.150]) by smtp38.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id BE191348204 for ; Fri, 18 Feb 2011 18:48:41 -0500 (EST) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic1.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id AD5D8C98070 for ; Fri, 18 Feb 2011 18:48:41 -0500 (EST) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Sat, 19 Feb 2011 00:48:41 +0100 (CET) Date: Sat, 19 Feb 2011 00:48:41 +0100 (CET) Subject: Updated comments in objc/ From: "Nicola Pero" To: "gcc-patches@gnu.org" MIME-Version: 1.0 X-Type: plain Message-ID: <1298072921.706819888@192.168.4.58> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 207.97.245.181 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch updates the comments in the files in objc/. I added FIXMEs and TODOs for the various items that were discussed. Ok to commit ? Thanks Index: ChangeLog =================================================================== --- ChangeLog (revision 170291) +++ ChangeLog (working copy) @@ -1,3 +1,12 @@ +2011-01-18 Nicola Pero + + * 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-02-17 Iain Sandoe * config-lang.in (gtfiles): Updated. Index: objc-runtime-shared-support.c =================================================================== --- objc-runtime-shared-support.c (revision 170291) +++ objc-runtime-shared-support.c (working copy) @@ -507,7 +507,10 @@ build_module_descriptor (long vers, tree attr) /* Create an instance of "_objc_module". */ 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 is referenced by the runtime and, therefore, needed. */ Index: objc-act.c =================================================================== --- objc-act.c (revision 170291) +++ objc-act.c (working copy) @@ -6553,6 +6553,7 @@ start_class (enum tree_code code, tree class_name, { tree name = TREE_PURPOSE (attribute); + /* TODO: Document what the objc_exception attribute is/does. */ /* We handle the 'deprecated' and (undocumented) 'objc_exception' attributes. */ if (is_attribute_p ("deprecated", name)) @@ -7505,10 +7506,6 @@ objc_gen_property_data (tree klass, tree class_met /* @dynamic property - nothing to check or synthesize. */ if (PROPERTY_DYNAMIC (x)) 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. */ if (PROPERTY_IVAR_NAME (x)) @@ -7771,7 +7768,6 @@ objc_declare_protocols (tree names, tree attribute add_protocol (protocol); PROTOCOL_DEFINED (protocol) = 0; PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE; -/* PROTOCOL_V2_FORWARD_DECL (protocol) = NULL_TREE;*/ if (attributes) { @@ -7824,7 +7820,6 @@ start_protocol (enum tree_code code, tree name, tr add_protocol (protocol); PROTOCOL_DEFINED (protocol) = 1; PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE; -/* PROTOCOL_V2_FORWARD_DECL (protocol) = NULL_TREE;*/ check_protocol_recursively (protocol, list); } @@ -8466,10 +8461,11 @@ void objc_clear_super_receiver (void) { if (objc_method_context - && UOBJC_SUPER_scope == objc_get_current_scope ()) { - UOBJC_SUPER_decl = 0; - UOBJC_SUPER_scope = 0; - } + && UOBJC_SUPER_scope == objc_get_current_scope ()) + { + UOBJC_SUPER_decl = 0; + UOBJC_SUPER_scope = 0; + } } void @@ -10357,26 +10353,32 @@ encode_field_decl (tree field_decl, int curtype, i encode_type (TREE_TYPE (field_decl), curtype, format); } -/* This routine encodes the attribute of the input PROPERTY according to following - formula: +/* This routine encodes the attribute of the input PROPERTY according + to following formula: -Property attributes are stored as a comma-delimited C string. The simple attributes -readonly and copies are encoded as single characters. The parametrized attributes, -getter=name, setter=name, and ivar=name, are encoded as single characters, followed -by an identifier. Property types are also encoded as a parametrized attribute. The -characters used to encode these attributes are defined by the following enumeration: + Property attributes are stored as a comma-delimited C string. + Simple attributes such as readonly are encoded as single + character. The parametrized attributes, getter=name and + setter=name, are encoded as a single character followed by an + identifier. Property types are also encoded as a parametrized + attribute. The characters used to encode these attributes are + defined by the following enumeration: -enum PropertyAttributes { - kPropertyReadOnly = 'r', // property is read-only. - kPropertyCopies = 'c', // property is a copy of the value last assigned - kPropertyGetter = 'g', // followed by getter selector name - kPropertySetter = 's', // followed by setter selector name - kPropertyInstanceVariable = 'i' // followed by instance variable name - kPropertyType = 't' // followed by old-style type encoding. -}; + enum PropertyAttributes { + kPropertyReadOnly = 'R', + kPropertyBycopy = 'C', + kPropertyByref = '&', + kPropertyDynamic = 'D', + kPropertyGetter = 'G', + kPropertySetter = 'S', + kPropertyInstanceVariable = 'V', + kPropertyType = 't', + kPropertyWeak = 'W', + kPropertyStrong = 'S', + kPropertyNonAtomic = 'N' + }; -*/ - + FIXME: Update the implementation to match. */ tree objc_v2_encode_prop_attr (tree property) { Index: objc-next-runtime-abi-02.c =================================================================== --- objc-next-runtime-abi-02.c (revision 170291) +++ objc-next-runtime-abi-02.c (working copy) @@ -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. - This version is intended to match (logically) output of Apple's 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). -*/ + This version is intended to match (logically) the output of Apple's + 4.2.1 compiler. */ #include "config.h" #include "system.h" Index: objc-runtime-hooks.h =================================================================== --- objc-runtime-hooks.h (revision 170291) +++ objc-runtime-hooks.h (working copy) @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see /* 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 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 and so on, and the purpose of this interface is to abstract such differences from the parser's perspective. */ +/* TODO: Do we want the initial underscore ? */ typedef struct _objc_runtime_hooks_r { + /* TODO: Expand comments in this file. */ + /* Initialize for this runtime. */ void (*initialize) (void); const char *default_constant_string_class_name; Index: objc-act.h =================================================================== --- objc-act.h (revision 170291) +++ objc-act.h (working copy) @@ -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 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 PROTOCOL_NAME(CLASS) ((CLASS)->type.name) @@ -396,6 +397,7 @@ enum objc_tree_index OCTI_GET_PROPERTY_STRUCT_DECL, OCTI_SET_PROPERTY_STRUCT_DECL, + /* TODO: Add comment. */ /* "V1" stuff. */ OCTI_V1_PROP_LIST_TEMPL, OCTI_V1_PROP_NAME_ATTR_CHAIN, @@ -586,6 +588,7 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX]; #define objc_setPropertyStruct_decl \ objc_global_trees[OCTI_SET_PROPERTY_STRUCT_DECL] +/* TODO: Add comment. */ /* V1 stuff. */ #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] Index: objc-gnu-runtime-abi-01.c =================================================================== --- objc-gnu-runtime-abi-01.c (revision 170291) +++ objc-gnu-runtime-abi-01.c (working copy) @@ -1,4 +1,4 @@ -/* GNU Runtime (ABI-0/1) private. +/* GNU Runtime ABI version 8 Copyright (C) 2011 Free Software Foundation, Inc. Contributed by Iain Sandoe (split from objc-act.c) @@ -83,6 +83,7 @@ along with GCC; see the file COPYING3. If not see if (VERS) \ DECL_ATTRIBUTES (DECL) = build_tree_list ((VERS), (KIND)); +/* FIXME: Remove this macro, not needed. */ #ifndef TARGET_64BIT #define TARGET_64BIT 0 #endif @@ -143,6 +144,10 @@ objc_gnu_runtime_abi_01_init (objc_runtime_hooks * 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->default_constant_string_class_name = DEF_CONSTANT_STRING_CLASS_NAME; rthooks->tag_getclass = TAG_GETCLASS; @@ -573,7 +578,8 @@ gnu_runtime_abi_01_get_class_reference (tree ident (IDENTIFIER_LENGTH (ident) + 1, 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); } @@ -794,7 +800,7 @@ gnu_runtime_abi_01_get_protocol_reference (locatio 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 gnu_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED, @@ -837,7 +843,8 @@ gnu_runtime_abi_01_get_category_super_ref (locatio add_class_reference (super_name); 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, IDENTIFIER_POINTER (super_name)); /* super_class = get_{meta_}class("CLASS_SUPER_NAME"); */ @@ -1475,16 +1482,10 @@ generate_category (struct imp_entry *impent) long instance_size; struct objc_ivar_list *ivars; struct objc_method_list *methods; - if (flag_next_runtime) - struct objc_cache *cache; - else { - struct sarray *dtable; - struct objc_class *subclass_list; - struct objc_class *sibling_class; - } + struct sarray *dtable; + struct objc_class *subclass_list; + struct objc_class *sibling_class; struct objc_protocol_list *protocols; - if (flag_next_runtime) - void *sel_id; void *gc_object_type; }; */ @@ -1542,6 +1543,7 @@ build_shared_structure_initializer (tree type, tre CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } + /* FIXME: Remove NeXT runtime code. */ if (flag_next_runtime) { ltyp = build_pointer_type (xref_tag (RECORD_TYPE, @@ -1573,6 +1575,7 @@ build_shared_structure_initializer (tree type, tre CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } + /* FIXME: Remove NeXT runtime code. */ if (flag_next_runtime) /* sel_id = NULL */ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0)); @@ -1864,6 +1867,7 @@ generate_static_references (void) char buf[BUFSIZE]; VEC(constructor_elt,gc) *decls = NULL; + /* FIXME: Remove NeXT runtime code. */ if (flag_next_runtime) gcc_unreachable (); @@ -1991,6 +1995,7 @@ build_objc_symtab_template (void) /* short cat_def_cnt; */ add_field_decl (short_integer_type_node, "cat_def_cnt", &chain); + /* FIXME: Remove. */ if (TARGET_64BIT) add_field_decl (integer_type_node, "_explicit_padder", &chain); @@ -2037,6 +2042,8 @@ init_objc_symtab (tree type) CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (short_integer_type_node, cat_count)); + + /* FIXME: Remove. */ if (TARGET_64BIT) CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, 0)); @@ -2044,8 +2051,11 @@ init_objc_symtab (tree type) /* cls_def = { ..., { &Foo, &Bar, ...}, ... } */ field = TYPE_FIELDS (type); + + /* FIXME: Remove. */ if (TARGET_64BIT) field = 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))); @@ -2104,6 +2114,9 @@ objc_generate_v1_gnu_metadata (void) if (protocol_chain) generate_protocols (); + /* FIXME: Only generate metadata if there is anything to put in + there. */ + /* Arrange for ObjC data structures to be initialized at run time. */ generate_objc_symtab_decl (); /* Make sure that the meta-data are identified as being GNU-runtime. */