#include "runtime.h"
#include "sarray.h"
#include "encoding.h"
+#include "runtime-info.h"
/* this is how we hack STRUCT_VALUE to be 1 or 0 */
#define gen_rtx(args...) 1
{
const char *t = sel->sel_types;
- if (t && (*t == '[' || *t == '(' || *t == '{'))
+ if (t && (*t == '[' || *t == '(' || *t == '{')
+#ifdef OBJC_MAX_STRUCT_BY_VALUE
+ && objc_sizeof_type(t) > OBJC_MAX_STRUCT_BY_VALUE
+#endif
+ )
return (IMP)__objc_block_forward;
else if (t && (*t == 'f' || *t == 'd'))
return (IMP)__objc_double_forward;
IMP
get_imp (Class class, SEL sel)
{
- IMP impl;
- void* res = sarray_get (class->dtable, (size_t) sel->sel_id);
+ void* res = sarray_get_safe (class->dtable, (size_t) sel->sel_id);
if (res == 0)
{
/* Not a valid method */
}
/* Get the method from the dispatch table */
- res = sarray_get (object->class_pointer->dtable, (size_t) sel->sel_id);
+ res = sarray_get_safe (object->class_pointer->dtable, (size_t) sel->sel_id);
return (res != 0);
}
IMP result;
if(receiver)
{
- result = sarray_get(receiver->class_pointer->dtable, (sidx)op->sel_id);
+ result = sarray_get_safe (receiver->class_pointer->dtable,
+ (sidx)op->sel_id);
if (result == 0)
{
/* Not a valid method */
/* Walk on the methods list of class and install the methods in the reverse
order of the lists. Since methods added by categories are before the methods
of class in the methods list, this allows categories to substitute methods
- declared in class. However if more than one category replace the same method
- nothing is guarranteed about what method will be used.
+ declared in class. However if more than one category replaces the same
+ method nothing is guaranteed about what method will be used.
Assumes that __objc_runtime_mutex is locked down. */
static void
__objc_install_methods_in_dtable (Class class, MethodList_t method_list)
__objc_install_dispatch_table_for_class (Class class)
{
Class super;
- int counter;
/* If the class has not yet had it's class links resolved, we must
re-compute all class links */
res = __objc_forward (rcv, op, args);
if (res)
__builtin_return (res);
+ else
+#if INVISIBLE_STRUCT_RETURN
+ return (__big) {{0, 0, 0, 0, 0, 0, 0, 0}};
+#else
+ return nil;
+#endif
}
/* The object doesn't respond to doesNotRecognize: or error:; Therefore,
a default action is taken. */
objc_error (object, OBJC_ERR_UNIMPLEMENTED, "%s\n", msg);
+
+ return 0;
}
}
);
printf("arrays: %d = %ld bytes\n", narrays,
- (int)narrays*sizeof(struct sarray));
+ (long)narrays*sizeof(struct sarray));
total += narrays*sizeof(struct sarray);
printf("buckets: %d = %ld bytes\n", nbuckets,
- (int)nbuckets*sizeof(struct sbucket));
+ (long)nbuckets*sizeof(struct sbucket));
total += nbuckets*sizeof(struct sbucket);
- printf("idxtables: %d = %ld bytes\n", idxsize, (int)idxsize*sizeof(void*));
+ printf("idxtables: %d = %ld bytes\n", idxsize, (long)idxsize*sizeof(void*));
total += idxsize*sizeof(void*);
printf("-----------------------------------\n");
printf("total: %d bytes\n", total);