Branch: Tag:

2003-08-06

2003-08-06 18:05:30 by Martin Stjernholm <mast@lysator.liu.se>

Added the possibility for opcodes to pass the jump address through the
return value instead of changing PROG_COUNTER directly. Any opcode which
might jump is now a JUMP opcode, and the old jump opcodes are now PTRJUMP.

Rev: bin/make_interpret_functions.pike:1.8
Rev: src/code/README.txt:1.21
Rev: src/interpret.c:1.318
Rev: src/interpret_functions.h:1.154
Rev: src/interpreter.h:1.85
Rev: src/lex.c:1.114
Rev: src/lex.h:1.28
Rev: src/opcodes.h:1.33
Rev: src/peep.c:1.87

2:   || 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: interpreter.h,v 1.84 2003/03/22 17:32:20 grubba Exp $ + || $Id: interpreter.h,v 1.85 2003/08/06 18:05:27 mast Exp $   */      #undef LOW_GET_ARG
17:   #undef BREAK   #undef DONE    + #undef JUMP_DONE + #define JUMP_DONE DONE +    #ifdef HAVE_COMPUTED_GOTO      #define CASE(OP) PIKE_CONCAT(LABEL_,OP): FETCH
168:   #define OPCODE1_TAIL(OP, DESC, FLAGS, CODE) CASE(OP); CODE   #define OPCODE2_TAIL(OP, DESC, FLAGS, CODE) CASE(OP); CODE    + #define OPCODE0_JUMP OPCODE0 + #define OPCODE1_JUMP OPCODE1 + #define OPCODE2_JUMP OPCODE2 + #define OPCODE0_TAILJUMP OPCODE0_TAIL + #define OPCODE1_TAILJUMP OPCODE1_TAIL + #define OPCODE2_TAILJUMP OPCODE2_TAIL +    #define OPCODE0_RETURN(OP, DESC, FLAGS, CODE) OPCODE0(OP, DESC, FLAGS, CODE)   #define OPCODE1_RETURN(OP, DESC, FLAGS, CODE) OPCODE1(OP, DESC, FLAGS, CODE)   #define OPCODE2_RETURN(OP, DESC, FLAGS, CODE) OPCODE2(OP, DESC, FLAGS, CODE)
175:   #define OPCODE1_TAILRETURN(OP, DESC, FLAGS, CODE) OPCODE1_TAIL(OP, DESC, FLAGS, CODE)   #define OPCODE2_TAILRETURN(OP, DESC, FLAGS, CODE) OPCODE2_TAIL(OP, DESC, FLAGS, CODE)    - #define OPCODE0_JUMP(OP, DESC, FLAGS, CODE) CASE(OP); CODE; DONE - #define OPCODE0_TAILJUMP(OP, DESC, FLAGS, CODE) CASE(OP); CODE + #define OPCODE0_PTRJUMP(OP, DESC, FLAGS, CODE) CASE(OP); CODE; DONE + #define OPCODE0_TAILPTRJUMP(OP, DESC, FLAGS, CODE) CASE(OP); CODE      /* These are something of a special case as they    * requires a POINTER stored explicitly after    * the instruction itself.    */ - #define OPCODE1_JUMP(OP, DESC, FLAGS, CODE) CASE(OP); { \ + #define OPCODE1_PTRJUMP(OP, DESC, FLAGS, CODE) CASE(OP); { \    INT32 arg1=GET_ARG(); \    FETCH; \    CODE; \    } DONE    - #define OPCODE2_JUMP(OP, DESC, FLAGS, CODE) CASE(OP); { \ + #define OPCODE2_PTRJUMP(OP, DESC, FLAGS, CODE) CASE(OP); { \    INT32 arg1=GET_ARG(); \    INT32 arg2=GET_ARG2(); \    FETCH; \    CODE; \    } DONE    - #define OPCODE1_TAILJUMP(OP, DESC, FLAGS, CODE) CASE(OP); CODE - #define OPCODE2_TAILJUMP(OP, DESC, FLAGS, CODE) CASE(OP); CODE + #define OPCODE1_TAILPTRJUMP(OP, DESC, FLAGS, CODE) CASE(OP); CODE + #define OPCODE2_TAILPTRJUMP(OP, DESC, FLAGS, CODE) CASE(OP); CODE    - #define OPCODE0_BRANCH OPCODE0_JUMP - #define OPCODE1_BRANCH OPCODE1_JUMP - #define OPCODE2_BRANCH OPCODE2_JUMP - #define OPCODE0_TAILBRANCH OPCODE0_TAILJUMP - #define OPCODE1_TAILBRANCH OPCODE1_TAILJUMP - #define OPCODE2_TAILBRANCH OPCODE2_TAILJUMP + #define OPCODE0_BRANCH OPCODE0_PTRJUMP + #define OPCODE1_BRANCH OPCODE1_PTRJUMP + #define OPCODE2_BRANCH OPCODE2_PTRJUMP + #define OPCODE0_TAILBRANCH OPCODE0_TAILPTRJUMP + #define OPCODE1_TAILBRANCH OPCODE1_TAILPTRJUMP + #define OPCODE2_TAILBRANCH OPCODE2_TAILPTRJUMP      #include "interpret_functions.h"   
230:   #undef OPCODE0_TAILJUMP   #undef OPCODE1_TAILJUMP   #undef OPCODE2_TAILJUMP + #undef OPCODE0_PTRJUMP + #undef OPCODE1_PTRJUMP + #undef OPCODE2_PTRJUMP + #undef OPCODE0_TAILPTRJUMP + #undef OPCODE1_TAILPTRJUMP + #undef OPCODE2_TAILPTRJUMP   #undef OPCODE0_RETURN   #undef OPCODE1_RETURN   #undef OPCODE2_RETURN
256:   #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), + #define OPCODE0_PTRJUMP(OP,DESC) LABEL(OP), + #define OPCODE1_PTRJUMP(OP,DESC) LABEL(OP), + #define OPCODE2_PTRJUMP(OP,DESC) LABEL(OP), + #define OPCODE0_TAILPTRJUMP(OP,DESC) LABEL(OP), + #define OPCODE1_TAILPTRJUMP(OP,DESC) LABEL(OP), + #define OPCODE2_TAILPTRJUMP(OP,DESC) LABEL(OP),   #define OPCODE0_RETURN(OP,DESC) LABEL(OP),   #define OPCODE1_RETURN(OP,DESC) LABEL(OP),   #define OPCODE2_RETURN(OP,DESC) LABEL(OP),