From patchwork Tue Jun 7 22:07:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 99334 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 36466B6F91 for ; Wed, 8 Jun 2011 08:08:23 +1000 (EST) Received: (qmail 9135 invoked by alias); 7 Jun 2011 22:08:21 -0000 Received: (qmail 9125 invoked by uid 22791); 7 Jun 2011 22:08:19 -0000 X-SWARE-Spam-Status: No, hits=-0.0 required=5.0 tests=AWL, BAYES_50, SARE_SUB_ENC_UTF8, 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; Tue, 07 Jun 2011 22:08:05 +0000 Received: from eggs.gnu.org ([140.186.70.92]:54400) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1QU4RQ-00015d-0m for gcc-patches@gnu.org; Tue, 07 Jun 2011 18:08:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QU4RM-0002hB-TJ for gcc-patches@gnu.org; Tue, 07 Jun 2011 18:08:03 -0400 Received: from smtp151.iad.emailsrvr.com ([207.97.245.151]:34085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QU4RM-0002gy-DW for gcc-patches@gnu.org; Tue, 07 Jun 2011 18:08:00 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp45.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 798631780AC for ; Tue, 7 Jun 2011 18:07:59 -0400 (EDT) Received: from dynamic5.wm-web.iad.mlsrvr.com (dynamic5.wm-web.iad1a.rsapps.net [192.168.2.146]) by smtp45.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 5979E1780B1 for ; Tue, 7 Jun 2011 18:07:59 -0400 (EDT) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic5.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id 289CC12E0069 for ; Tue, 7 Jun 2011 18:07:59 -0400 (EDT) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Wed, 8 Jun 2011 00:07:59 +0200 (CEST) Date: Wed, 8 Jun 2011 00:07:59 +0200 (CEST) Subject: =?utf-8?Q?libobjc=3A_Remove_unused_code_=28patch_3=29?= From: "Nicola Pero" To: "gcc-patches@gnu.org" MIME-Version: 1.0 X-Type: plain Message-ID: <1307484479.164623660@www2.webmail.us> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 207.97.245.151 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 More of the same. Committed to trunk. Thanks Index: objc-private/module-abi-8.h =================================================================== --- objc-private/module-abi-8.h (revision 174766) +++ objc-private/module-abi-8.h (working copy) @@ -277,12 +277,6 @@ struct objc_class { (cls)->info >>= (HOST_BITS_PER_LONG/2); \ __CLS_SETINFO(cls, (((unsigned long)num) << (HOST_BITS_PER_LONG/2))); }) -static inline long -class_get_instance_size(Class _class) -{ - return CLS_ISCLASS(_class)?_class->instance_size:0; -} - /* The compiler generates one of these structures for each category. A class may have many categories and contain both instance and factory methods. */ Index: selector.c =================================================================== --- selector.c (revision 174766) +++ selector.c (working copy) @@ -227,7 +227,7 @@ sel_isEqual (SEL s1, SEL s2) /* Return YES iff t1 and t2 have same method types. Ignore the argframe layout. */ -BOOL +static BOOL sel_types_match (const char *t1, const char *t2) { if (! t1 || ! t2) @@ -252,83 +252,6 @@ sel_types_match (const char *t1, const char *t2) return NO; } -/* Return selector representing name. In the Modern API, you'd - normally use sel_registerTypedName() for this, which does the same - but would register the selector with the runtime if not registered - yet (if you only want to check for selectors without registering, - use sel_copyTypedSelectorList()). */ -SEL -sel_get_typed_uid (const char *name, const char *types) -{ - struct objc_list *l; - sidx i; - - objc_mutex_lock (__objc_runtime_mutex); - - i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name); - if (i == 0) - { - objc_mutex_unlock (__objc_runtime_mutex); - return 0; - } - - for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i); - l; l = l->tail) - { - SEL s = (SEL) l->head; - if (types == 0 || s->sel_types == 0) - { - if (s->sel_types == types) - { - objc_mutex_unlock (__objc_runtime_mutex); - return s; - } - } - else if (sel_types_match (s->sel_types, types)) - { - objc_mutex_unlock (__objc_runtime_mutex); - return s; - } - } - - objc_mutex_unlock (__objc_runtime_mutex); - return 0; -} - -/* Return selector representing name; prefer a selector with non-NULL - type. In the Modern API, sel_getTypedSelector() is similar but - returns NULL if a typed selector couldn't be found. */ -SEL -sel_get_any_typed_uid (const char *name) -{ - struct objc_list *l; - sidx i; - SEL s = NULL; - - objc_mutex_lock (__objc_runtime_mutex); - - i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name); - if (i == 0) - { - objc_mutex_unlock (__objc_runtime_mutex); - return 0; - } - - for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i); - l; l = l->tail) - { - s = (SEL) l->head; - if (s->sel_types) - { - objc_mutex_unlock (__objc_runtime_mutex); - return s; - } - } - - objc_mutex_unlock (__objc_runtime_mutex); - return s; -} - /* Return selector representing name. */ SEL sel_get_any_uid (const char *name) @@ -493,15 +416,6 @@ const char *sel_getName (SEL selector) return ret; } -/* Traditional GNU Objective-C Runtime API. */ -const char *sel_get_name (SEL selector) -{ - if (selector == NULL) - return 0; - - return sel_getName (selector); -} - BOOL sel_is_mapped (SEL selector) { @@ -517,12 +431,6 @@ const char *sel_getTypeEncoding (SEL selector) return 0; } -/* Traditional GNU Objective-C Runtime API. */ -const char *sel_get_type (SEL selector) -{ - return sel_getTypeEncoding (selector); -} - /* The uninstalled dispatch table. */ extern struct sarray *__objc_uninstalled_dtable; @@ -707,14 +615,7 @@ sel_registerName (const char *name) return ret; } -/* Traditional GNU Objective-C Runtime API. */ SEL -sel_register_name (const char *name) -{ - return sel_registerName (name); -} - -SEL sel_registerTypedName (const char *name, const char *type) { SEL ret; @@ -732,22 +633,9 @@ sel_registerTypedName (const char *name, const cha return ret; } -SEL -sel_register_typed_name (const char *name, const char *type) -{ - return sel_registerTypedName (name, type); -} - /* Return the selector representing name. */ SEL sel_getUid (const char *name) { return sel_registerTypedName (name, 0); } - -/* Traditional GNU Objective-C Runtime API. */ -SEL -sel_get_uid (const char *name) -{ - return sel_getUid (name); -} Index: error.c =================================================================== --- error.c (revision 174766) +++ error.c (working copy) @@ -26,10 +26,6 @@ see the files COPYING3 and COPYING.RUNTIME respect #include "objc-private/common.h" #include "objc-private/error.h" -/* __USE_FIXED_PROTOTYPES__ used to be required to get prototypes for - malloc, free, etc. on some platforms. It is unclear if we still - need it, but it can't hurt. */ -#define __USE_FIXED_PROTOTYPES__ #include #include #include Index: objects.c =================================================================== --- objects.c (revision 174766) +++ objects.c (working copy) @@ -67,12 +67,6 @@ class_createInstance (Class class, size_t extraByt /* Traditional GNU Objective-C Runtime API. */ id -class_create_instance (Class class) -{ - return class_createInstance (class, 0); -} - -id object_copy (id object, size_t extraBytes) { if ((object != nil) && CLS_ISCLASS (object->class_pointer)) @@ -122,4 +116,3 @@ object_setClass (id object, Class class_) return old_class; } } - Index: ChangeLog =================================================================== --- ChangeLog (revision 174768) +++ ChangeLog (working copy) @@ -1,5 +1,21 @@ 2011-06-07 Nicola Pero + * objc-private/module-abi-8.h (class_get_instance_size): Removed. + * objects.c (class_create_instance): Removed. + * error.c (__USE_FIXED_PROTOTYPES__): Removed. + * gc.c (__objc_generate_gc_type_description): Use + class_getInstanceSize() instead of class_get_instance_size(). + * selector.c (sel_types_match): Made static. + (sel_get_typed_uid): Removed. + (sel_get_any_typed_uid): Removed. + (sel_get_name): Removed. + (sel_get_type): Removed. + (sel_register_name): Removed. + (sel_register_typed_name): Removed. + (sel_get_uid): Removed. + +2011-06-07 Nicola Pero + * encoding.c (method_get_number_of_arguments): Removed. (method_get_sizeof_arguments): Removed. Index: gc.c =================================================================== --- gc.c (revision 174766) +++ gc.c (working copy) @@ -304,7 +304,7 @@ __objc_generate_gc_type_description (Class class) /* The number of bits in the mask is the size of an instance in bytes divided by the size of a pointer. */ - bits_no = (ROUND (class_get_instance_size (class), sizeof (void *)) + bits_no = (ROUND (class_getInstanceSize (class), sizeof (void *)) / sizeof (void *)); size = ROUND (bits_no, BITS_PER_WORD) / BITS_PER_WORD; mask = objc_atomic_malloc (size * sizeof (int));