encoding.h: Fix formatting.
2002-07-02 Rodney Brown <rbrown64@csc.com.au> * objc/encoding.h: Fix formatting. * objc/hash.h: Likewise. * objc/objc-api.h: Likewise. * objc/runtime.h: Likewise. * objc/thr.h: Likewise. * archive.c: Likewise. * class.c: Likewise. * encoding.c: Likewise. * gc.c: Likewise. * hash.c: Likewise. * init.c: Likewise. * misc.c: Likewise. * nil_method.c: Likewise. * objects.c: Likewise. * sarray.c: Likewise. * selector.c: Likewise. * sendmsg.c: Likewise. * thr-mach.c: Likewise. * thr.c: Likewise. From-SVN: r55190
This commit is contained in:
parent
52702ae16e
commit
40165636b5
|
@ -1,3 +1,25 @@
|
||||||
|
2002-07-02 Rodney Brown <rbrown64@csc.com.au>
|
||||||
|
|
||||||
|
* objc/encoding.h: Fix formatting.
|
||||||
|
* objc/hash.h: Likewise.
|
||||||
|
* objc/objc-api.h: Likewise.
|
||||||
|
* objc/runtime.h: Likewise.
|
||||||
|
* objc/thr.h: Likewise.
|
||||||
|
* archive.c: Likewise.
|
||||||
|
* class.c: Likewise.
|
||||||
|
* encoding.c: Likewise.
|
||||||
|
* gc.c: Likewise.
|
||||||
|
* hash.c: Likewise.
|
||||||
|
* init.c: Likewise.
|
||||||
|
* misc.c: Likewise.
|
||||||
|
* nil_method.c: Likewise.
|
||||||
|
* objects.c: Likewise.
|
||||||
|
* sarray.c: Likewise.
|
||||||
|
* selector.c: Likewise.
|
||||||
|
* sendmsg.c: Likewise.
|
||||||
|
* thr-mach.c: Likewise.
|
||||||
|
* thr.c: Likewise.
|
||||||
|
|
||||||
2002-06-25 DJ Delorie <dj@redhat.com>
|
2002-06-25 DJ Delorie <dj@redhat.com>
|
||||||
|
|
||||||
* aclocal.m4 (GLIBCPP_CONFIGURE): Split out
|
* aclocal.m4 (GLIBCPP_CONFIGURE): Split out
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* GNU Objective C Runtime archiving
|
/* GNU Objective C Runtime archiving
|
||||||
Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
||||||
Contributed by Kresten Krab Thorup
|
Contributed by Kresten Krab Thorup
|
||||||
|
|
||||||
This file is part of GNU CC.
|
This file is part of GNU CC.
|
||||||
|
@ -908,7 +908,7 @@ objc_read_class (struct objc_typed_stream* stream, Class* class)
|
||||||
if (key)
|
if (key)
|
||||||
objc_error (nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
|
objc_error (nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
|
||||||
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
|
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
|
||||||
(*class) = hash_value_for_key (stream->stream_table, LONG2PTR(key));
|
*class = hash_value_for_key (stream->stream_table, LONG2PTR(key));
|
||||||
if (! *class)
|
if (! *class)
|
||||||
objc_error (nil, OBJC_ERR_BAD_CLASS,
|
objc_error (nil, OBJC_ERR_BAD_CLASS,
|
||||||
"cannot find class for key %lu", key);
|
"cannot find class for key %lu", key);
|
||||||
|
@ -1031,7 +1031,8 @@ objc_write_type(TypedStream* stream, const char* type, const void* data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _C_CHARPTR:
|
case _C_CHARPTR:
|
||||||
return objc_write_string (stream, *(char**)data, strlen(*(char**)data));
|
return objc_write_string (stream,
|
||||||
|
*(char **) data, strlen (*(char **) data));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _C_ATOM:
|
case _C_ATOM:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* GNU Objective C Runtime class related functions
|
/* GNU Objective C Runtime class related functions
|
||||||
Copyright (C) 1993, 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1995, 1996, 1997, 2001, 2002
|
||||||
|
Free Software Foundation, Inc.
|
||||||
Contributed by Kresten Krab Thorup and Dennis Glatting.
|
Contributed by Kresten Krab Thorup and Dennis Glatting.
|
||||||
|
|
||||||
Lock-free class table code designed and written from scratch by
|
Lock-free class table code designed and written from scratch by
|
||||||
|
@ -339,7 +340,7 @@ class_table_next (struct class_table_enumerator **e)
|
||||||
#if 0 /* DEBUGGING FUNCTIONS */
|
#if 0 /* DEBUGGING FUNCTIONS */
|
||||||
/* Debugging function - print the class table. */
|
/* Debugging function - print the class table. */
|
||||||
void
|
void
|
||||||
class_table_print ()
|
class_table_print (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -362,7 +363,7 @@ class_table_print ()
|
||||||
function of hash key values. Useful to evaluate the hash function
|
function of hash key values. Useful to evaluate the hash function
|
||||||
in real cases. */
|
in real cases. */
|
||||||
void
|
void
|
||||||
class_table_print_histogram ()
|
class_table_print_histogram (void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
@ -415,7 +416,8 @@ Class (*_objc_lookup_class)(const char* name) = 0; /* !T:SAFE */
|
||||||
BOOL __objc_class_links_resolved = NO; /* !T:UNUSED */
|
BOOL __objc_class_links_resolved = NO; /* !T:UNUSED */
|
||||||
|
|
||||||
|
|
||||||
void __objc_init_class_tables()
|
void
|
||||||
|
__objc_init_class_tables (void)
|
||||||
{
|
{
|
||||||
/* Allocate the class hash table. */
|
/* Allocate the class hash table. */
|
||||||
|
|
||||||
|
@ -465,7 +467,8 @@ __objc_add_class_to_hash(Class class)
|
||||||
/* Get the class object for the class named NAME. If NAME does not
|
/* Get the class object for the class named NAME. If NAME does not
|
||||||
identify a known class, the hook _objc_lookup_class is called. If
|
identify a known class, the hook _objc_lookup_class is called. If
|
||||||
this fails, nil is returned. */
|
this fails, nil is returned. */
|
||||||
Class objc_lookup_class (const char* name)
|
Class
|
||||||
|
objc_lookup_class (const char *name)
|
||||||
{
|
{
|
||||||
Class class;
|
Class class;
|
||||||
|
|
||||||
|
@ -539,7 +542,8 @@ objc_next_class(void **enum_state)
|
||||||
/* Resolve super/subclass links for all classes. The only thing we
|
/* Resolve super/subclass links for all classes. The only thing we
|
||||||
can be sure of is that the class_pointer for class objects point to
|
can be sure of is that the class_pointer for class objects point to
|
||||||
the right meta class objects. */
|
the right meta class objects. */
|
||||||
void __objc_resolve_class_links()
|
void
|
||||||
|
__objc_resolve_class_links (void)
|
||||||
{
|
{
|
||||||
struct class_table_enumerator *es = NULL;
|
struct class_table_enumerator *es = NULL;
|
||||||
Class object_class = objc_get_class ("Object");
|
Class object_class = objc_get_class ("Object");
|
||||||
|
@ -560,7 +564,7 @@ void __objc_resolve_class_links()
|
||||||
class. */
|
class. */
|
||||||
class1->class_pointer->class_pointer = object_class->class_pointer;
|
class1->class_pointer->class_pointer = object_class->class_pointer;
|
||||||
|
|
||||||
if (!(CLS_ISRESOLV(class1)))
|
if (! CLS_ISRESOLV (class1))
|
||||||
{
|
{
|
||||||
CLS_SETRESOLV (class1);
|
CLS_SETRESOLV (class1);
|
||||||
CLS_SETRESOLV (class1->class_pointer);
|
CLS_SETRESOLV (class1->class_pointer);
|
||||||
|
|
|
@ -162,6 +162,7 @@ objc_sizeof_type (const char* type)
|
||||||
case _C_VOID:
|
case _C_VOID:
|
||||||
return sizeof (void);
|
return sizeof (void);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _C_PTR:
|
case _C_PTR:
|
||||||
case _C_ATOM:
|
case _C_ATOM:
|
||||||
case _C_CHARPTR:
|
case _C_CHARPTR:
|
||||||
|
@ -171,7 +172,8 @@ objc_sizeof_type (const char* type)
|
||||||
case _C_ARY_B:
|
case _C_ARY_B:
|
||||||
{
|
{
|
||||||
int len = atoi (type + 1);
|
int len = atoi (type + 1);
|
||||||
while (isdigit((unsigned char)*++type));
|
while (isdigit ((unsigned char)*++type))
|
||||||
|
;
|
||||||
return len * objc_aligned_size (type);
|
return len * objc_aligned_size (type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -183,7 +185,8 @@ objc_sizeof_type (const char* type)
|
||||||
int startByte, endByte;
|
int startByte, endByte;
|
||||||
|
|
||||||
position = atoi (type + 1);
|
position = atoi (type + 1);
|
||||||
while (isdigit ((unsigned char)*++type));
|
while (isdigit ((unsigned char)*++type))
|
||||||
|
;
|
||||||
size = atoi (type + 1);
|
size = atoi (type + 1);
|
||||||
|
|
||||||
startByte = position / BITS_PER_UNIT;
|
startByte = position / BITS_PER_UNIT;
|
||||||
|
@ -207,7 +210,8 @@ objc_sizeof_type (const char* type)
|
||||||
case _C_UNION_B:
|
case _C_UNION_B:
|
||||||
{
|
{
|
||||||
int max_size = 0;
|
int max_size = 0;
|
||||||
while (*type != _C_UNION_E && *type++ != '=') /* do nothing */;
|
while (*type != _C_UNION_E && *type++ != '=')
|
||||||
|
/* do nothing */;
|
||||||
while (*type != _C_UNION_E)
|
while (*type != _C_UNION_E)
|
||||||
{
|
{
|
||||||
/* Skip the variable name if any */
|
/* Skip the variable name if any */
|
||||||
|
@ -312,7 +316,8 @@ objc_alignof_type(const char* type)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _C_ARY_B:
|
case _C_ARY_B:
|
||||||
while (isdigit((unsigned char)*++type)) /* do nothing */;
|
while (isdigit ((unsigned char)*++type))
|
||||||
|
/* do nothing */;
|
||||||
return objc_alignof_type (type);
|
return objc_alignof_type (type);
|
||||||
|
|
||||||
case _C_STRUCT_B:
|
case _C_STRUCT_B:
|
||||||
|
@ -331,7 +336,8 @@ objc_alignof_type(const char* type)
|
||||||
case _C_UNION_B:
|
case _C_UNION_B:
|
||||||
{
|
{
|
||||||
int maxalign = 0;
|
int maxalign = 0;
|
||||||
while (*type != _C_UNION_E && *type++ != '=') /* do nothing */;
|
while (*type != _C_UNION_E && *type++ != '=')
|
||||||
|
/* do nothing */;
|
||||||
while (*type != _C_UNION_E)
|
while (*type != _C_UNION_E)
|
||||||
{
|
{
|
||||||
/* Skip the variable name if any */
|
/* Skip the variable name if any */
|
||||||
|
@ -449,7 +455,8 @@ objc_skip_typespec (const char* type)
|
||||||
return type;
|
return type;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (*++type != '"') /* do nothing */;
|
while (*++type != '"')
|
||||||
|
/* do nothing */;
|
||||||
return type + 1;
|
return type + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +485,8 @@ objc_skip_typespec (const char* type)
|
||||||
case _C_ARY_B:
|
case _C_ARY_B:
|
||||||
/* skip digits, typespec and closing ']' */
|
/* skip digits, typespec and closing ']' */
|
||||||
|
|
||||||
while(isdigit((unsigned char)*++type));
|
while (isdigit ((unsigned char)*++type))
|
||||||
|
;
|
||||||
type = objc_skip_typespec (type);
|
type = objc_skip_typespec (type);
|
||||||
if (*type == _C_ARY_E)
|
if (*type == _C_ARY_E)
|
||||||
return ++type;
|
return ++type;
|
||||||
|
@ -490,22 +498,32 @@ objc_skip_typespec (const char* type)
|
||||||
|
|
||||||
case _C_BFLD:
|
case _C_BFLD:
|
||||||
/* The new encoding of bitfields is: b 'position' 'type' 'size' */
|
/* The new encoding of bitfields is: b 'position' 'type' 'size' */
|
||||||
while (isdigit ((unsigned char)*++type)); /* skip position */
|
while (isdigit ((unsigned char)*++type))
|
||||||
while (isdigit ((unsigned char)*++type)); /* skip type and size */
|
; /* skip position */
|
||||||
|
while (isdigit ((unsigned char)*++type))
|
||||||
|
; /* skip type and size */
|
||||||
return type;
|
return type;
|
||||||
|
|
||||||
case _C_STRUCT_B:
|
case _C_STRUCT_B:
|
||||||
/* skip name, and elements until closing '}' */
|
/* skip name, and elements until closing '}' */
|
||||||
|
|
||||||
while (*type != _C_STRUCT_E && *type++ != '=');
|
while (*type != _C_STRUCT_E && *type++ != '=')
|
||||||
while (*type != _C_STRUCT_E) { type = objc_skip_typespec (type); }
|
;
|
||||||
|
while (*type != _C_STRUCT_E)
|
||||||
|
{
|
||||||
|
type = objc_skip_typespec (type);
|
||||||
|
}
|
||||||
return ++type;
|
return ++type;
|
||||||
|
|
||||||
case _C_UNION_B:
|
case _C_UNION_B:
|
||||||
/* skip name, and elements until closing ')' */
|
/* skip name, and elements until closing ')' */
|
||||||
|
|
||||||
while (*type != _C_UNION_E && *type++ != '=');
|
while (*type != _C_UNION_E && *type++ != '=')
|
||||||
while (*type != _C_UNION_E) { type = objc_skip_typespec (type); }
|
;
|
||||||
|
while (*type != _C_UNION_E)
|
||||||
|
{
|
||||||
|
type = objc_skip_typespec (type);
|
||||||
|
}
|
||||||
return ++type;
|
return ++type;
|
||||||
|
|
||||||
case _C_PTR:
|
case _C_PTR:
|
||||||
|
@ -528,8 +546,10 @@ objc_skip_typespec (const char* type)
|
||||||
inline const char *
|
inline const char *
|
||||||
objc_skip_offset (const char *type)
|
objc_skip_offset (const char *type)
|
||||||
{
|
{
|
||||||
if (*type == '+') type++;
|
if (*type == '+')
|
||||||
while(isdigit((unsigned char)*++type));
|
type++;
|
||||||
|
while (isdigit ((unsigned char) *++type))
|
||||||
|
;
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,8 +618,7 @@ method_get_sizeof_arguments (struct objc_method* mth)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
method_get_next_argument (arglist_t argframe,
|
method_get_next_argument (arglist_t argframe, const char **type)
|
||||||
const char **type)
|
|
||||||
{
|
{
|
||||||
const char *t = objc_skip_argspec (*type);
|
const char *t = objc_skip_argspec (*type);
|
||||||
|
|
||||||
|
@ -789,7 +808,9 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
|
||||||
{
|
{
|
||||||
desired_align = 1;
|
desired_align = 1;
|
||||||
/* Skip the bitfield's offset */
|
/* Skip the bitfield's offset */
|
||||||
for (bfld_type = type + 1; isdigit((unsigned char)*bfld_type); bfld_type++)
|
for (bfld_type = type + 1;
|
||||||
|
isdigit ((unsigned char) *bfld_type);
|
||||||
|
bfld_type++)
|
||||||
/* do nothing */;
|
/* do nothing */;
|
||||||
|
|
||||||
bfld_type_size = objc_sizeof_type (bfld_type) * BITS_PER_UNIT;
|
bfld_type_size = objc_sizeof_type (bfld_type) * BITS_PER_UNIT;
|
||||||
|
@ -809,7 +830,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
|
||||||
is meaningless. */
|
is meaningless. */
|
||||||
#ifndef PCC_BITFIELD_TYPE_MATTERS
|
#ifndef PCC_BITFIELD_TYPE_MATTERS
|
||||||
layout->record_align = MAX (layout->record_align, desired_align);
|
layout->record_align = MAX (layout->record_align, desired_align);
|
||||||
#else
|
#else /* PCC_BITFIELD_TYPE_MATTERS */
|
||||||
if (*type == _C_BFLD)
|
if (*type == _C_BFLD)
|
||||||
{
|
{
|
||||||
/* For these machines, a zero-length field does not
|
/* For these machines, a zero-length field does not
|
||||||
|
@ -841,7 +862,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
layout->record_align = MAX (layout->record_align, desired_align);
|
layout->record_align = MAX (layout->record_align, desired_align);
|
||||||
#endif
|
#endif /* PCC_BITFIELD_TYPE_MATTERS */
|
||||||
|
|
||||||
/* Does this field automatically have alignment it needs
|
/* Does this field automatically have alignment it needs
|
||||||
by virtue of the fields that precede it and the record's
|
by virtue of the fields that precede it and the record's
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Basic data types for Objective C.
|
/* Basic data types for Objective C.
|
||||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
|
||||||
Contributed by Ovidiu Predescu.
|
Contributed by Ovidiu Predescu.
|
||||||
|
|
||||||
This file is part of GNU CC.
|
This file is part of GNU CC.
|
||||||
|
|
190
libobjc/init.c
190
libobjc/init.c
|
@ -1,5 +1,5 @@
|
||||||
/* GNU Objective C Runtime initialization
|
/* GNU Objective C Runtime initialization
|
||||||
Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
||||||
Contributed by Kresten Krab Thorup
|
Contributed by Kresten Krab Thorup
|
||||||
+load support contributed by Ovidiu Predescu <ovidiu@net-community.com>
|
+load support contributed by Ovidiu Predescu <ovidiu@net-community.com>
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
#include "runtime.h"
|
#include "runtime.h"
|
||||||
|
|
||||||
/* The version number of this runtime. This must match the number
|
/* The version number of this runtime. This must match the number
|
||||||
defined in gcc (objc-act.c) */
|
defined in gcc (objc-act.c). */
|
||||||
#define OBJC_VERSION 8
|
#define OBJC_VERSION 8
|
||||||
#define PROTOCOL_VERSION 2
|
#define PROTOCOL_VERSION 2
|
||||||
|
|
||||||
/* This list contains all modules currently loaded into the runtime */
|
/* This list contains all modules currently loaded into the runtime. */
|
||||||
static struct objc_list *__objc_module_list = 0; /* !T:MUTEX */
|
static struct objc_list *__objc_module_list = 0; /* !T:MUTEX */
|
||||||
|
|
||||||
/* This list contains all proto_list's not yet assigned class links */
|
/* This list contains all proto_list's not yet assigned class links. */
|
||||||
static struct objc_list *unclaimed_proto_list = 0; /* !T:MUTEX */
|
static struct objc_list *unclaimed_proto_list = 0; /* !T:MUTEX */
|
||||||
|
|
||||||
/* List of unresolved static instances. */
|
/* List of unresolved static instances. */
|
||||||
|
@ -46,19 +46,19 @@ objc_mutex_t __objc_runtime_mutex = 0;
|
||||||
/* Number of threads that are alive. */
|
/* Number of threads that are alive. */
|
||||||
int __objc_runtime_threads_alive = 1; /* !T:MUTEX */
|
int __objc_runtime_threads_alive = 1; /* !T:MUTEX */
|
||||||
|
|
||||||
/* Check compiler vs runtime version */
|
/* Check compiler vs runtime version. */
|
||||||
static void init_check_module_version (Module_t);
|
static void init_check_module_version (Module_t);
|
||||||
|
|
||||||
/* Assign isa links to protos */
|
/* Assign isa links to protos. */
|
||||||
static void __objc_init_protocols (struct objc_protocol_list *protos);
|
static void __objc_init_protocols (struct objc_protocol_list *protos);
|
||||||
|
|
||||||
/* Add protocol to class */
|
/* Add protocol to class. */
|
||||||
static void __objc_class_add_protocols (Class, struct objc_protocol_list *);
|
static void __objc_class_add_protocols (Class, struct objc_protocol_list *);
|
||||||
|
|
||||||
/* This is a hook which is called by __objc_exec_class every time a class
|
/* This is a hook which is called by __objc_exec_class every time a
|
||||||
or a category is loaded into the runtime. This may e.g. help a
|
class or a category is loaded into the runtime. This may e.g. help
|
||||||
dynamic loader determine the classes that have been loaded when
|
a dynamic loader determine the classes that have been loaded when
|
||||||
an object file is dynamically linked in */
|
an object file is dynamically linked in. */
|
||||||
void (*_objc_load_callback) (Class class, Category *category); /* !T:SAFE */
|
void (*_objc_load_callback) (Class class, Category *category); /* !T:SAFE */
|
||||||
|
|
||||||
/* Is all categories/classes resolved? */
|
/* Is all categories/classes resolved? */
|
||||||
|
@ -72,11 +72,11 @@ __sel_register_typed_name (const char *name, const char *types,
|
||||||
static void objc_send_load (void);
|
static void objc_send_load (void);
|
||||||
|
|
||||||
/* Inserts all the classes defined in module in a tree of classes that
|
/* Inserts all the classes defined in module in a tree of classes that
|
||||||
resembles the class hierarchy. This tree is traversed in preorder and the
|
resembles the class hierarchy. This tree is traversed in preorder
|
||||||
classes in its nodes receive the +load message if these methods were not
|
and the classes in its nodes receive the +load message if these
|
||||||
executed before. The algorithm ensures that when the +load method of a class
|
methods were not executed before. The algorithm ensures that when
|
||||||
is executed all the superclasses have been already received the +load
|
the +load method of a class is executed all the superclasses have
|
||||||
message. */
|
been already received the +load message. */
|
||||||
static void __objc_create_classes_tree (Module_t module);
|
static void __objc_create_classes_tree (Module_t module);
|
||||||
|
|
||||||
static void __objc_call_callback (Module_t module);
|
static void __objc_call_callback (Module_t module);
|
||||||
|
@ -90,19 +90,21 @@ typedef struct objc_class_tree {
|
||||||
struct objc_list *subclasses; /* `head' is pointer to an objc_class_tree */
|
struct objc_list *subclasses; /* `head' is pointer to an objc_class_tree */
|
||||||
} objc_class_tree;
|
} objc_class_tree;
|
||||||
|
|
||||||
/* This is a linked list of objc_class_tree trees. The head of these trees
|
/* This is a linked list of objc_class_tree trees. The head of these
|
||||||
are root classes (their super class is Nil). These different trees
|
trees are root classes (their super class is Nil). These different
|
||||||
represent different class hierarchies. */
|
trees represent different class hierarchies. */
|
||||||
static struct objc_list *__objc_class_tree_list = NULL;
|
static struct objc_list *__objc_class_tree_list = NULL;
|
||||||
|
|
||||||
/* Keeps the +load methods who have been already executed. This hash should
|
/* Keeps the +load methods who have been already executed. This hash
|
||||||
not be destroyed during the execution of the program. */
|
should not be destroyed during the execution of the program. */
|
||||||
static cache_ptr __objc_load_methods = NULL;
|
static cache_ptr __objc_load_methods = NULL;
|
||||||
|
|
||||||
/* Creates a tree of classes whose topmost class is directly inherited from
|
/* Creates a tree of classes whose topmost class is directly inherited
|
||||||
`upper' and the bottom class in this tree is `bottom_class'. The classes
|
from `upper' and the bottom class in this tree is
|
||||||
in this tree are super classes of `bottom_class'. `subclasses' member
|
`bottom_class'. The classes in this tree are super classes of
|
||||||
of each tree node point to the next subclass tree node. */
|
`bottom_class'. `subclasses' member of each tree node point to the
|
||||||
|
next subclass tree node. */
|
||||||
|
|
||||||
static objc_class_tree *
|
static objc_class_tree *
|
||||||
create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
|
create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
|
||||||
{
|
{
|
||||||
|
@ -134,11 +136,13 @@ create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the `class' into the proper place in the `tree' class hierarchy. This
|
/* Insert the `class' into the proper place in the `tree' class
|
||||||
function returns a new tree if the class has been successfully inserted into
|
hierarchy. This function returns a new tree if the class has been
|
||||||
the tree or NULL if the class is not part of the classes hierarchy described
|
successfully inserted into the tree or NULL if the class is not
|
||||||
by `tree'. This function is private to objc_tree_insert_class(), you should
|
part of the classes hierarchy described by `tree'. This function is
|
||||||
not call it directly. */
|
private to objc_tree_insert_class (), you should not call it
|
||||||
|
directly. */
|
||||||
|
|
||||||
static objc_class_tree *
|
static objc_class_tree *
|
||||||
__objc_tree_insert_class (objc_class_tree *tree, Class class)
|
__objc_tree_insert_class (objc_class_tree *tree, Class class)
|
||||||
{
|
{
|
||||||
|
@ -186,12 +190,13 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* The class is not a direct subclass of tree->class. Search for class's
|
/* The class is not a direct subclass of tree->class. Search for
|
||||||
superclasses in the list of subclasses. */
|
class's superclasses in the list of subclasses. */
|
||||||
struct objc_list *subclasses = tree->subclasses;
|
struct objc_list *subclasses = tree->subclasses;
|
||||||
|
|
||||||
/* Precondition: the class must be a subclass of tree->class; otherwise
|
/* Precondition: the class must be a subclass of tree->class;
|
||||||
return NULL to indicate our caller that it must take the next tree. */
|
otherwise return NULL to indicate our caller that it must
|
||||||
|
take the next tree. */
|
||||||
if (! class_is_subclass_of_class (class, tree->class))
|
if (! class_is_subclass_of_class (class, tree->class))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -201,9 +206,9 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
|
||||||
|
|
||||||
if (class_is_subclass_of_class (class, aClass))
|
if (class_is_subclass_of_class (class, aClass))
|
||||||
{
|
{
|
||||||
/* If we found one of class's superclasses we insert the class
|
/* If we found one of class's superclasses we insert the
|
||||||
into its subtree and return the original tree since nothing
|
class into its subtree and return the original tree
|
||||||
has been changed. */
|
since nothing has been changed. */
|
||||||
subclasses->head
|
subclasses->head
|
||||||
= __objc_tree_insert_class (subclasses->head, class);
|
= __objc_tree_insert_class (subclasses->head, class);
|
||||||
DEBUG_PRINTF ("4. class %s inserted\n", class->name);
|
DEBUG_PRINTF ("4. class %s inserted\n", class->name);
|
||||||
|
@ -211,9 +216,9 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We haven't found a subclass of `class' in the `subclasses' list.
|
/* We haven't found a subclass of `class' in the `subclasses'
|
||||||
Create a new tree of classes whose topmost class is a direct subclass
|
list. Create a new tree of classes whose topmost class is a
|
||||||
of tree->class. */
|
direct subclass of tree->class. */
|
||||||
{
|
{
|
||||||
objc_class_tree *new_tree
|
objc_class_tree *new_tree
|
||||||
= create_tree_of_subclasses_inherited_from (class, tree->class);
|
= create_tree_of_subclasses_inherited_from (class, tree->class);
|
||||||
|
@ -225,6 +230,7 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function inserts `class' in the right tree hierarchy classes. */
|
/* This function inserts `class' in the right tree hierarchy classes. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
objc_tree_insert_class (Class class)
|
objc_tree_insert_class (Class class)
|
||||||
{
|
{
|
||||||
|
@ -244,8 +250,8 @@ objc_tree_insert_class (Class class)
|
||||||
list_node = list_node->tail;
|
list_node = list_node->tail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the list was finished but the class hasn't been inserted, insert it
|
/* If the list was finished but the class hasn't been inserted,
|
||||||
here. */
|
insert it here. */
|
||||||
if (! list_node)
|
if (! list_node)
|
||||||
{
|
{
|
||||||
__objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
|
__objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
|
||||||
|
@ -254,6 +260,7 @@ objc_tree_insert_class (Class class)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Traverse tree in preorder. Used to send +load. */
|
/* Traverse tree in preorder. Used to send +load. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
objc_preorder_traverse (objc_class_tree *tree,
|
objc_preorder_traverse (objc_class_tree *tree,
|
||||||
int level,
|
int level,
|
||||||
|
@ -267,6 +274,7 @@ objc_preorder_traverse (objc_class_tree *tree,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Traverse tree in postorder. Used to destroy a tree. */
|
/* Traverse tree in postorder. Used to destroy a tree. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
objc_postorder_traverse (objc_class_tree *tree,
|
objc_postorder_traverse (objc_class_tree *tree,
|
||||||
int level,
|
int level,
|
||||||
|
@ -280,6 +288,7 @@ objc_postorder_traverse (objc_class_tree *tree,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used to print a tree class hierarchy. */
|
/* Used to print a tree class hierarchy. */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static void
|
static void
|
||||||
__objc_tree_print (objc_class_tree *tree, int level)
|
__objc_tree_print (objc_class_tree *tree, int level)
|
||||||
|
@ -292,10 +301,12 @@ __objc_tree_print (objc_class_tree *tree, int level)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Walks on a linked list of methods in the reverse order and executes all
|
/* Walks on a linked list of methods in the reverse order and executes
|
||||||
the methods corresponding to `op' selector. Walking in the reverse order
|
all the methods corresponding to `op' selector. Walking in the
|
||||||
assures the +load of class is executed first and then +load of categories
|
reverse order assures the +load of class is executed first and then
|
||||||
because of the way in which categories are added to the class methods. */
|
+load of categories because of the way in which categories are
|
||||||
|
added to the class methods. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
__objc_send_message_in_list (MethodList_t method_list, Class class, SEL op)
|
__objc_send_message_in_list (MethodList_t method_list, Class class, SEL op)
|
||||||
{
|
{
|
||||||
|
@ -349,8 +360,9 @@ __objc_destroy_class_tree_node (objc_class_tree *tree,
|
||||||
objc_free (tree);
|
objc_free (tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is used to check if the relationship between two classes before the
|
/* This is used to check if the relationship between two classes
|
||||||
runtime completely installs the classes. */
|
before the runtime completely installs the classes. */
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
class_is_subclass_of_class (Class class, Class superclass)
|
class_is_subclass_of_class (Class class, Class superclass)
|
||||||
{
|
{
|
||||||
|
@ -366,12 +378,12 @@ class_is_subclass_of_class (Class class, Class superclass)
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This list contains all the classes in the runtime system for whom their
|
/* This list contains all the classes in the runtime system for whom
|
||||||
superclasses are not yet know to the runtime. */
|
their superclasses are not yet known to the runtime. */
|
||||||
static struct objc_list *unresolved_classes = 0;
|
static struct objc_list *unresolved_classes = 0;
|
||||||
|
|
||||||
/* Extern function used to reference the Object and NXConstantString classes.
|
/* Extern function used to reference the Object and NXConstantString
|
||||||
*/
|
classes. */
|
||||||
|
|
||||||
extern void __objc_force_linking (void);
|
extern void __objc_force_linking (void);
|
||||||
|
|
||||||
|
@ -382,8 +394,9 @@ __objc_force_linking (void)
|
||||||
__objc_linking ();
|
__objc_linking ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run through the statics list, removing modules as soon as all its statics
|
/* Run through the statics list, removing modules as soon as all its
|
||||||
have been initialized. */
|
statics have been initialized. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
objc_init_statics (void)
|
objc_init_statics (void)
|
||||||
{
|
{
|
||||||
|
@ -442,9 +455,9 @@ objc_init_statics (void)
|
||||||
} /* objc_init_statics */
|
} /* objc_init_statics */
|
||||||
|
|
||||||
/* This function is called by constructor functions generated for each
|
/* This function is called by constructor functions generated for each
|
||||||
module compiled. (_GLOBAL_$I$...) The purpose of this function is to
|
module compiled. (_GLOBAL_$I$...) The purpose of this function is
|
||||||
gather the module pointers so that they may be processed by the
|
to gather the module pointers so that they may be processed by the
|
||||||
initialization routines as soon as possible */
|
initialization routines as soon as possible. */
|
||||||
|
|
||||||
void
|
void
|
||||||
__objc_exec_class (Module_t module)
|
__objc_exec_class (Module_t module)
|
||||||
|
@ -636,7 +649,8 @@ __objc_exec_class (Module_t module)
|
||||||
|
|
||||||
if (unclaimed_proto_list && objc_lookup_class ("Protocol"))
|
if (unclaimed_proto_list && objc_lookup_class ("Protocol"))
|
||||||
{
|
{
|
||||||
list_mapcar (unclaimed_proto_list,(void(*)(void*))__objc_init_protocols);
|
list_mapcar (unclaimed_proto_list,
|
||||||
|
(void (*) (void *))__objc_init_protocols);
|
||||||
list_free (unclaimed_proto_list);
|
list_free (unclaimed_proto_list);
|
||||||
unclaimed_proto_list = 0;
|
unclaimed_proto_list = 0;
|
||||||
}
|
}
|
||||||
|
@ -646,15 +660,16 @@ __objc_exec_class (Module_t module)
|
||||||
objc_mutex_unlock (__objc_runtime_mutex);
|
objc_mutex_unlock (__objc_runtime_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void objc_send_load (void)
|
static void
|
||||||
|
objc_send_load (void)
|
||||||
{
|
{
|
||||||
if (! __objc_module_list)
|
if (! __objc_module_list)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Try to find out if all the classes loaded so far also have their
|
/* Try to find out if all the classes loaded so far also have their
|
||||||
superclasses known to the runtime. We suppose that the objects that are
|
superclasses known to the runtime. We suppose that the objects
|
||||||
allocated in the +load method are in general of a class declared in the
|
that are allocated in the +load method are in general of a class
|
||||||
same module. */
|
declared in the same module. */
|
||||||
if (unresolved_classes)
|
if (unresolved_classes)
|
||||||
{
|
{
|
||||||
Class class = unresolved_classes->head;
|
Class class = unresolved_classes->head;
|
||||||
|
@ -668,25 +683,25 @@ static void objc_send_load (void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* If we still have classes for whom we don't have yet their
|
||||||
* If we still have classes for whom we don't have yet their super
|
super classes known to the runtime we don't send the +load
|
||||||
* classes known to the runtime we don't send the +load messages.
|
messages. */
|
||||||
*/
|
|
||||||
if (unresolved_classes)
|
if (unresolved_classes)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Special check to allow creating and sending messages to constant strings
|
/* Special check to allow creating and sending messages to constant
|
||||||
in +load methods. If these classes are not yet known, even if all the
|
strings in +load methods. If these classes are not yet known,
|
||||||
other classes are known, delay sending of +load. */
|
even if all the other classes are known, delay sending of +load. */
|
||||||
if (! objc_lookup_class ("NXConstantString") ||
|
if (! objc_lookup_class ("NXConstantString") ||
|
||||||
! objc_lookup_class ("Object"))
|
! objc_lookup_class ("Object"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Iterate over all modules in the __objc_module_list and call on them the
|
/* Iterate over all modules in the __objc_module_list and call on
|
||||||
__objc_create_classes_tree function. This function creates a tree of
|
them the __objc_create_classes_tree function. This function
|
||||||
classes that resembles the class hierarchy. */
|
creates a tree of classes that resembles the class hierarchy. */
|
||||||
list_mapcar (__objc_module_list, (void(*)(void*))__objc_create_classes_tree);
|
list_mapcar (__objc_module_list,
|
||||||
|
(void (*) (void *)) __objc_create_classes_tree);
|
||||||
|
|
||||||
while (__objc_class_tree_list)
|
while (__objc_class_tree_list)
|
||||||
{
|
{
|
||||||
|
@ -714,8 +729,8 @@ __objc_create_classes_tree (Module_t module)
|
||||||
Symtab_t symtab = module->symtab;
|
Symtab_t symtab = module->symtab;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Iterate thru classes defined in this module and insert them in the classes
|
/* Iterate thru classes defined in this module and insert them in
|
||||||
tree hierarchy. */
|
the classes tree hierarchy. */
|
||||||
for (i = 0; i < symtab->cls_def_cnt; i++)
|
for (i = 0; i < symtab->cls_def_cnt; i++)
|
||||||
{
|
{
|
||||||
Class class = (Class) symtab->defs[i];
|
Class class = (Class) symtab->defs[i];
|
||||||
|
@ -727,13 +742,13 @@ __objc_create_classes_tree (Module_t module)
|
||||||
static void
|
static void
|
||||||
__objc_call_callback (Module_t module)
|
__objc_call_callback (Module_t module)
|
||||||
{
|
{
|
||||||
/* The runtime mutex is locked in this point */
|
/* The runtime mutex is locked in this point. */
|
||||||
|
|
||||||
Symtab_t symtab = module->symtab;
|
Symtab_t symtab = module->symtab;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Iterate thru classes defined in this module and call the callback for
|
/* Iterate thru classes defined in this module and call the callback
|
||||||
each one. */
|
for each one. */
|
||||||
for (i = 0; i < symtab->cls_def_cnt; i++)
|
for (i = 0; i < symtab->cls_def_cnt; i++)
|
||||||
{
|
{
|
||||||
Class class = (Class) symtab->defs[i];
|
Class class = (Class) symtab->defs[i];
|
||||||
|
@ -743,9 +758,9 @@ __objc_call_callback (Module_t module)
|
||||||
_objc_load_callback (class, 0);
|
_objc_load_callback (class, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call the _objc_load_callback for categories. Don't register the instance
|
/* Call the _objc_load_callback for categories. Don't register the
|
||||||
methods as class methods for categories to root classes since they were
|
instance methods as class methods for categories to root classes
|
||||||
already added in the class. */
|
since they were already added in the class. */
|
||||||
for (i = 0; i < symtab->cat_def_cnt; i++)
|
for (i = 0; i < symtab->cat_def_cnt; i++)
|
||||||
{
|
{
|
||||||
Category_t category = symtab->defs[i + symtab->cls_def_cnt];
|
Category_t category = symtab->defs[i + symtab->cls_def_cnt];
|
||||||
|
@ -756,8 +771,10 @@ __objc_call_callback (Module_t module)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check the version of gcc used to compile `module'*/
|
/* Sanity check the version of gcc used to compile `module'. */
|
||||||
static void init_check_module_version(Module_t module)
|
|
||||||
|
static void
|
||||||
|
init_check_module_version (Module_t module)
|
||||||
{
|
{
|
||||||
if ((module->version != OBJC_VERSION) || (module->size != sizeof (Module)))
|
if ((module->version != OBJC_VERSION) || (module->size != sizeof (Module)))
|
||||||
{
|
{
|
||||||
|
@ -815,7 +832,8 @@ __objc_init_protocols (struct objc_protocol_list* protos)
|
||||||
{
|
{
|
||||||
objc_error (nil, OBJC_ERR_PROTOCOL_VERSION,
|
objc_error (nil, OBJC_ERR_PROTOCOL_VERSION,
|
||||||
"Version %d doesn't match runtime protocol version %d\n",
|
"Version %d doesn't match runtime protocol version %d\n",
|
||||||
(int)((char*)protos->list[i]->class_pointer-(char*)0),
|
(int) ((char *) protos->list[i]->class_pointer
|
||||||
|
- (char *) 0),
|
||||||
PROTOCOL_VERSION);
|
PROTOCOL_VERSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -823,8 +841,8 @@ __objc_init_protocols (struct objc_protocol_list* protos)
|
||||||
objc_mutex_unlock (__objc_runtime_mutex);
|
objc_mutex_unlock (__objc_runtime_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __objc_class_add_protocols (Class class,
|
static void
|
||||||
struct objc_protocol_list* protos)
|
__objc_class_add_protocols (Class class, struct objc_protocol_list *protos)
|
||||||
{
|
{
|
||||||
/* Well... */
|
/* Well... */
|
||||||
if (! protos)
|
if (! protos)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* GNU Objective C Runtime Miscellaneous
|
/* GNU Objective C Runtime Miscellaneous
|
||||||
Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1994, 1995, 1996, 1997, 2002
|
||||||
|
Free Software Foundation, Inc.
|
||||||
Contributed by Kresten Krab Thorup
|
Contributed by Kresten Krab Thorup
|
||||||
|
|
||||||
This file is part of GNU CC.
|
This file is part of GNU CC.
|
||||||
|
@ -148,7 +149,8 @@ objc_free(void *mem)
|
||||||
#if OBJC_WITH_GC
|
#if OBJC_WITH_GC
|
||||||
#include <gc.h>
|
#include <gc.h>
|
||||||
|
|
||||||
static void *GC_calloc (size_t nelem, size_t size)
|
static void *
|
||||||
|
GC_calloc (size_t nelem, size_t size)
|
||||||
{
|
{
|
||||||
void *p = GC_malloc (nelem * size);
|
void *p = GC_malloc (nelem * size);
|
||||||
if (! p)
|
if (! p)
|
||||||
|
@ -158,7 +160,10 @@ static void *GC_calloc (size_t nelem, size_t size)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void noFree (void* p) {}
|
static void
|
||||||
|
noFree (void *p)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void *(*_objc_malloc) (size_t) = GC_malloc;
|
void *(*_objc_malloc) (size_t) = GC_malloc;
|
||||||
void *(*_objc_atomic_malloc) (size_t) = GC_malloc_atomic;
|
void *(*_objc_atomic_malloc) (size_t) = GC_malloc_atomic;
|
||||||
|
@ -167,7 +172,7 @@ void *(*_objc_realloc)(void *, size_t) = GC_realloc;
|
||||||
void *(*_objc_calloc) (size_t, size_t) = GC_calloc;
|
void *(*_objc_calloc) (size_t, size_t) = GC_calloc;
|
||||||
void (*_objc_free) (void *) = noFree;
|
void (*_objc_free) (void *) = noFree;
|
||||||
|
|
||||||
#else
|
#else /* !OBJC_WITH_GC */
|
||||||
|
|
||||||
void *(*_objc_malloc) (size_t) = malloc;
|
void *(*_objc_malloc) (size_t) = malloc;
|
||||||
void *(*_objc_atomic_malloc) (size_t) = malloc;
|
void *(*_objc_atomic_malloc) (size_t) = malloc;
|
||||||
|
@ -177,4 +182,4 @@ void *(*_objc_calloc)(size_t, size_t) = calloc;
|
||||||
void (*_objc_free) (void *) = free;
|
void (*_objc_free) (void *) = free;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif /* !OBJC_WITH_GC */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* GNU Objective C Runtime nil receiver function
|
/* GNU Objective C Runtime nil receiver function
|
||||||
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1995, 1996, 2002 Free Software Foundation, Inc.
|
||||||
Contributed by Kresten Krab Thorup
|
Contributed by Kresten Krab Thorup
|
||||||
|
|
||||||
This file is part of GNU CC.
|
This file is part of GNU CC.
|
||||||
|
@ -34,7 +34,3 @@ nil_method(id receiver, SEL op __attribute__ ((__unused__)), ...)
|
||||||
{
|
{
|
||||||
return receiver;
|
return receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Encoding of types for Objective C.
|
/* Encoding of types for Objective C.
|
||||||
Copyright (C) 1993, 1997 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1997, 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Author: Kresten Krab Thorup
|
Author: Kresten Krab Thorup
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Thread and mutex controls for Objective C.
|
/* Thread and mutex controls for Objective C.
|
||||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
|
||||||
Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
|
Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
|
||||||
|
|
||||||
This file is part of GNU CC.
|
This file is part of GNU CC.
|
||||||
|
|
|
@ -101,5 +101,3 @@ id __objc_object_copy(id object)
|
||||||
memcpy (copy, object, object->class_pointer->instance_size);
|
memcpy (copy, object, object->class_pointer->instance_size);
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Sparse Arrays for Objective C dispatch tables
|
/* Sparse Arrays for Objective C dispatch tables
|
||||||
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1995, 1996, 2002 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU CC.
|
This file is part of GNU CC.
|
||||||
|
|
||||||
|
@ -382,8 +382,7 @@ sarray_realloc(struct sarray* array, int newsize)
|
||||||
/* Free a sparse array allocated with sarray_new */
|
/* Free a sparse array allocated with sarray_new */
|
||||||
|
|
||||||
void
|
void
|
||||||
sarray_free(struct sarray* array)
|
sarray_free (struct sarray *array) {
|
||||||
{
|
|
||||||
#ifdef OBJC_SPARSE3
|
#ifdef OBJC_SPARSE3
|
||||||
size_t old_max_index = (array->capacity - 1)/INDEX_CAPACITY;
|
size_t old_max_index = (array->capacity - 1)/INDEX_CAPACITY;
|
||||||
struct sindex **old_indices;
|
struct sindex **old_indices;
|
||||||
|
@ -499,15 +498,13 @@ sarray_lazy_copy(struct sarray* oarr)
|
||||||
/* Copy bucket table */
|
/* Copy bucket table */
|
||||||
new_indices = (struct sindex **)
|
new_indices = (struct sindex **)
|
||||||
objc_malloc (sizeof (struct sindex *) * num_indices);
|
objc_malloc (sizeof (struct sindex *) * num_indices);
|
||||||
memcpy( new_indices,oarr->indices,
|
memcpy (new_indices, oarr->indices, sizeof (struct sindex *) * num_indices);
|
||||||
sizeof(struct sindex*)*num_indices);
|
|
||||||
arr->indices = new_indices;
|
arr->indices = new_indices;
|
||||||
#else
|
#else
|
||||||
/* Copy bucket table */
|
/* Copy bucket table */
|
||||||
new_buckets = (struct sbucket **)
|
new_buckets = (struct sbucket **)
|
||||||
objc_malloc (sizeof (struct sbucket *) * num_indices);
|
objc_malloc (sizeof (struct sbucket *) * num_indices);
|
||||||
memcpy( new_buckets,oarr->buckets,
|
memcpy (new_buckets, oarr->buckets, sizeof (struct sbucket *) * num_indices);
|
||||||
sizeof(struct sbucket*)*num_indices);
|
|
||||||
arr->buckets = new_buckets;
|
arr->buckets = new_buckets;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -285,8 +285,7 @@ sel_get_uid (const char *name)
|
||||||
|
|
||||||
/* Get name of selector. If selector is unknown, the empty string ""
|
/* Get name of selector. If selector is unknown, the empty string ""
|
||||||
is returned */
|
is returned */
|
||||||
const char*
|
const char *sel_get_name (SEL selector)
|
||||||
sel_get_name (SEL selector)
|
|
||||||
{
|
{
|
||||||
const char *ret;
|
const char *ret;
|
||||||
|
|
||||||
|
@ -308,8 +307,7 @@ sel_is_mapped (SEL selector)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char*
|
const char *sel_get_type (SEL selector)
|
||||||
sel_get_type (SEL selector)
|
|
||||||
{
|
{
|
||||||
if (selector)
|
if (selector)
|
||||||
return selector->sel_types;
|
return selector->sel_types;
|
||||||
|
@ -455,4 +453,3 @@ sel_register_typed_name (const char *name, const char *type)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* GNU Objective C Runtime message lookup
|
/* GNU Objective C Runtime message lookup
|
||||||
Copyright (C) 1993, 1995, 1996, 1997, 1998,
|
Copyright (C) 1993, 1995, 1996, 1997, 1998,
|
||||||
2001 Free Software Foundation, Inc.
|
2001, 2002 Free Software Foundation, Inc.
|
||||||
Contributed by Kresten Krab Thorup
|
Contributed by Kresten Krab Thorup
|
||||||
|
|
||||||
This file is part of GNU CC.
|
This file is part of GNU CC.
|
||||||
|
@ -226,8 +226,7 @@ objc_msg_sendv(id object, SEL op, arglist_t arg_frame)
|
||||||
void
|
void
|
||||||
__objc_init_dispatch_tables ()
|
__objc_init_dispatch_tables ()
|
||||||
{
|
{
|
||||||
__objc_uninstalled_dtable
|
__objc_uninstalled_dtable = sarray_new (200, 0);
|
||||||
= sarray_new(200, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called by objc_msg_lookup when the
|
/* This function is called by objc_msg_lookup when the
|
||||||
|
@ -645,7 +644,8 @@ __objc_print_dtable_stats()
|
||||||
(long) nbuckets * sizeof (struct sbucket));
|
(long) nbuckets * sizeof (struct sbucket));
|
||||||
total += nbuckets * sizeof (struct sbucket);
|
total += nbuckets * sizeof (struct sbucket);
|
||||||
|
|
||||||
printf("idxtables: %d = %ld bytes\n", idxsize, (long)idxsize*sizeof(void*));
|
printf ("idxtables: %d = %ld bytes\n",
|
||||||
|
idxsize, (long) idxsize * sizeof (void *));
|
||||||
total += idxsize * sizeof (void *);
|
total += idxsize * sizeof (void *);
|
||||||
printf ("-----------------------------------\n");
|
printf ("-----------------------------------\n");
|
||||||
printf ("total: %d bytes\n", total);
|
printf ("total: %d bytes\n", total);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* GNU Objective C Runtime Thread Implementation
|
/* GNU Objective C Runtime Thread Implementation
|
||||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
|
||||||
Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
|
Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
|
||||||
Modified for Mach threads by Bill Bumgarner <bbum@friday.com>
|
Modified for Mach threads by Bill Bumgarner <bbum@friday.com>
|
||||||
Condition functions added by Mircea Oancea <mircea@first.elcom.pub.ro>
|
Condition functions added by Mircea Oancea <mircea@first.elcom.pub.ro>
|
||||||
|
@ -37,7 +37,8 @@ Boston, MA 02111-1307, USA. */
|
||||||
maximum priority downward only-- cannot be raised without superuser
|
maximum priority downward only-- cannot be raised without superuser
|
||||||
privileges. Once lowered, it cannot be raised.
|
privileges. Once lowered, it cannot be raised.
|
||||||
*/
|
*/
|
||||||
static int __mach_get_max_thread_priority(cthread_t t, int *base)
|
static int
|
||||||
|
__mach_get_max_thread_priority (cthread_t t, int *base)
|
||||||
{
|
{
|
||||||
thread_t threadP;
|
thread_t threadP;
|
||||||
kern_return_t error;
|
kern_return_t error;
|
||||||
|
|
Loading…
Reference in New Issue