1994-11-04 16:29:24 +00:00
|
|
|
/* Implementation to allow compilation of GNU objc code with NeXT runtime
|
|
|
|
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Kresten Krab Thorup
|
1996-04-17 20:17:45 +00:00
|
|
|
Modified by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
1994-11-04 16:29:24 +00:00
|
|
|
Date: Sep 1994
|
|
|
|
|
1996-05-12 00:56:10 +00:00
|
|
|
This file is part of the GNUstep Base Library.
|
1994-11-04 16:29:24 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-09-14 11:36:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
1994-11-04 16:29:24 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-08 10:38:33 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2005-02-22 11:22:44 +00:00
|
|
|
|
1994-11-04 16:29:24 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
2007-09-14 11:36:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
1994-11-04 16:29:24 +00:00
|
|
|
License along with this library; if not, write to the Free
|
2006-10-20 10:56:27 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02111 USA.
|
2005-02-22 11:22:44 +00:00
|
|
|
*/
|
1994-11-04 16:29:24 +00:00
|
|
|
|
2001-05-17 14:54:47 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include <stdio.h>
|
2003-07-31 23:49:32 +00:00
|
|
|
#include "GNUstepBase/preface.h"
|
2001-08-28 18:45:17 +00:00
|
|
|
#include "mframe.h"
|
2001-05-14 21:14:22 +00:00
|
|
|
|
2001-08-28 18:45:17 +00:00
|
|
|
id next_objc_msg_sendv(id object, SEL op, void* frame)
|
|
|
|
{
|
|
|
|
arglist_t argFrame = __builtin_apply_args();
|
2001-08-29 19:19:13 +00:00
|
|
|
struct objc_method *m = class_get_instance_method(object->class_pointer, op);
|
2001-08-28 18:45:17 +00:00
|
|
|
const char *type;
|
|
|
|
void *result;
|
|
|
|
|
|
|
|
argFrame->arg_ptr = frame;
|
|
|
|
*((id*)method_types_get_first_argument (m, argFrame, &type)) = object;
|
|
|
|
*((SEL*)method_types_get_next_argument (argFrame, &type)) = op;
|
|
|
|
result = __builtin_apply((apply_t)m->method_imp,
|
|
|
|
argFrame,
|
|
|
|
method_get_sizeof_arguments (m));
|
|
|
|
|
|
|
|
#if !defined(BROKEN_BUILTIN_APPLY) && defined(i386)
|
|
|
|
/* Special hack to avoid pushing the poped float value back to the fp
|
|
|
|
stack on i386 machines. This happens with NeXT runtime and 2.7.2
|
|
|
|
compiler. If the result value is floating point don't call
|
|
|
|
__builtin_return anymore. */
|
2005-02-22 11:22:44 +00:00
|
|
|
if (*m->method_types == _C_FLT || *m->method_types == _C_DBL) {
|
2001-08-28 18:45:17 +00:00
|
|
|
long double value = *(long double*)(((char*)result) + 8);
|
|
|
|
asm("fld %0" : : "f" (value));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
__builtin_return(result);
|
|
|
|
}
|