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.219 2001/07/13 11:26:38 grubba Exp $"); + RCSID("$Id: interpret.c,v 1.220 2001/07/16 19:48:57 hubbe 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:737: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG   #define EVAL_INSTR_RET_CHECK(x) \    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 +  + #define LOW_GET_JUMP() EXTRACT_INT(PROG_COUNTER) + #define LOW_SKIPJUMP() (PROG_COUNTER += sizeof(INT32)) +  + /* 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; +  +  + #define OPCODE0(O,N,C) void PIKE_CONCAT(opcode_,O)(void) C + #define OPCODE1(O,N,C) void PIKE_CONCAT(opcode_,O)(INT32 arg1) C + #define OPCODE2(O,N,C) void PIKE_CONCAT(opcode_,O)(INT32 arg1,INT32 arg2) C +  + #define OPCODE0_JUMP(O,N,C) void PIKE_CONCAT(opcode_,O)(void) C + #define OPCODE1_JUMP(O,N,C) void PIKE_CONCAT(opcode_,O)(INT32 arg1) C + #define OPCODE2_JUMP(O,N,C) void PIKE_CONCAT(opcode_,O)(INT32 arg1,INT32 arg2) C +  + #define OPCODE0_TAIL(O,N,C) void PIKE_CONCAT(opcode_,O)(void) C + #define OPCODE1_TAIL(O,N,C) void PIKE_CONCAT(opcode_,O)(INT32 arg1) C + #define OPCODE2_TAIL(O,N,C) void PIKE_CONCAT(opcode_,O)(INT32 arg1,INT32 arg2) C +  + #define OPCODE0_TAILJUMP(O,N,C) void PIKE_CONCAT(opcode_,O)(void) C + #define OPCODE1_TAILJUMP(O,N,C) void PIKE_CONCAT(opcode_,O)(INT32 arg1) C + #define OPCODE2_TAILJUMP(O,N,C) void PIKE_CONCAT(opcode_,O)(INT32 arg1,INT32 arg2) C +  + #undef HAVE_COMPUTED_GOTO +  + #if defined(__i386__) && defined(__GNUC__) + #define PROG_COUNTER (((unsigned char **)__builtin_frame_address(0))[1]) +  + static int eval_instruction(PIKE_OPCODE_T *pc) + { +  do_inter_return_label = && inter_return_label; +  do_escape_catch_label = && inter_escape_catch_label; +  +  /* 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" ); +  +  /* 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 +  */ +  +  inter_return_label: return -1; +  inter_escape_catch_label: return -2; + } +  + #endif +  + #ifdef PIKE_USE_SPARC_GCC + #define PROG_COUNTER reg_pc + register void *reg_pc __asm__ ("%i7"); + #endif +  + #undef DONE + #undef FETCH + #undef INTER_RETURN + #undef INTER_ESCAPE_CATCH +  + #define DONE return + #define FETCH + #define INTER_RETURN {PROG_COUNTER=do_inter_return_label;DONE;} + #define INTER_ESCAPE_CATCH {PROG_COUNTER=do_escape_catch_label;DONE;} +  + #include "interpret_functions_fixed.h" +  +  + #else /* PIKE_USE_MACHINE_CODE */ +  +    #ifdef HAVE_COMPUTED_GOTO   int lookup_sort_fun(const void *a, const void *b)   {    return (int)(((ptrdiff_t)((struct op_2_f *)a)->opcode) -    ((ptrdiff_t)((struct op_2_f *)b)->opcode));   }   #endif /* HAVE_COMPUTED_GOTO */      /* NOTE: Due to the implementation of computed goto,    * interpreter.h may only be included once.    */   #if defined(PIKE_DEBUG) && !defined(HAVE_COMPUTED_GOTO)   #define eval_instruction eval_instruction_with_debug   #include "interpreter_debug.h"      #undef eval_instruction   #define eval_instruction eval_instruction_without_debug -  +    #undef PIKE_DEBUG -  + #undef NDEBUG + #undef DO_IF_DEBUG + #define DO_IF_DEBUG(X)   #define print_return_value()   #include "interpreter.h" - #undef print_return_value +    #define PIKE_DEBUG -  + #define NDEBUG + #undef DO_IF_DEBUG + #define DO_IF_DEBUG(X) X + #undef print_return_value +    #undef eval_instruction      static inline int eval_instruction(unsigned char *pc)   {    if(d_flag || t_flag>2)    return eval_instruction_with_debug(pc);    else    return eval_instruction_without_debug(pc);   }         #else   #include "interpreter.h"   #endif    -  +  + #endif /* PIKE_USE_MACHINE_CODE */ +    static void trace_return_value(void)   {    char *s;       init_buf();    my_strcat("Return: ");    describe_svalue(Pike_sp-1,0,0);    s=simple_free_buf();    if((size_t)strlen(s) > (size_t)TRACE_LEN)    {
pike.git/src/interpret.c:2073: Inside #if defined(DO_PIKE_CLEANUP) and #if 0
  #if 0    struct pike_frame_block *p;    int e;    for(p=pike_frame_blocks;p;p=p->next)    for(e=0;e<128;e++)    debug_malloc_dump_references( p->x + e);   #endif    free_all_pike_frame_blocks();   #endif   } -  +