Branch: Tag:

2000-04-20

2000-04-20 02:41:45 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

bye bye accumulator

Rev: bin/mkpeep.pike:1.14
Rev: src/Makefile.in:1.190
Rev: src/array.c:1.67
Rev: src/docode.c:1.68
Rev: src/docode.h:1.9
Rev: src/error.h:1.41
Rev: src/gc.c:1.75
Rev: src/interpret_functions.h:1.10
Rev: src/interpreter.h:1.42
Rev: src/language.yacc:1.180
Rev: src/lex.c:1.74
Rev: src/lex.h:1.15
Rev: src/object.c:1.117
Rev: src/opcodes.c:1.74
Rev: src/operators.c:1.91
Rev: src/peep.c:1.30
Rev: src/peep.h:1.5
Rev: src/peep.in:1.28

5:   \*/   /**/   #include "global.h" - RCSID("$Id: lex.c,v 1.73 2000/04/19 20:20:16 grubba Exp $"); + RCSID("$Id: lex.c,v 1.74 2000/04/20 02:41:45 hubbe Exp $");   #include "language.h"   #include "array.h"   #include "lex.h"
73:      #define OPCODE0(OP,DESC) { DESC, OP, 0 },   #define OPCODE1(OP,DESC) { DESC, OP, I_HASARG }, - #define OPCODE1ACC(OP,DESC) { DESC, OP, I_TWO_ARGS }, - #define OPCODE2(OP,DESC) { DESC, OP, I_HASARG }, + #define OPCODE2(OP,DESC) { DESC, OP, I_TWO_ARGS },      #define OPCODE0_TAIL(OP,DESC) { DESC, OP, 0 },   #define OPCODE1_TAIL(OP,DESC) { DESC, OP, I_HASARG }, - #define OPCODE1ACC_TAIL(OP,DESC) { DESC, OP, I_TWO_ARGS }, - #define OPCODE2_TAIL(OP,DESC) { DESC, OP, I_HASARG }, + #define OPCODE2_TAIL(OP,DESC) { DESC, OP, I_TWO_ARGS },      #define LEXER   
115:   { "arg+=256*XXX", F_PREFIX_24BITX256,0 },   { "arg+=512", F_PREFIX_512,0 },   { "arg+=768", F_PREFIX_768,0 }, - { "assign local", F_ASSIGN_LOCAL, I_HASARG }, +  + { "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 }, +    { "assign local and pop", F_ASSIGN_LOCAL_AND_POP, I_HASARG },   { "break", F_BREAK,0 },   { "case", F_CASE,0 },
130:   { "branch non zero", F_BRANCH_WHEN_NON_ZERO, I_ISJUMP },   { "branch if local", F_BRANCH_IF_LOCAL, I_HASARG },   { "branch if !local", F_BRANCH_IF_NOT_LOCAL, I_HASARG }, - { "branch if ! local->x", F_BRANCH_IF_NOT_LOCAL_ARROW, I_HASARG }, + { "branch if ! local->x", F_BRANCH_IF_NOT_LOCAL_ARROW, I_TWO_ARGS },   { "branch when zero", F_BRANCH_WHEN_ZERO, I_ISJUMP },   { "branch if <", F_BRANCH_WHEN_LT, I_ISJUMP },   { "branch if >", F_BRANCH_WHEN_GT, I_ISJUMP },
156:   { "local function call",F_CALL_LFUN, I_HASARG },   { "local function call and pop",F_CALL_LFUN_AND_POP, I_HASARG },   { "local", F_LOCAL, I_HASARG }, - { "& external", F_EXTERNAL_LVALUE, I_HASARG }, - { "LDA", F_LDA, I_HASARG }, +    { "mark & local", F_MARK_AND_LOCAL, I_HASARG },   { "lvalue_list", F_LVALUE_LIST,0 },   { "mark", F_MARK,0 },
180:   { "int index", F_POS_INT_INDEX, I_HASARG },   { "-int index", F_NEG_INT_INDEX, I_HASARG },   { "apply and pop", F_APPLY_AND_POP, I_HASARG }, - { "byte", F_BYTE, I_HASARG }, +    { "nop", F_NOP,0 },   { "add integer", F_ADD_INT, I_HASARG },   { "add -integer", F_ADD_NEG_INT, I_HASARG },   { "mark & call", F_MARK_APPLY, I_HASARG },   { "mark, call & pop", F_MARK_APPLY_POP, I_HASARG },   { "apply and return", F_APPLY_AND_RETURN, I_HASARG }, - { "apply, assign local and pop", F_APPLY_ASSIGN_LOCAL_AND_POP, I_HASARG }, - { "apply & assign local", F_APPLY_ASSIGN_LOCAL, I_HASARG }, +    { "call lfun & return", F_CALL_LFUN_AND_RETURN, I_HASARG },   { "call function", F_CALL_FUNCTION, 0 },   { "call function & return", F_CALL_FUNCTION_AND_RETURN, 0 },
205:   void init_lex()   {    unsigned int i; + #ifdef PIKE_DEBUG +  int fatal_later=0; + #endif +     for(i=0; i<NELEM(instr_names);i++)    { -  + #ifdef PIKE_DEBUG    if(instr_names[i].token >= F_MAX_INSTR) -  fatal("Error in instr_names[%u]\n\n",i); +  { +  fprintf(stderr,"Error in instr_names[%u]\n\n",i); +  fatal_later++; +  }       if(instrs[instr_names[i].token - F_OFFSET].name) -  fatal("Duplicate name for %s\n",instr_names[i].word); +  { +  fprintf(stderr,"Duplicate name for %s\n",instr_names[i].word); +  fatal_later++; +  } + #endif       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_DEBUG +  for(i=1; i<F_MAX_OPCODE-F_OFFSET;i++) +  { +  if(!instrs[i].name) +  { +  fprintf(stderr,"Opcode %d does not have a name.\n",i); +  fatal_later++;    } -  +  } +  if(fatal_later) +  fatal("Found %d errors in instrs.\n",fatal_later);    -  + #endif +  + } +    char *low_get_f_name(int n,struct program *p)   {    static char buf[30];