Branch: Tag:

1997-03-11

1997-03-11 03:36:42 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

fixed constants and code generator, F_EQ_OR now works

Rev: src/ChangeLog:1.85
Rev: src/docode.c:1.14
Rev: src/interpret.c:1.31
Rev: src/interpret.h:1.11
Rev: src/language.yacc:1.30
Rev: src/lex.c:1.18
Rev: src/lex.h:1.4
Rev: src/peep.c:1.8
Rev: src/peep.in:1.6
Rev: src/program.c:1.26
Rev: src/testsuite.in:1.35

24:      dynamic_buffer instrbuf;    - static int hasarg(int opcode) { return instrs[opcode-F_OFFSET].hasarg; } + static int hasarg(int opcode) + { +  return instrs[opcode-F_OFFSET].flags & I_HASARG; + }      void init_bytecode()   {
138:    ins_byte(b, A_PROGRAM);   }    - #define BRANCH_CASES \ -  F_BRANCH_WHEN_EQ: \ -  case F_BRANCH_WHEN_NE: \ -  case F_BRANCH_WHEN_LT: \ -  case F_BRANCH_WHEN_LE: \ -  case F_BRANCH_WHEN_GT: \ -  case F_BRANCH_WHEN_GE: \ -  case F_BRANCH_WHEN_ZERO: \ -  case F_BRANCH_WHEN_NON_ZERO: \ -  case F_BRANCH: \ -  case F_INC_LOOP: \ -  case F_DEC_LOOP: \ -  case F_INC_NEQ_LOOP: \ -  case F_DEC_NEQ_LOOP: \ -  case F_LAND: \ -  case F_LOR: \ -  case F_EQ_OR: \ -  case F_CATCH: \ -  case F_FOREACH -  -  +    void assemble(void)   {    INT32 e,d,length,max_label,tmp;
193:       for(e=0;e<length;e++)    { -  switch(c[e].opcode) +  if(instrs[c[e].opcode-F_OFFSET].flags & I_POINTER)    { -  case BRANCH_CASES: -  case F_POINTER: +     while(1)    {    int tmp,tmp2;
282:    labels[c->arg]=PC;    break;    -  case BRANCH_CASES: +  default: +  switch(instrs[c->opcode - F_OFFSET].flags) +  { +  case I_ISJUMP:    ins_f_byte(c->opcode); -  -  case F_POINTER: +  case I_ISPOINTER:   #ifdef DEBUG    if(c->arg > max_label || c->arg < 0) fatal("Jump to unknown label?\n");   #endif
294:    jumps[c->arg]=tmp;    break;    -  default: -  if(hasarg(c->opcode)) +  case I_HASARG:    ins_f_byte_with_arg(c->opcode, c->arg); -  else +  break; +  +  case 0:    ins_f_byte(c->opcode);    break; -  +  + #ifdef DEBUG +  default: +  fatal("Unknown instruction type.\n"); + #endif    } -  +  }       c++;    }