aboutsummaryrefslogtreecommitdiff
path: root/libobjc
diff options
context:
space:
mode:
authorOvidiu Predescu <ovidiu@gcc.gnu.org>2001-01-03 08:49:02 +0000
committerOvidiu Predescu <ovidiu@gcc.gnu.org>2001-01-03 08:49:02 +0000
commit68b61df962a86291e7edcb1760084a5adb0652c8 (patch)
treec45444560a6907e888e13030f86e427dd5b063c4 /libobjc
parent8cb4a04adc847714d1bf98ed9ebfee077c1d65a2 (diff)
downloadgcc-68b61df962a86291e7edcb1760084a5adb0652c8.zip
gcc-68b61df962a86291e7edcb1760084a5adb0652c8.tar.gz
gcc-68b61df962a86291e7edcb1760084a5adb0652c8.tar.bz2
Added __objc_msg_forward...
Added __objc_msg_forward, a hook that allows external libraries to provide a function that returns the real forwarding function. This can alleviate problems __builtin_apply() and friends have on various platforms. (Solution suggested by Helge Hess.) Define gen_rtx_REG. From-SVN: r38650
Diffstat (limited to 'libobjc')
-rw-r--r--libobjc/sendmsg.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/libobjc/sendmsg.c b/libobjc/sendmsg.c
index 62c8f28..b743829 100644
--- a/libobjc/sendmsg.c
+++ b/libobjc/sendmsg.c
@@ -33,6 +33,7 @@ Boston, MA 02111-1307, USA. */
/* this is how we hack STRUCT_VALUE to be 1 or 0 */
#define gen_rtx(args...) 1
#define gen_rtx_MEM(args...) 1
+#define gen_rtx_REG(args...) 1
#define rtx int
#if !defined(STRUCT_VALUE) || STRUCT_VALUE == 0
@@ -44,6 +45,11 @@ Boston, MA 02111-1307, USA. */
/* The uninstalled dispatch table */
struct sarray* __objc_uninstalled_dtable = 0; /* !T:MUTEX */
+/* Hook for method forwarding. If it is set, is invoked to return a
+ function that performs the real forwarding. Otherwise the libgcc
+ based functions (__builtin_apply and friends) are used. */
+IMP (*__objc_msg_forward)(SEL) = NULL;
+
/* Send +initialize to class */
static void __objc_send_initialize(Class);
@@ -76,18 +82,27 @@ __inline__
IMP
__objc_get_forward_imp (SEL sel)
{
- const char *t = sel->sel_types;
+ if (__objc_msg_forward)
+ {
+ IMP result;
+ if ((result = __objc_msg_forward (sel)))
+ return result;
+ }
+ else
+ {
+ 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
+ && 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;
- else
- return (IMP)__objc_word_forward;
+ )
+ return (IMP)__objc_block_forward;
+ else if (t && (*t == 'f' || *t == 'd'))
+ return (IMP)__objc_double_forward;
+ else
+ return (IMP)__objc_word_forward;
+ }
}
/* Given a class and selector, return the selector's implementation. */