More 64-bit fixes.

main
theraven 16 years ago
parent 060ddf89be
commit 1a60fabf96

@ -88,7 +88,7 @@ static void collectMethodsForMethodListToSparseArray(
}
for (unsigned i=0 ; i<list->count ; i++)
{
SparseArrayInsert(sarray, (uint32_t)list->methods[i].selector->sel_id,
SparseArrayInsert(sarray, PTR_TO_IDX(list->methods[i].selector->sel_id),
(void*)&list->methods[i]);
}
}
@ -99,7 +99,7 @@ static BOOL installMethodInDtable(Class class,
BOOL replaceExisting)
{
assert(__objc_uninstalled_dtable != dtable);
uint32_t sel_id = (uint32_t)method->selector->sel_id;
uint32_t sel_id = PTR_TO_IDX(method->selector->sel_id);
struct objc_slot *slot = SparseArrayLookup(dtable, sel_id);
if (NULL != slot && slot->owner == class)
{

@ -117,4 +117,6 @@ void * SparseArrayNext(SparseArray * sarray, uint32_t * index);
*/
SparseArray *SparseArrayCopy(SparseArray * sarray);
#define PTR_TO_IDX(x) ((uint32_t)(uintptr_t)x)
#endif //_SARRAY_H_INCLUDED_

@ -36,8 +36,6 @@ static mutex_t initialize_lock;
void objc_resolve_class(Class);
#define sidx uint32_t
/* Two hooks for method forwarding. If either is set, it is invoked
* to return a function that performs the real forwarding. If both
* are set, the result of __objc_msg_forward2 will be preferred over
@ -194,7 +192,7 @@ objc_msg_lookup (id receiver, SEL op)
if (receiver)
{
result = sarray_get_imp (receiver->class_pointer->dtable,
(sidx)op->sel_id);
PTR_TO_IDX(op->sel_id));
if (result == 0)
{
/** Get the dtable that we should be using for lookup. This will
@ -218,7 +216,7 @@ objc_msg_lookup (id receiver, SEL op)
has been installed by another thread after we did the
previous check that the method exists).
*/
result = sarray_get_imp (dtable, (sidx)op->sel_id);
result = sarray_get_imp (dtable, PTR_TO_IDX(op->sel_id));
if (result == 0)
{
/* Try again after giving the code a chance to install new

@ -22,7 +22,7 @@ static inline
Slot_t objc_msg_lookup_internal(id *receiver, SEL selector, id sender)
{
Slot_t result = sarray_get_safe((*receiver)->class_pointer->dtable,
(sidx)selector->sel_id);
PTR_TO_IDX(selector->sel_id));
if (0 == result)
{
Class class = (*receiver)->class_pointer;
@ -32,7 +32,7 @@ Slot_t objc_msg_lookup_internal(id *receiver, SEL selector, id sender)
{
__objc_init_install_dtable (*receiver, selector);
dtable = dtable_for_class(class);
result = sarray_get_safe(dtable, (sidx)selector->sel_id);
result = sarray_get_safe(dtable, PTR_TO_IDX(selector->sel_id));
if (0 == result)
{
objc_mutex_lock(__objc_runtime_mutex);
@ -43,14 +43,14 @@ Slot_t objc_msg_lookup_internal(id *receiver, SEL selector, id sender)
dtable = dtable_for_class(class);
}
objc_mutex_unlock(__objc_runtime_mutex);
result = sarray_get_safe(dtable, (sidx)selector->sel_id);
result = sarray_get_safe(dtable, PTR_TO_IDX(selector->sel_id));
}
}
else
{
// Check again incase another thread updated the dtable while we
// weren't looking
result = sarray_get_safe(dtable, (sidx)selector->sel_id);
result = sarray_get_safe(dtable, PTR_TO_IDX(selector->sel_id));
}
if (0 == result)
{
@ -117,7 +117,8 @@ Slot_t objc_slot_lookup_super(Super_t super, SEL selector)
if (receiver)
{
Class class = super->class;
Slot_t result = sarray_get_safe(dtable_for_class(class), (sidx)selector->sel_id);
Slot_t result = sarray_get_safe(dtable_for_class(class),
PTR_TO_IDX(selector->sel_id));
if (0 == result)
{
// Dtable should always be installed in the superclass

Loading…
Cancel
Save