pike.git / src / interpreter.h

version» Context lines:

pike.git/src/interpreter.h:1:    + #undef LOW_GET_ARG + #undef LOW_GET_JUMP + #undef LOW_SKIPJUMP   #undef GET_ARG   #undef GET_ARG2   #undef GET_JUMP   #undef SKIPJUMP   #undef DOJUMP   #undef CASE   #undef BREAK   #undef DONE      #ifdef HAVE_COMPUTED_GOTO
pike.git/src/interpreter.h:15:   #define DONE continue   #else /* !PIKE_DEBUG */   #define DONE do { \    Pike_fp->pc = pc; \    instr = (pc++)[0]; \    goto *instr; \    } while(0)      #endif /* PIKE_DEBUG */    - #define LOW_GET_ARG() ((INT32)*(pc++)) - #define LOW_GET_JUMP() ((INT32)*(pc)) + #define LOW_GET_ARG() ((INT32)(ptrdiff_t)(*(pc++))) + #define LOW_GET_JUMP() ((INT32)(ptrdiff_t)(*(pc)))   #define LOW_SKIPJUMP() (pc++)    -  + #define GET_ARG() LOW_GET_ARG() + #define GET_ARG2() LOW_GET_ARG() +    #else /* !HAVE_COMPUTED_GOTO */      #define CASE(X) case (X)-F_OFFSET:   #define DONE break      #define LOW_GET_ARG() ((pc++)[0])   #define LOW_GET_JUMP() EXTRACT_INT(pc) - #define LOW_SKIP_JUMP() (pc += sizeof(INT32)) + #define LOW_SKIPJUMP() (pc += sizeof(INT32))    - #endif /* HAVE_COMPUTED_GOTO */ -  +    #ifdef PIKE_DEBUG      #define GET_ARG() (backlog[backlogp].arg=(\    instr=prefix,\    prefix=0,\    instr += LOW_GET_ARG(),\    (t_flag>3 ? sprintf(trace_buffer, "- Arg = %ld\n", \    (long)instr), \    write_to_stderr(trace_buffer,strlen(trace_buffer)) : 0),\    instr))      #define GET_ARG2() (backlog[backlogp].arg2=(\    instr=prefix2,\    prefix2=0,\    instr += LOW_GET_ARG(),\    (t_flag>3 ? sprintf(trace_buffer, "- Arg2 = %ld\n", \    (long)instr), \    write_to_stderr(trace_buffer,strlen(trace_buffer)) : 0),\    instr))    -  + #else /* !PIKE_DEBUG */ +  + #define GET_ARG() (instr=prefix,prefix=0,instr+LOW_GET_ARG()) + #define GET_ARG2() (instr=prefix2,prefix2=0,instr+LOW_GET_ARG()) +  + #endif /* PIKE_DEBUG */ +  + #endif /* HAVE_COMPUTED_GOTO */ +  + #ifdef PIKE_DEBUG +    #define GET_JUMP() (backlog[backlogp].arg=(\    (t_flag>3 ? sprintf(trace_buffer, "- Target = %+ld\n", \    (long)LOW_GET_JUMP()), \    write_to_stderr(trace_buffer,strlen(trace_buffer)) : 0), \    LOW_GET_JUMP()))    - #define SKIPJUMP() (GET_JUMP(), LOW_SKIP_JUMP()) + #define SKIPJUMP() (GET_JUMP(), LOW_SKIPJUMP())      #else /* !PIKE_DEBUG */    - #define GET_ARG() (instr=prefix,prefix=0,instr+LOW_GET_ARG()) - #define GET_ARG2() (instr=prefix2,prefix2=0,instr+LOW_GET_ARG()) -  +    #define GET_JUMP() LOW_GET_JUMP() - #define SKIPJUMP() LOW_SKIP_JUMP() + #define SKIPJUMP() LOW_SKIPJUMP()      #endif /* PIKE_DEBUG */      #define DOJUMP() do { \    INT32 tmp; \    tmp = GET_JUMP(); \    pc += tmp; \    if(tmp < 0) \    fast_check_threads_etc(6); \    } while(0)      #ifndef STEP_BREAK_LINE   #define STEP_BREAK_LINE   #endif      static int eval_instruction(PIKE_OPCODE_T *pc)   {    unsigned INT32 prefix2=0,prefix=0;   #ifdef HAVE_COMPUTED_GOTO    static void *strap = &&init_strap; -  void *instr; +  void *instr = NULL;   #else /* !HAVE_COMPUTED_GOTO */    unsigned INT32 instr;   #endif /* HAVE_COMPUTED_GOTO */      #ifdef HAVE_COMPUTED_GOTO    goto *strap;    normal_strap:   #endif /* HAVE_COMPUTED_GOTO */       debug_malloc_touch(Pike_fp);
pike.git/src/interpreter.h:124: Inside #if defined(PIKE_DEBUG) and #if defined(HAVE_COMPUTED_GOTO)
   DO_NOT_WARN((long)(pc-Pike_fp->context.prog->program-1)),   #ifdef HAVE_COMPUTED_GOTO    get_f_name(instr),   #else /* !HAVE_COMPUTED_GOTO */    get_f_name(instr + F_OFFSET),   #endif /* HAVE_COMPUTED_GOTO */    DO_NOT_WARN((long)(Pike_sp-Pike_interpreter.evaluator_stack)),    DO_NOT_WARN((long)(Pike_mark_sp-Pike_interpreter.mark_stack)));    }    + #ifdef HAVE_COMPUTED_GOTO +  ADD_RUNNED(instr); + #else /* !HAVE_COMPUTED_GOTO */    if(instr + F_OFFSET < F_MAX_OPCODE)    ADD_RUNNED(instr + F_OFFSET); -  + #endif /* HAVE_COMPUTED_GOTO */       if(d_flag)    {    backlogp++;    if(backlogp >= BACKLOG) backlogp=0;       if(backlog[backlogp].program)    free_program(backlog[backlogp].program);       backlog[backlogp].program=Pike_fp->context.prog;
