pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: interpret.c,v 1.232 2001/07/24 17:26:40 grubba Exp $"); + RCSID("$Id: interpret.c,v 1.233 2001/07/26 18:19:30 grubba Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "pike_error.h"   #include "language.h"   #include "stralloc.h"   #include "constants.h"
pike.git/src/interpret.c:760:    if (x == -2) \    fatal("Return value -2 from eval_instruction is not handled here.\n"\    "Probable cause: F_ESCAPE_CATCH outside catch block.\n")   #else   #define EVAL_INSTR_RET_CHECK(x)   #endif         #ifdef PIKE_USE_MACHINE_CODE    - #ifdef sparc - #define LOW_GET_JUMP() (PROG_COUNTER[0]) - #define LOW_SKIPJUMP() (SET_PROG_COUNTER(PROG_COUNTER + 1)) - #else /* !sparc */ - #define LOW_GET_JUMP() EXTRACT_INT(PROG_COUNTER) - #define LOW_SKIPJUMP() (SET_PROG_COUNTER(PROG_COUNTER + sizeof(INT32))) - #endif /* sparc */ -  +    /* Labels to jump to to cause eval_instruction to return */   /* FIXME: Replace these with assembler lables */   void *do_inter_return_label;   void *do_escape_catch_label;   void *dummy_label;    - #ifdef sparc - #define DEF_PROG_COUNTER register unsigned INT32 *reg_pc __asm__ ("%i7") - #else /* !sparc */ + #ifndef DEF_PROG_COUNTER   #define DEF_PROG_COUNTER - #endif /* sparc */ + #endif /* !DEF_PROG_COUNTER */      #define OPCODE0(O,N,C) \   void PIKE_CONCAT(opcode_,O)(void) { \    DEF_PROG_COUNTER; \   DO_IF_DEBUG(if(t_flag > 3) fprintf(stderr,"- (%p,%ld): %s()\n",PROG_COUNTER,DO_NOT_WARN((long)(Pike_sp-Pike_interpreter.evaluator_stack)),N));\   C }      #define OPCODE1(O,N,C) \   void PIKE_CONCAT(opcode_,O)(INT32 arg1) {\    DEF_PROG_COUNTER; \
pike.git/src/interpret.c:815:   #define OPCODE1_TAIL(O,N,C) OPCODE1(O,N,C)   #define OPCODE2_TAIL(O,N,C) OPCODE2(O,N,C)      #define OPCODE0_TAILJUMP(O,N,C) OPCODE0(O,N,C)   #define OPCODE1_TAILJUMP(O,N,C) OPCODE1(O,N,C)   #define OPCODE2_TAILJUMP(O,N,C) OPCODE2(O,N,C)      #undef HAVE_COMPUTED_GOTO      #ifdef __GNUC__ - #ifdef __i386__ - #define PROG_COUNTER (((unsigned char **)__builtin_frame_address(0))[1]) - #elif defined(sparc) - register unsigned INT32 *reg_pc __asm__ ("%i7"); - #define PROG_COUNTER (reg_pc + 2) - #define SET_PROG_COUNTER(X) (reg_pc = ((unsigned INT32 *)(X))-2) - #endif /* __i386__ || sparc */ +     -  + /* Define the program counter if necessary. */ + DEF_PROG_COUNTER; +    static int eval_instruction(PIKE_OPCODE_T *pc)   {    do_inter_return_label = && inter_return_label;    do_escape_catch_label = && inter_escape_catch_label;      #ifdef PIKE_DEBUG    if (t_flag) {    int i;    fprintf(stderr, "Calling code at 0x%p:\n", pc); - #ifdef sparc -  if (((INT32)pc) & 0x03) { + #ifdef PIKE_OPCODE_ALIGN +  if (((INT32)pc) % PIKE_OPCODE_ALIGN) {    fatal("Odd offset!\n");    } - #endif /* sparc */ + #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]);    }    }   #endif /* PIKE_DEBUG */      #ifdef __i386__    /* This code does not clobber %eax, but    * the code jumped to does.    */    __asm__ __volatile__( " sub $8,%%esp\n"    " jmp *%0"    : "=m" (pc)    :    : "cc", "memory", "eax" ); - #elif defined(sparc) + #else /* !__i386__ */    /* The test is needed to get the labels to work... */    if (pc) {    /* No extra setup needed!    */    return ((int (*)(void))pc)();    } - #endif /* __i386__ || sparc */ + #endif /* __i386__ */    /* 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;       /* %%esp will be slightly buggered after    * returning from the function code (8 bytes off), but that    * should not matter to these return statements. -Hubbe