Branch: Tag:

2001-07-16

2001-07-16 19:48:59 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

first incarnation of --with-machine-code it only work on x86 with gcc so far, and that doesn't even work either...

Rev: bin/make_interpret_functions.pike:1.1
Rev: src/Makefile.in:1.268
Rev: src/acconfig.h:1.92
Rev: src/configure.in:1.538
Rev: src/interpret.c:1.220
Rev: src/interpret_functions.h:1.76
Rev: src/interpreter.h:1.70
Rev: src/las.c:1.257
Rev: src/lex.c:1.98
Rev: src/lex.h:1.19
Rev: src/peep.c:1.54
Rev: src/program.c:1.354
Rev: src/program.h:1.139

5:   \*/   /**/   #include "global.h" - RCSID("$Id: lex.c,v 1.97 2001/07/15 23:14:37 hubbe Exp $"); + RCSID("$Id: lex.c,v 1.98 2001/07/16 19:48:58 hubbe Exp $");   #include "language.h"   #include "array.h"   #include "lex.h"
145:   #endif   }    - #define OPCODE0(OP,DESC) { DESC, OP, 0 }, - #define OPCODE1(OP,DESC) { DESC, OP, I_HASARG }, - #define OPCODE2(OP,DESC) { DESC, OP, I_TWO_ARGS }, + #ifdef PIKE_USE_MACHINE_CODE + #define ADDR(X) , (void *)PIKE_CONCAT(opcode_,X) + #define NULLADDR , 0    - #define OPCODE0_TAIL(OP,DESC) { DESC, OP, 0 }, - #define OPCODE1_TAIL(OP,DESC) { DESC, OP, I_HASARG }, - #define OPCODE2_TAIL(OP,DESC) { DESC, OP, I_TWO_ARGS }, + #define OPCODE0(OP,DESC) void PIKE_CONCAT(opcode_,OP)(void); + #define OPCODE1(OP,DESC) void PIKE_CONCAT(opcode_,OP)(INT32); + #define OPCODE2(OP,DESC) void PIKE_CONCAT(opcode_,OP)(INT32,INT32);    - #define OPCODE0_JUMP(OP,DESC) { DESC, OP, I_ISJUMP }, - #define OPCODE1_JUMP(OP,DESC) { DESC, OP, I_HASARG }, - #define OPCODE2_JUMP(OP,DESC) { DESC, OP, I_TWO_ARGS }, + #define OPCODE0_TAIL(OP,DESC) void PIKE_CONCAT(opcode_,OP)(void); + #define OPCODE1_TAIL(OP,DESC) void PIKE_CONCAT(opcode_,OP)(INT32); + #define OPCODE2_TAIL(OP,DESC) void PIKE_CONCAT(opcode_,OP)(INT32,INT32);    - #define OPCODE0_TAILJUMP(OP,DESC) { DESC, OP, I_ISJUMP }, - #define OPCODE1_TAILJUMP(OP,DESC) { DESC, OP, I_HASARG }, - #define OPCODE2_TAILJUMP(OP,DESC) { DESC, OP, I_TWO_ARGS }, + #define OPCODE0_JUMP(OP,DESC) void PIKE_CONCAT(opcode_,OP)(void); + #define OPCODE1_JUMP(OP,DESC) void PIKE_CONCAT(opcode_,OP)(INT32); + #define OPCODE2_JUMP(OP,DESC) void PIKE_CONCAT(opcode_,OP)(INT32,INT32);    -  + #define OPCODE0_TAILJUMP(OP,DESC) void PIKE_CONCAT(opcode_,OP)(void); + #define OPCODE1_TAILJUMP(OP,DESC) void PIKE_CONCAT(opcode_,OP)(INT32); + #define OPCODE2_TAILJUMP(OP,DESC) void PIKE_CONCAT(opcode_,OP)(INT32,INT32); +  + #include "interpret_protos.h" +  + #undef OPCODE0 + #undef OPCODE1 + #undef OPCODE2 +  + #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 +  + #else + #define ADDR(X) + #define NULLADDR + #endif +  + #define OPCODE0(OP,DESC) { DESC, OP, 0 ADDR(OP) }, + #define OPCODE1(OP,DESC) { DESC, OP, I_HASARG ADDR(OP) }, + #define OPCODE2(OP,DESC) { DESC, OP, I_TWO_ARGS ADDR(OP) }, +  + #define OPCODE0_TAIL(OP,DESC) { DESC, OP, 0 ADDR(OP) }, + #define OPCODE1_TAIL(OP,DESC) { DESC, OP, I_HASARG ADDR(OP) }, + #define OPCODE2_TAIL(OP,DESC) { DESC, OP, I_TWO_ARGS ADDR(OP) }, +  + #define OPCODE0_JUMP(OP,DESC) { DESC, OP, I_ISJUMP ADDR(OP) }, + #define OPCODE1_JUMP(OP,DESC) { DESC, OP, I_HASARG ADDR(OP) }, + #define OPCODE2_JUMP(OP,DESC) { DESC, OP, I_TWO_ARGS ADDR(OP) }, +  + #define OPCODE0_TAILJUMP(OP,DESC) { DESC, OP, I_ISJUMP ADDR(OP) }, + #define OPCODE1_TAILJUMP(OP,DESC) { DESC, OP, I_HASARG ADDR(OP) }, + #define OPCODE2_TAILJUMP(OP,DESC) { DESC, OP, I_TWO_ARGS ADDR(OP) }, +    #define LEXER      struct keyword instr_names[]=
168:   #ifndef PIKE_PRECOMPILER   #include "interpret_protos.h"   #endif /* !PIKE_PRECOMPILER */ - { "%=", F_MOD_EQ,0 }, - { "&=", F_AND_EQ,0 }, - { "|=", F_OR_EQ,0 }, - { "*=", F_MULT_EQ,0 }, - { "+=", F_ADD_EQ,0 }, - { "-=", F_SUB_EQ,0 }, - { "/=", F_DIV_EQ,0 }, - { "<<=", F_LSH_EQ,0 }, - { ">>=", F_RSH_EQ,0 }, - { "^=", F_XOR_EQ,0 }, - { "arg+=1024", F_PREFIX_1024,0 }, - { "arg+=256", F_PREFIX_256,0 }, - { "arg+=256*X", F_PREFIX_CHARX256,0 }, - { "arg+=256*XX", F_PREFIX_WORDX256,0 }, - { "arg+=256*XXX", F_PREFIX_24BITX256,0 }, - { "arg+=512", F_PREFIX_512,0 }, - { "arg+=768", F_PREFIX_768,0 }, + { "%=", F_MOD_EQ,0 NULLADDR }, + { "&=", F_AND_EQ,0 NULLADDR }, + { "|=", F_OR_EQ,0 NULLADDR }, + { "*=", F_MULT_EQ,0 NULLADDR }, + { "+=", F_ADD_EQ,0 NULLADDR }, + { "-=", F_SUB_EQ,0 NULLADDR }, + { "/=", F_DIV_EQ,0 NULLADDR }, + { "<<=", F_LSH_EQ,0 NULLADDR }, + { ">>=", F_RSH_EQ,0 NULLADDR }, + { "^=", F_XOR_EQ,0 NULLADDR }, + { "arg+=1024", F_PREFIX_1024,0 NULLADDR }, + { "arg+=256", F_PREFIX_256,0 NULLADDR }, + { "arg+=256*X", F_PREFIX_CHARX256,0 NULLADDR }, + { "arg+=256*XX", F_PREFIX_WORDX256,0 NULLADDR }, + { "arg+=256*XXX", F_PREFIX_24BITX256,0 NULLADDR }, + { "arg+=512", F_PREFIX_512,0 NULLADDR }, + { "arg+=768", F_PREFIX_768,0 NULLADDR },    - { "arg+=1024", F_PREFIX2_1024,0 }, - { "arg+=256", F_PREFIX2_256,0 }, - { "arg+=256*X", F_PREFIX2_CHARX256,0 }, - { "arg+=256*XX", F_PREFIX2_WORDX256,0 }, - { "arg+=256*XXX", F_PREFIX2_24BITX256,0 }, - { "arg+=512", F_PREFIX2_512,0 }, - { "arg+=768", F_PREFIX2_768,0 }, + { "arg+=1024", F_PREFIX2_1024,0 NULLADDR }, + { "arg+=256", F_PREFIX2_256,0 NULLADDR }, + { "arg+=256*X", F_PREFIX2_CHARX256,0 NULLADDR }, + { "arg+=256*XX", F_PREFIX2_WORDX256,0 NULLADDR }, + { "arg+=256*XXX", F_PREFIX2_24BITX256,0 NULLADDR }, + { "arg+=512", F_PREFIX2_512,0 NULLADDR }, + { "arg+=768", F_PREFIX2_768,0 NULLADDR },    - { "break", F_BREAK,0 }, - { "case", F_CASE,0 }, - { "continue", F_CONTINUE,0 }, - { "default", F_DEFAULT,0 }, - { "do-while", F_DO,0 }, - { "for", F_FOR,0 }, + { "break", F_BREAK,0 NULLADDR }, + { "case", F_CASE,0 NULLADDR }, + { "continue", F_CONTINUE,0 NULLADDR }, + { "default", F_DEFAULT,0 NULLADDR }, + { "do-while", F_DO,0 NULLADDR }, + { "for", F_FOR,0 NULLADDR },    - { "pointer", F_POINTER, I_ISPOINTER }, - { "data", F_DATA, I_DATA }, - { "byte", F_BYTE, I_DATA }, - { "lvalue_list", F_LVALUE_LIST,0 }, - { "label", F_LABEL,I_HASARG }, - { "align", F_ALIGN, I_HASARG }, - { "nop", F_NOP,0 }, - { "function start", F_START_FUNCTION,0 }, - { "notreached!", F_NOTREACHED, 0 }, + { "pointer", F_POINTER, I_ISPOINTER NULLADDR }, + { "data", F_DATA, I_DATA NULLADDR }, + { "byte", F_BYTE, I_DATA NULLADDR }, + { "lvalue_list", F_LVALUE_LIST,0 NULLADDR }, + { "label", F_LABEL,I_HASARG NULLADDR }, + { "align", F_ALIGN, I_HASARG NULLADDR }, + { "nop", F_NOP,0 NULLADDR }, + { "function start", F_START_FUNCTION,0 NULLADDR }, + { "notreached!", F_NOTREACHED, 0 NULLADDR },   };      struct instr instrs[F_MAX_INSTR - F_OFFSET];
248:       instrs[instr_names[i].token - F_OFFSET].name = instr_names[i].word;    instrs[instr_names[i].token - F_OFFSET].flags=instr_names[i].flags; + #ifdef PIKE_USE_MACHINE_CODE +  instrs[instr_names[i].token - F_OFFSET].address=instr_names[i].address; + #endif    }      #ifdef PIKE_DEBUG