/* * Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ // Values for class_ro_t->flags // These are emitted by the compiler and are part of the ABI. // class is a metaclass #define RO_META (1<<0) // class is a root class #define RO_ROOT (1<<1) // class has .cxx_construct/destruct implementations #define RO_HAS_CXX_STRUCTORS (1<<2) // class has +load implementation // #define RO_HAS_LOAD_METHOD (1<<3) // class has visibility=hidden set #define RO_HIDDEN (1<<4) // class has attribute(objc_exception): OBJC_EHTYPE_$_ThisClass is non-weak #define RO_EXCEPTION (1<<5) // class is in an unloadable bundle - must never be set by compiler #define RO_FROM_BUNDLE (1<<29) // class is unrealized future class - must never be set by compiler #define RO_FUTURE (1<<30) // class is realized - must never be set by compiler #define RO_REALIZED (1<<31) // Values for class_rw_t->flags // These are not emitted by the compiler and are never used in class_ro_t. // Their presence should be considered in future ABI versions. // class_t->data is class_rw_t, not class_ro_t #define RW_REALIZED (1<<31) // class is unresolved future class #define RW_FUTURE (1<<30) // class is initialized #define RW_INITIALIZED (1<<29) // class is initializing #define RW_INITIALIZING (1<<28) // class_rw_t->ro is heap copy of class_ro_t #define RW_COPIED_RO (1<<27) // class allocated but not yet registered #define RW_CONSTRUCTING (1<<26) // class allocated and registered #define RW_CONSTRUCTED (1<<25) // GC: class has unsafe finalize method #define RW_FINALIZE_ON_MAIN_THREAD (1<<24) // class +load has been called #define RW_LOADED (1<<23) // class does not share super's vtable #define RW_SPECIALIZED_VTABLE (1<<22) // class instances may have associative references #define RW_INSTANCES_HAVE_ASSOCIATED_OBJECTS (1<<21) typedef struct method_t { SEL name; const char *types; IMP imp; } method_t; typedef struct method_list_t { uint32_t entsize_NEVER_USE; // low 2 bits used for fixup markers uint32_t count; struct method_t first; } method_list_t; typedef struct ivar_t { // *offset is 64-bit by accident even though other // fields restrict total instance size to 32-bit. uintptr_t *offset; const char *name; const char *type; // alignment is sometimes -1; use ivar_alignment() instead uint32_t alignment __attribute__((deprecated)); uint32_t size; } ivar_t; typedef struct ivar_list_t { uint32_t entsize; uint32_t count; struct ivar_t first; } ivar_list_t; typedef uintptr_t protocol_ref_t; // protocol_t *, but unremapped typedef struct protocol_t { id isa; const char *name; struct protocol_list_t *protocols; method_list_t *instanceMethods; method_list_t *classMethods; method_list_t *optionalInstanceMethods; method_list_t *optionalClassMethods; struct objc_property_list *instanceProperties; } protocol_t; typedef struct protocol_list_t { // count is 64-bit by accident. uintptr_t count; protocol_ref_t list[0]; // variable-size } protocol_list_t; typedef struct class_ro_t { uint32_t flags; uint32_t instanceStart; uint32_t instanceSize; #ifdef __LP64__ uint32_t reserved; #endif const uint8_t * ivarLayout; const char * name; const method_list_t * baseMethods; const protocol_list_t * baseProtocols; const ivar_list_t * ivars; const uint8_t * weakIvarLayout; const struct objc_property_list *baseProperties; } class_ro_t; typedef struct class_rw_t { uint32_t flags; uint32_t version; const class_ro_t *ro; struct method_list_t **methods; struct chained_property_list *properties; struct protocol_list_t ** protocols; struct class_t *firstSubclass; struct class_t *nextSiblingClass; } class_rw_t; typedef struct class_t { struct class_t *isa; struct class_t *superclass; Cache cache; IMP *vtable; class_rw_t *data; } class_t; typedef struct category_t { const char *name; struct class_t *cls; struct method_list_t *instanceMethods; struct method_list_t *classMethods; struct protocol_list_t *protocols; struct objc_property_list *instanceProperties; } category_t; struct objc_super2 { id receiver; Class current_class; };