2003-08-06
2003-08-06 18:54:18 by Martin Stjernholm <mast@lysator.liu.se>
-
7448ce3d916c4cc9fb04b9da94dcbc67d12a8781
(103 lines)
(+18/-85)
[
Show
| Annotate
]
Branch: 7.9
Removed code duplication in the support for MSVC.
Rev: src/interpret.c:1.319
2:
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
- || $Id: interpret.c,v 1.318 2003/08/06 18:05:26 mast Exp $
+ || $Id: interpret.c,v 1.319 2003/08/06 18:54:18 mast Exp $
*/
#include "global.h"
- RCSID("$Id: interpret.c,v 1.318 2003/08/06 18:05:26 mast Exp $");
+ RCSID("$Id: interpret.c,v 1.319 2003/08/06 18:54:18 mast Exp $");
#include "interpret.h"
#include "object.h"
#include "program.h"
1148:
#undef HAVE_COMPUTED_GOTO
- #ifdef __GNUC__
-
- /* Define the program counter if necessary. */
- DEF_PROG_COUNTER;
-
+
#ifdef PIKE_DEBUG
/* Note: The debug code is extracted, to keep the frame size constant. */
static int eval_instruction_low(PIKE_OPCODE_T *pc);
1189: Inside #if defined(__GNUC__)
if(do_inter_return_label != NULL)
Pike_fatal("eval_instruction called with NULL (twice).\n");
+ #ifdef __GNUC__
do_inter_return_label = && inter_return_label;
do_escape_catch_label = && inter_escape_catch_label;
-
- /* Trick optimizer */
- if(!dummy_label)
- return 0;
- }
-
- CALL_MACHINE_CODE(pc);
-
- /* This code is never reached, but will
- * prevent gcc from optimizing the labels below too much
- */
-
- fprintf(stderr,"We have reached the end of the world!\n");
- goto *dummy_label;
-
- inter_escape_catch_label:
- EXIT_MACHINE_CODE();
- return -2;
-
- inter_return_label:
- EXIT_MACHINE_CODE();
- return -1;
- }
-
- #else /* __GNUC__ */
- #ifdef _M_IX86
-
- void *inter_return_label;
- void *escape_catch_label;
-
- #ifdef PIKE_DEBUG
- /* Note: The debug code is extracted, to keep the frame size constant. */
- static int eval_instruction_low(PIKE_OPCODE_T *pc);
- #endif /* PIKE_DEBUG */
-
- static int eval_instruction(PIKE_OPCODE_T *pc)
- #ifdef PIKE_DEBUG
- {
- if (Pike_interpreter.trace_level > 5 && pc) {
- int i;
- fprintf(stderr, "Calling code at %p:\n", pc);
- #ifdef PIKE_OPCODE_ALIGN
- if (((INT32)pc) % PIKE_OPCODE_ALIGN) {
- Pike_fatal("Odd offset!\n");
- }
- #endif /* PIKE_OPCODE_ALIGN */
- for (i=0; i < 16; i+=4) {
- fprintf(stderr,
- " 0x%08x 0x%08x 0x%08x 0x%08x\n",
- ((int *)pc)[i],
- ((int *)pc)[i+1],
- ((int *)pc)[i+2],
- ((int *)pc)[i+3]);
- }
- }
- return eval_instruction_low(pc);
- }
-
- static int eval_instruction_low(PIKE_OPCODE_T *pc)
- #endif /* PIKE_DEBUG */
- {
- if(pc == NULL) {
-
- if(do_inter_return_label != NULL)
- Pike_fatal("eval_instruction called with NULL (twice).\n");
-
+ #elif defined (_M_IX86)
+ /* MSVC. */
_asm
{
- lea eax,inter_return_label2
+ lea eax,inter_return_label
mov do_inter_return_label,eax
lea eax,inter_escape_catch_label
mov do_escape_catch_label,eax
}
-
+ #else
+ #error Machine code not supported with this compiler.
+ #endif
/* Trick optimizer */
if(!dummy_label)
1276: Inside #if defined(_M_IX86)
* prevent gcc from optimizing the labels below too much
*/
+ #ifdef PIKE_DEBUG
fprintf(stderr,"We have reached the end of the world!\n");
- goto dummy_label;
+ #endif
-
+ if (dummy_label) {
inter_escape_catch_label:
EXIT_MACHINE_CODE();
return -2;
-
+ }
- inter_return_label2:
+ inter_return_label:
EXIT_MACHINE_CODE();
return -1;
-
- dummy_label:
- ;
+
}
- #endif /* _M_IX86 */
- #endif /* __GNUC__ */
-
+
#ifndef SET_PROG_COUNTER
#define SET_PROG_COUNTER(X) (PROG_COUNTER=(X))
#endif /* SET_PROG_COUNTER */