Branch: Tag:

1997-01-30

1997-01-30 03:51:37 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

many optimizations added (see Changelog)

Rev: src/builtin_functions.c:1.25
Rev: src/docode.c:1.10
Rev: src/interpret.c:1.23
Rev: src/language.yacc:1.21
Rev: src/las.c:1.16
Rev: src/lex.c:1.14
Rev: src/lex.h:1.3
Rev: src/peep.c:1.5
Rev: src/peep.in:1.3
Rev: src/pike_types.c:1.15
Rev: src/port.h:1.11

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: interpret.c,v 1.22 1997/01/29 01:02:03 hubbe Exp $"); + RCSID("$Id: interpret.c,v 1.23 1997/01/30 03:51:32 hubbe Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"
469:    fp->pc = pc;    instr=EXTRACT_UCHAR(pc++);    -  again: +    #ifdef DEBUG -  +  if(d_flag) +  {   #ifdef _REENTRANT    if(!mt_trylock(& interpreter_lock))    fatal("Interpreter running unlocked!\n");
490: Inside #if defined(DEBUG)
   fp->locals+fp->num_locals > sp)    fatal("Stack error (stupid!).\n");    -  if(d_flag) -  { +     if(d_flag > 9) check_threads_etc();       backlogp++;
514: Inside #if defined(DEBUG)
   if((nonblock=query_nonblocking(2)))    set_nonblocking(2,0);    +     file=get_line(pc-1,fp->context.prog,&linep);    while((f=STRCHR(file,'/'))) file=f+1;    fprintf(stderr,"- %s:%4ld:(%lx): %-25s %4ld %4ld\n",
532:       switch(instr)    { -  /* Support for large instructions */ -  CASE(F_ADD_256); instr=EXTRACT_UCHAR(pc++)+256; goto again; -  CASE(F_ADD_512); instr=EXTRACT_UCHAR(pc++)+512; goto again; -  CASE(F_ADD_768); instr=EXTRACT_UCHAR(pc++)+768; goto again; -  CASE(F_ADD_1024);instr=EXTRACT_UCHAR(pc++)+1024;goto again; -  CASE(F_ADD_256X); instr=EXTRACT_UWORD(pc); pc+=sizeof(INT16); goto again; -  +     /* Support to allow large arguments */    CASE(F_PREFIX_256); prefix+=256; break;    CASE(F_PREFIX_512); prefix+=512; break;
605:    print_return_value();    break;    +  CASE(F_MARK_AND_LOCAL); *(mark_sp++)=sp;    CASE(F_LOCAL);    assign_svalue_no_free(sp++,fp->locals+GET_ARG());    print_return_value();    break;    -  +  CASE(F_2_LOCALS); +  assign_svalue_no_free(sp++,fp->locals+GET_ARG()); +  print_return_value(); +  assign_svalue_no_free(sp++,fp->locals+GET_ARG()); +  print_return_value(); +  break; +  +     CASE(F_LOCAL_LVALUE);    sp[0].type=T_LVALUE;    sp[0].u.lval=fp->locals+GET_ARG();
617:    sp+=2;    break;    +  CASE(F_CLEAR_2_LOCAL); +  instr=GET_ARG(); +  free_svalues(fp->locals + instr, 2, -1); +  fp->locals[instr].type=T_INT; +  fp->locals[instr].subtype=0; +  fp->locals[instr].u.integer=0; +  fp->locals[instr+1].type=T_INT; +  fp->locals[instr+1].subtype=0; +  fp->locals[instr+1].u.integer=0; +  break; +     CASE(F_CLEAR_LOCAL);    instr=GET_ARG();    free_svalue(fp->locals + instr);
1012:       CASE(F_LOCAL_INDEX);    assign_svalue_no_free(sp++,fp->locals+GET_ARG()); +  if(sp[-1].type == T_STRING) +  sp[-1].subtype=0;    print_return_value();    goto do_index;   
1084:    pop_stack();    break;    +  CASE(F_APPLY); +  strict_apply_svalue(fp->context.prog->constants + GET_ARG(), sp - *--mark_sp ); +  break; +  +  CASE(F_APPLY_AND_POP); +  strict_apply_svalue(fp->context.prog->constants + GET_ARG(), sp - *--mark_sp ); +  pop_stack(); +  break; +     default: -  instr -= F_MAX_OPCODE - F_OFFSET; - #ifdef DEBUG -  if(instr >= fp->context.prog->num_constants) -  { -  instr += F_MAX_OPCODE - F_OFFSET; +     fatal("Strange instruction %ld\n",(long)instr);    } - #endif -  strict_apply_svalue(fp->context.prog->constants + instr, sp - *--mark_sp ); +     }   } - } +       /* Put catch outside of eval_instruction, so    * the setjmp won't affect the optimization of