1 /* funcall0 -- funcall3: we can get by with just two sets of these:
2 * for platforms where the control stack is the C-stack, and all others.
6 * This software is part of the SBCL system. See the README file for
9 * This software is derived from the CMU CL system, which was
10 * written at Carnegie Mellon University and released into the
11 * public domain. The software is in the public domain and is
12 * provided with absolutely no warranty. See the COPYING and CREDITS
13 * files for more information.
22 /* This is implemented in assembly language and called from C: */
23 extern lispobj
call_into_lisp(lispobj fun
, lispobj
*args
, int nargs
);
25 #ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK
26 /* These functions are an interface to the Lisp call-in facility.
27 * Since this is C we can know nothing about the calling environment.
28 * The control stack might be the C stack if called from the monitor
29 * or the Lisp stack if called as a result of an interrupt or maybe
30 * even a separate stack. The args are most likely on that stack but
31 * could be in registers depending on what the compiler likes. So we
32 * copy the args into a portable vector and let the assembly language
33 * call-in function figure it out. */
36 funcall0(lispobj function
)
40 FSHOW((stderr
, "/entering funcall0(0x%lx)\n", (long)function
));
41 return call_into_lisp(function
, args
, 0);
44 funcall1(lispobj function
, lispobj arg0
)
48 return call_into_lisp(function
, args
, 1);
52 funcall2(lispobj function
, lispobj arg0
, lispobj arg1
)
57 return call_into_lisp(function
, args
, 2);
61 funcall3(lispobj function
, lispobj arg0
, lispobj arg1
, lispobj arg2
)
67 return call_into_lisp(function
, args
, 3);
73 funcall0(lispobj function
)
75 lispobj
*args
= current_control_stack_pointer
;
77 return call_into_lisp(function
, args
, 0);
81 funcall1(lispobj function
, lispobj arg0
)
83 lispobj
*args
= current_control_stack_pointer
;
85 current_control_stack_pointer
+= 1;
88 return call_into_lisp(function
, args
, 1);
92 funcall2(lispobj function
, lispobj arg0
, lispobj arg1
)
94 lispobj
*args
= current_control_stack_pointer
;
96 current_control_stack_pointer
+= 2;
100 return call_into_lisp(function
, args
, 2);
104 funcall3(lispobj function
, lispobj arg0
, lispobj arg1
, lispobj arg2
)
106 lispobj
*args
= current_control_stack_pointer
;
108 current_control_stack_pointer
+= 3;
113 return call_into_lisp(function
, args
, 3);