* Source/mframe.m (mframe_do_call),

* Source/cifframe.m (cifframe_do_call),
	* Source/callframe.m (callframe_do_call): Simplify by using
	GSObjCRuntime functions.  Add fallback selector search for invocations
	passed to proxies.  Add debug diagnostics.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24202 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Ayers 2006-12-13 09:32:15 +00:00
parent d8ae1e0e35
commit 58e0c0338f
4 changed files with 101 additions and 57 deletions

View file

@ -1,3 +1,11 @@
2006-12-13 David Ayers <ayers@fsfe.org>
* Source/mframe.m (mframe_do_call),
* Source/cifframe.m (cifframe_do_call),
* Source/callframe.m (callframe_do_call): Simplify by using
GSObjCRuntime functions. Add fallback selector search for invocations
passed to proxies. Add debug diagnostics.
2006-12-05 Matt Rice <ratmice@gmail.com>
* Source/NSBundle.m (+initialize): Remove usage of classes local array.

View file

@ -28,6 +28,7 @@
#include "callframe.h"
#include "Foundation/NSException.h"
#include "Foundation/NSData.h"
#include "Foundation/NSDebug.h"
#include "GSInvocation.h"
#if defined(ALPHA) || (defined(MIPS) && (_MIPS_SIM == _ABIN32))
@ -235,6 +236,8 @@ callframe_do_call (DOContext *ctxt,
id object;
/* The selector for the message we're sending to the TARGET. */
SEL selector;
/* The OBJECT's Method(_t) pointer for the SELECTOR. */
GSMethod meth;
/* The OBJECT's implementation of the SELECTOR. */
IMP method_implementation;
/* Type qualifier flags; see <objc/objc-api.h>. */
@ -276,25 +279,34 @@ callframe_do_call (DOContext *ctxt,
as the ENCODED_TYPES string, but it will have different register
and stack locations if the ENCODED_TYPES came from a machine of a
different architecture. */
#if NeXT_RUNTIME
{
Method m;
m = class_getInstanceMethod(object->isa, selector);
if (!m)
abort();
type = m->method_types;
}
#elif 0
{
Method_t m;
m = class_get_instance_method (object->class_pointer,
selector);
NSCParameterAssert (m);
type = m->method_types;
}
#else
type = sel_get_type (selector);
#endif /* NeXT_runtime */
if (GSObjCIsClass(object))
{
meth = GSGetMethod(object, selector, NO, YES);
}
else if (GSObjCIsInstance)
{
meth = GSGetMethod(GSObjCClass(object), selector, YES, YES);
}
else
{
[NSException raise: NSInvalidArgumentException
format: @"decoded object %p is invalid", object];
}
if (meth != 0)
{
type = meth->method_types;
}
else
{
NSDebugLog(@"Local object <%p %s> doesn't implement: %s directly. "
@"Will search for arbitrary signature.",
object,
GSNameFromClass(GSObjCIsClass(object)
? object : GSObjCClass(object)),
GSNameFromSelector(selector));
type = GSTypesFromSelector(selector);
}
/* Make sure we successfully got the method type, and that its
types match the ENCODED_TYPES. */

View file

@ -28,6 +28,7 @@
#include "cifframe.h"
#include "Foundation/NSException.h"
#include "Foundation/NSData.h"
#include "Foundation/NSDebug.h"
#include "GSInvocation.h"
#if defined(ALPHA) || (defined(MIPS) && (_MIPS_SIM == _ABIN32))
@ -632,6 +633,8 @@ cifframe_do_call (DOContext *ctxt,
id object;
/* The selector for the message we're sending to the TARGET. */
SEL selector;
/* The OBJECT's Method(_t) pointer for the SELECTOR. */
GSMethod meth;
/* The OBJECT's implementation of the SELECTOR. */
IMP method_implementation;
/* Type qualifier flags; see <objc/objc-api.h>. */
@ -673,25 +676,34 @@ cifframe_do_call (DOContext *ctxt,
as the ENCODED_TYPES string, but it will have different register
and stack locations if the ENCODED_TYPES came from a machine of a
different architecture. */
#if NeXT_RUNTIME
{
Method m;
m = class_getInstanceMethod(object->isa, selector);
if (!m)
abort();
type = m->method_types;
}
#elif 0
{
Method_t m;
m = class_get_instance_method (object->class_pointer,
selector);
NSCParameterAssert (m);
type = m->method_types;
}
#else
type = sel_get_type (selector);
#endif /* NeXT_runtime */
if (GSObjCIsClass(object))
{
meth = GSGetMethod(object, selector, NO, YES);
}
else if (GSObjCIsInstance)
{
meth = GSGetMethod(GSObjCClass(object), selector, YES, YES);
}
else
{
[NSException raise: NSInvalidArgumentException
format: @"decoded object %p is invalid", object];
}
if (meth != 0)
{
type = meth->method_types;
}
else
{
NSDebugLog(@"Local object <%p %s> doesn't implement: %s directly. "
@"Will search for arbitrary signature.",
object,
GSNameFromClass(GSObjCIsClass(object)
? object : GSObjCClass(object)),
GSNameFromSelector(selector));
type = GSTypesFromSelector(selector);
}
/* Make sure we successfully got the method type, and that its
types match the ENCODED_TYPES. */

View file

@ -38,6 +38,7 @@
#include "Foundation/NSObjCRuntime.h"
#include "Foundation/NSData.h"
#include "Foundation/NSException.h"
#include "Foundation/NSDebug.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@ -801,6 +802,8 @@ mframe_do_call (DOContext *ctxt,
id object;
/* The selector for the message we're sending to the TARGET. */
SEL selector;
/* The OBJECT's Method(_t) pointer for the SELECTOR. */
GSMethod meth;
/* The OBJECT's implementation of the SELECTOR. */
IMP method_implementation;
/* The number bytes for holding arguments passed on the stack. */
@ -865,25 +868,34 @@ mframe_do_call (DOContext *ctxt,
as the ENCODED_TYPES string, but it will have different register
and stack locations if the ENCODED_TYPES came from a machine of a
different architecture. */
#if NeXT_RUNTIME
{
Method m;
m = class_getInstanceMethod(object->isa, selector);
if (!m)
abort();
type = m->method_types;
}
#elif 0
{
Method_t m;
m = class_get_instance_method (object->class_pointer,
selector);
NSCParameterAssert (m);
type = m->method_types;
}
#else
type = sel_get_type (selector);
#endif /* NeXT_runtime */
if (GSObjCIsClass(object))
{
meth = GSGetMethod(object, selector, NO, YES);
}
else if (GSObjCIsInstance)
{
meth = GSGetMethod(GSObjCClass(object), selector, YES, YES);
}
else
{
[NSException raise: NSInvalidArgumentException
format: @"decoded object %p is invalid", object];
}
if (meth != 0)
{
type = meth->method_types;
}
else
{
NSDebugLog(@"Local object <%p %s> doesn't implement: %s directly. "
@"Will search for arbitrary signature.",
object,
GSNameFromClass(GSObjCIsClass(object)
? object : GSObjCClass(object)),
GSNameFromSelector(selector));
type = GSTypesFromSelector(selector);
}
/* Make sure we successfully got the method type, and that its
types match the ENCODED_TYPES. */