2001-07-31
2001-07-31 23:10:35 by Marcus Comstedt <marcus@mc.pp.se>
-
9a4145f2b51f3ca342f7de0aa0d462dd5301e583
(42 lines)
(+16/-26)
[
Show
| Annotate
]
Branch: 7.9
Moved CPU-specific bytecode calling stuff into CPU-specific header file.
Rev: src/code/ia32.h:1.11
Rev: src/code/ppc32.h:1.3
Rev: src/interpret.c:1.237
5:
\*/
/**/
#include "global.h"
- RCSID("$Id: interpret.c,v 1.236 2001/07/27 15:02:03 grubba Exp $");
+ RCSID("$Id: interpret.c,v 1.237 2001/07/31 23:10:35 marcus Exp $");
#include "interpret.h"
#include "object.h"
#include "program.h"
777:
#define DEF_PROG_COUNTER
#endif /* !DEF_PROG_COUNTER */
+ #ifndef CALL_MACHINE_CODE
+ #define CALL_MACHINE_CODE(pc) \
+ do { \
+ /* The test is needed to get the labels to work... */ \
+ if (pc) { \
+ /* No extra setup needed! \
+ */ \
+ return ((int (*)(void))(pc))(); \
+ } \
+ while(0)
+ #endif /* !CALL_MACHINE_CODE */
+
#define OPCODE0(O,N,C) \
void PIKE_CONCAT(opcode_,O)(void) { \
DEF_PROG_COUNTER; \
849: Inside #if defined(__GNUC__)
}
#endif /* PIKE_DEBUG */
- #ifdef __i386__
- /* This code does not clobber %eax, %ecx & %edx, but
- * the code jumped to does.
- */
- __asm__ __volatile__( " sub $8,%%esp\n"
- " jmp *%0"
- : "=m" (pc)
- :
- : "cc", "memory", "eax", "ecx", "edx" );
- #elif defined(__ppc__) || defined(_POWER)
- __asm__ __volatile__( " mtlr %0\n"
- " blr"
- :
- : "r" (pc)
- : "cc", "memory", "r0", "r3", "r4", "r5",
- "r6", "r7", "r8", "r9", "r10", "r11", "r12",
- "lr", "ctr");
- #else /* !__i386__ && !__ppc__ */
- /* The test is needed to get the labels to work... */
- if (pc) {
- /* No extra setup needed!
- */
- return ((int (*)(void))pc)();
- }
- #endif /* __i386__ || __ppc__ */
+ CALL_MACHINE_CODE(pc);
+
/* This code is never reached, but will
* prevent gcc from optimizing the labels below too much
*/