pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*   || 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.274 2002/10/30 17:02:40 nilsson Exp $ + || $Id: interpret.c,v 1.275 2002/11/02 15:25:57 grubba Exp $   */      #include "global.h" - RCSID("$Id: interpret.c,v 1.274 2002/10/30 17:02:40 nilsson Exp $"); + RCSID("$Id: interpret.c,v 1.275 2002/11/02 15:25:57 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:821:   DO_IF_DEBUG(if(t_flag > 3) fprintf(stderr,"- (%p,%ld): %s(%d)\n",PROG_COUNTER,DO_NOT_WARN((long)(Pike_sp-Pike_interpreter.evaluator_stack)),N,arg1)); \   C }         #define OPCODE2(O,N,F,C) \   void PIKE_CONCAT(opcode_,O)(INT32 arg1,INT32 arg2) { \    DEF_PROG_COUNTER; \   DO_IF_DEBUG(if(t_flag > 3) fprintf(stderr,"- (%p,%ld): %s(%d,%d)\n",PROG_COUNTER,DO_NOT_WARN((long)(Pike_sp-Pike_interpreter.evaluator_stack)),N,arg1,arg2)); \   C }    + #ifdef OPCODE_INLINE_BRANCH + #define TEST_OPCODE0(O,N,F,C) \ + int PIKE_CONCAT(test_opcode_,O)(void) { \ +  int branch_taken = 0; \ +  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; \ +  return branch_taken; \ +  }    -  + #define TEST_OPCODE1(O,N,F,C) \ + int PIKE_CONCAT(test_opcode_,O)(INT32 arg1) {\ +  int branch_taken = 0; \ +  DEF_PROG_COUNTER; \ +  DO_IF_DEBUG(if(t_flag > 3) \ +  fprintf(stderr, "- (%p,%ld): %s(%d)\n", PROG_COUNTER, \ +  DO_NOT_WARN((long)(Pike_sp-Pike_interpreter.evaluator_stack)), \ +  N, arg1)); \ +  C; \ +  return branch_taken; \ +  } +  +  + #define TEST_OPCODE2(O,N,F,C) \ + int PIKE_CONCAT(test_opcode_,O)(INT32 arg1, INT32 arg2) { \ +  int branch_taken = 0; \ +  DEF_PROG_COUNTER; \ +  DO_IF_DEBUG(if(t_flag > 3) \ +  fprintf(stderr, "- (%p,%ld): %s(%d,%d)\n", PROG_COUNTER, \ +  DO_NOT_WARN((long)(Pike_sp-Pike_interpreter.evaluator_stack)), \ +  N, arg1, arg2)); \ +  C; \ +  return branch_taken; \ +  } +  + #define DO_BRANCH (branch_taken = -1) + #define DONT_BRANCH (branch_taken = 0) + #else /* !OPCODE_INLINE_BRANCH */ + #define TEST_OPCODE0 OPCODE0 + #define TEST_OPCODE1 OPCODE1 + #define TEST_OPCODE2 OPCODE2 + #endif /* OPCODE_INLINE_BRANCH */ +    #define OPCODE0_JUMP(O,N,F,C) OPCODE0(O,N,F,C)   #define OPCODE1_JUMP(O,N,F,C) OPCODE1(O,N,F,C)   #define OPCODE2_JUMP(O,N,F,C) OPCODE2(O,N,F,C)      #define OPCODE0_TAIL(O,N,F,C) OPCODE0(O,N,F,C)   #define OPCODE1_TAIL(O,N,F,C) OPCODE1(O,N,F,C)   #define OPCODE2_TAIL(O,N,F,C) OPCODE2(O,N,F,C)      #define OPCODE0_TAILJUMP(O,N,F,C) OPCODE0(O,N,F,C)   #define OPCODE1_TAILJUMP(O,N,F,C) OPCODE1(O,N,F,C)   #define OPCODE2_TAILJUMP(O,N,F,C) OPCODE2(O,N,F,C)      #define OPCODE0_RETURN(O,N,F,C) OPCODE0(O,N,F,C)   #define OPCODE1_RETURN(O,N,F,C) OPCODE1(O,N,F,C)   #define OPCODE2_RETURN(O,N,F,C) OPCODE2(O,N,F,C)      #define OPCODE0_RETURNJUMP(O,N,F,C) OPCODE0(O,N,F,C)   #define OPCODE1_RETURNJUMP(O,N,F,C) OPCODE1(O,N,F,C)   #define OPCODE2_RETURNJUMP(O,N,F,C) OPCODE2(O,N,F,C)    -  + /* BRANCH opcodes only generate code for the test, +  * so that the branch instruction can be inlined. +  */ + #define OPCODE0_BRANCH(O,N,F,C) TEST_OPCODE0(O,N,F,C) + #define OPCODE1_BRANCH(O,N,F,C) TEST_OPCODE1(O,N,F,C) + #define OPCODE2_BRANCH(O,N,F,C) TEST_OPCODE2(O,N,F,C) + #define OPCODE0_TAILBRANCH(O,N,F,C) TEST_OPCODE0(O,N,F,C) + #define OPCODE1_TAILBRANCH(O,N,F,C) TEST_OPCODE1(O,N,F,C) + #define OPCODE2_TAILBRANCH(O,N,F,C) TEST_OPCODE2(O,N,F,C) +    #undef HAVE_COMPUTED_GOTO      #ifdef __GNUC__      /* Define the program counter if necessary. */   DEF_PROG_COUNTER;      static int eval_instruction(PIKE_OPCODE_T *pc)   {    if(pc == NULL) {