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.317 2003/08/04 16:35:05 mast Exp $ + || $Id: interpret.c,v 1.318 2003/08/06 18:05:26 mast Exp $   */      #include "global.h" - RCSID("$Id: interpret.c,v 1.317 2003/08/04 16:35:05 mast Exp $"); + RCSID("$Id: interpret.c,v 1.318 2003/08/06 18:05:26 mast 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:898:    file->str,    (long)line,    backlog[e].pc - backlog[e].program->program,    low_get_f_name(backlog[e].instruction + F_OFFSET, backlog[e].program));    if(instrs[backlog[e].instruction].flags & I_HASARG2)    {    fprintf(stderr,"(%ld,%ld)",    (long)backlog[e].arg,    (long)backlog[e].arg2);    } -  else if(instrs[backlog[e].instruction].flags & I_JUMP) +  else if(instrs[backlog[e].instruction].flags & I_POINTER)    {    fprintf(stderr,"(%+ld)", (long)backlog[e].arg);    }    else if(instrs[backlog[e].instruction].flags & I_HASARG)    {    fprintf(stderr,"(%ld)", (long)backlog[e].arg);    }    fprintf(stderr," %ld, %ld\n",    DO_NOT_WARN((long)backlog[e].stack),    DO_NOT_WARN((long)backlog[e].mark_stack));
pike.git/src/interpret.c:1016:    DEF_PROG_COUNTER; \    DEBUG_PROLOGUE (O, ;); \   C }      #define OPCODE1(O,N,F,C) \   void PIKE_CONCAT(opcode_,O)(INT32 arg1) {\    DEF_PROG_COUNTER; \    DEBUG_PROLOGUE (O, DEBUG_LOG_ARG (arg1)); \   C }    -  +    #define OPCODE2(O,N,F,C) \   void PIKE_CONCAT(opcode_,O)(INT32 arg1,INT32 arg2) { \    DEF_PROG_COUNTER; \    DEBUG_PROLOGUE (O, DEBUG_LOG_ARG (arg1); DEBUG_LOG_ARG2 (arg2)); \   C }    -  + #ifdef OPCODE_RETURN_JUMPADDR +  + #define OPCODE0_JUMP(O,N,F,C) \ +  void *PIKE_CONCAT(jump_opcode_,O)(void) { \ +  void *jumpaddr DO_IF_DEBUG(= NULL); \ +  DEF_PROG_COUNTER; \ +  DEBUG_PROLOGUE (O, ;); \ +  C; \ +  JUMP_DONE; \ +  } +  + #define OPCODE1_JUMP(O,N,F,C) \ +  void *PIKE_CONCAT(jump_opcode_,O)(INT32 arg1) { \ +  void *jumpaddr DO_IF_DEBUG(= NULL); \ +  DEF_PROG_COUNTER; \ +  DEBUG_PROLOGUE (O, DEBUG_LOG_ARG (arg1)); \ +  C; \ +  JUMP_DONE; \ +  } +  + #define OPCODE2_JUMP(O,N,F,C) \ +  void *PIKE_CONCAT(jump_opcode_,O)(INT32 arg1, INT32 arg2) { \ +  void *jumpaddr DO_IF_DEBUG(= NULL); \ +  DEF_PROG_COUNTER; \ +  DEBUG_PROLOGUE (O, DEBUG_LOG_ARG (arg1); DEBUG_LOG_ARG2 (arg2)); \ +  C; \ +  JUMP_DONE; \ +  } +  + #define SET_PROG_COUNTER(X) (jumpaddr = (X)) +  + #ifdef PIKE_DEBUG + #define JUMP_DONE do { \ +  if (!jumpaddr) \ +  Pike_fatal ("Instruction didn't set jump address.\n"); \ +  return jumpaddr; \ +  } while (0) + #else + #define JUMP_DONE return jumpaddr + #endif +  + #else /* !OPCODE_RETURN_JUMPADDR */ + #define OPCODE0_JUMP OPCODE0 + #define OPCODE1_JUMP OPCODE1 + #define OPCODE2_JUMP OPCODE2 + #define JUMP_DONE DONE + #endif /* !OPCODE_RETURN_JUMPADDR */ +    #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; \    DEBUG_PROLOGUE (O, ;); \    C; \    return branch_taken; \    }   
pike.git/src/interpret.c:1055:    int branch_taken = 0; \    DEF_PROG_COUNTER; \    DEBUG_PROLOGUE (O, DEBUG_LOG_ARG (arg1); DEBUG_LOG_ARG2 (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 + #define TEST_OPCODE0(O,N,F,C) OPCODE0_PTRJUMP(O,N,F,C) + #define TEST_OPCODE1(O,N,F,C) OPCODE1_PTRJUMP(O,N,F,C) + #define TEST_OPCODE2(O,N,F,C) OPCODE2_PTRJUMP(O,N,F,C)   #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_PTRJUMP(O,N,F,C) OPCODE0_JUMP(O,N,F,C) + #define OPCODE1_PTRJUMP(O,N,F,C) OPCODE1_JUMP(O,N,F,C) + #define OPCODE2_PTRJUMP(O,N,F,C) OPCODE2_JUMP(O,N,F,C) + #define OPCODE0_TAILPTRJUMP(O,N,F,C) OPCODE0_PTRJUMP(O,N,F,C) + #define OPCODE1_TAILPTRJUMP(O,N,F,C) OPCODE1_PTRJUMP(O,N,F,C) + #define OPCODE2_TAILPTRJUMP(O,N,F,C) OPCODE2_PTRJUMP(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_RETURN(O,N,F,C) OPCODE0_JUMP(O,N,F,C) + #define OPCODE1_RETURN(O,N,F,C) OPCODE1_JUMP(O,N,F,C) + #define OPCODE2_RETURN(O,N,F,C) OPCODE2_JUMP(O,N,F,C) + #define OPCODE0_TAILRETURN(O,N,F,C) OPCODE0_RETURN(O,N,F,C) + #define OPCODE1_TAILRETURN(O,N,F,C) OPCODE1_RETURN(O,N,F,C) + #define OPCODE2_TAILRETURN(O,N,F,C) OPCODE2_RETURN(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)   
pike.git/src/interpret.c:1253:   #define SET_PROG_COUNTER(X) (PROG_COUNTER=(X))   #endif /* SET_PROG_COUNTER */      #undef DONE   #undef FETCH   #undef INTER_RETURN   #undef INTER_ESCAPE_CATCH      #define DONE return   #define FETCH - #define INTER_RETURN {SET_PROG_COUNTER(do_inter_return_label);DONE;} - #define INTER_ESCAPE_CATCH {SET_PROG_COUNTER(do_escape_catch_label);DONE;} + #define INTER_RETURN {SET_PROG_COUNTER(do_inter_return_label);JUMP_DONE;} + #define INTER_ESCAPE_CATCH {SET_PROG_COUNTER(do_escape_catch_label);JUMP_DONE;}      #ifdef _M_IX86   // Disable frame pointer optimization   #pragma optimize("y", off)   #endif      #include "interpret_functions_fixed.h"      #ifdef _M_IX86   // Restore optimization