pike.git/src/interpreter.h:218:    break;    }    }   #endif      #ifdef HAVE_COMPUTED_GOTO    goto *instr;   #else /* !HAVE_COMPUTED_GOTO */    switch(instr)    { - #endif /* HAVE_COMPUTED_GOTO */ +  /* NOTE: The prefix handling is not needed in computed-goto mode. */    /* Support to allow large arguments */    CASE(F_PREFIX_256); prefix+=256; DONE;    CASE(F_PREFIX_512); prefix+=512; DONE;    CASE(F_PREFIX_768); prefix+=768; DONE;    CASE(F_PREFIX_1024); prefix+=1024; DONE;    CASE(F_PREFIX_24BITX256);    prefix += (pc++)[0]<<24;    CASE(F_PREFIX_WORDX256);    prefix += (pc++)[0]<<16;    CASE(F_PREFIX_CHARX256);
pike.git/src/interpreter.h:244:    CASE(F_PREFIX2_512); prefix2+=512; DONE;    CASE(F_PREFIX2_768); prefix2+=768; DONE;    CASE(F_PREFIX2_1024); prefix2+=1024; DONE;    CASE(F_PREFIX2_24BITX256);    prefix2 += (pc++)[0]<<24;    CASE(F_PREFIX2_WORDX256);    prefix2 += (pc++)[0]<<16;    CASE(F_PREFIX2_CHARX256);    prefix2 += (pc++)[0]<<8;    DONE; + #endif /* HAVE_COMPUTED_GOTO */         #define INTERPRETER      #define OPCODE0(OP, DESC, CODE) CASE(OP); CODE; DONE   #define OPCODE1(OP, DESC, CODE) CASE(OP); { \    INT32 arg1=GET_ARG(); \    CODE; \    } DONE   
pike.git/src/interpreter.h:311:   #undef OPCODE0_TAIL   #undef OPCODE1_TAIL   #undef OPCODE2_TAIL   #undef OPCODE0_JUMP   #undef OPCODE1_JUMP   #undef OPCODE2_JUMP   #undef OPCODE0_TAILJUMP   #undef OPCODE1_TAILJUMP   #undef OPCODE2_TAILJUMP   #undef LABEL - #define LABEL(OP) &&PIKE_CONCAT(LABEL_,OP) - #define OPCODE0(OP,DESC,CODE) LABEL(OP), - #define OPCODE1(OP,DESC,CODE) LABEL(OP), - #define OPCODE2(OP,DESC,CODE) LABEL(OP), - #define OPCODE0_TAIL(OP,DESC,CODE) LABEL(OP), - #define OPCODE1_TAIL(OP,DESC,CODE) LABEL(OP), - #define OPCODE2_TAIL(OP,DESC,CODE) LABEL(OP), - #define OPCODE0_JUMP(OP,DESC,CODE) LABEL(OP), - #define OPCODE1_JUMP(OP,DESC,CODE) LABEL(OP), - #define OPCODE2_JUMP(OP,DESC,CODE) LABEL(OP), - #define OPCODE0_TAILJUMP(OP,DESC,CODE) LABEL(OP), - #define OPCODE1_TAILJUMP(OP,DESC,CODE) LABEL(OP), - #define OPCODE2_TAILJUMP(OP,DESC,CODE) LABEL(OP), + #define LABEL(OP) &&PIKE_CONCAT(LABEL_,OP) + #define NULL_LABEL(OP) NULL + #define OPCODE0(OP,DESC) LABEL(OP), + #define OPCODE1(OP,DESC) LABEL(OP), + #define OPCODE2(OP,DESC) LABEL(OP), + #define OPCODE0_TAIL(OP,DESC) LABEL(OP), + #define OPCODE1_TAIL(OP,DESC) LABEL(OP), + #define OPCODE2_TAIL(OP,DESC) LABEL(OP), + #define OPCODE0_JUMP(OP,DESC) LABEL(OP), + #define OPCODE1_JUMP(OP,DESC) LABEL(OP), + #define OPCODE2_JUMP(OP,DESC) LABEL(OP), + #define OPCODE0_TAILJUMP(OP,DESC) LABEL(OP), + #define OPCODE1_TAILJUMP(OP,DESC) LABEL(OP), + #define OPCODE2_TAILJUMP(OP,DESC) LABEL(OP),       init_strap:    strap = &&normal_strap;    {    static void *table[] = { -  LABEL(F_PREFIX_256), -  LABEL(F_PREFIX_512), -  LABEL(F_PREFIX_768), -  LABEL(F_PREFIX_1024), -  LABEL(F_PREFIX_CHARX256), -  LABEL(F_PREFIX_WORDX256), -  LABEL(F_PREFIX_24BITX256), +  NULL_LABEL(F_PREFIX_256), +  NULL_LABEL(F_PREFIX_512), +  NULL_LABEL(F_PREFIX_768), +  NULL_LABEL(F_PREFIX_1024), +  NULL_LABEL(F_PREFIX_CHARX256), +  NULL_LABEL(F_PREFIX_WORDX256), +  NULL_LABEL(F_PREFIX_24BITX256),    -  LABEL(F_PREFIX2_256), -  LABEL(F_PREFIX2_512), -  LABEL(F_PREFIX2_768), -  LABEL(F_PREFIX2_1024), -  LABEL(F_PREFIX2_CHARX256), -  LABEL(F_PREFIX2_WORDX256), -  LABEL(F_PREFIX2_24BITX256), +  NULL_LABEL(F_PREFIX2_256), +  NULL_LABEL(F_PREFIX2_512), +  NULL_LABEL(F_PREFIX2_768), +  NULL_LABEL(F_PREFIX2_1024), +  NULL_LABEL(F_PREFIX2_CHARX256), +  NULL_LABEL(F_PREFIX2_WORDX256), +  NULL_LABEL(F_PREFIX2_24BITX256),       LABEL(F_INDEX),    LABEL(F_POS_INT_INDEX),    LABEL(F_NEG_INT_INDEX),       LABEL(F_RETURN),    LABEL(F_DUMB_RETURN),    LABEL(F_RETURN_0),    LABEL(F_RETURN_1),    LABEL(F_RETURN_LOCAL),    LABEL(F_RETURN_IF_TRUE),    -  LABEL(F_FOREACH), -  LABEL(F_NEW_FOREACH), -  +    #include "interpret_protos.h"    };      #ifdef PIKE_DEBUG    if (sizeof(table) != (F_MAX_OPCODE-(F_OFFSET+1))*sizeof(void *))    fatal("opcode_to_label out of sync: 0x%08lx != 0x%08lx\n",    DO_NOT_WARN((long)sizeof(table)),    DO_NOT_WARN((long)((F_MAX_OPCODE-(F_OFFSET+1))*sizeof(void *))));   #endif /* PIKE_DEBUG */    fcode_to_opcode = table;    return 0;    }   #endif /* HAVE_COMPUTED_GOTO */   }