Branch: Tag:

2000-05-01

2000-05-01 02:11:25 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

all recursive functions now optimized.. (no real need for 'local' or
'inline' in those cases anymore)

Rev: src/docode.c:1.71
Rev: src/interpret_functions.h:1.19
Rev: src/language.yacc:1.182
Rev: src/las.c:1.176
Rev: src/las.h:1.36
Rev: src/lex.c:1.79
Rev: src/peep.c:1.32
Rev: src/peep.in:1.35
Rev: src/program.c:1.235

1:   /* -  * $Id: interpret_functions.h,v 1.18 2000/04/30 23:15:16 hubbe Exp $ +  * $Id: interpret_functions.h,v 1.19 2000/05/01 02:11:25 hubbe Exp $    *    * Opcode definitions for the interpreter.    */
1429:    o_sscanf(arg1);   BREAK;    -  CASE(F_CALL_LFUN); + OPCODE1(F_CALL_LFUN,"call lfun")    apply_low(Pike_fp->current_object, -  GET_ARG()+Pike_fp->context.identifier_level, +  arg1+Pike_fp->context.identifier_level,    Pike_sp - *--Pike_mark_sp); -  break; + BREAK;    -  CASE(F_CALL_LFUN_AND_POP); + OPCODE1(F_CALL_LFUN_AND_POP,"call lfun & pop")    apply_low(Pike_fp->current_object, -  GET_ARG()+Pike_fp->context.identifier_level, +  arg1+Pike_fp->context.identifier_level,    Pike_sp - *--Pike_mark_sp);    pop_stack(); -  break; + BREAK;    -  CASE(F_MARK_APPLY); -  strict_apply_svalue(Pike_fp->context.prog->constants + GET_ARG(), 0); -  break; + OPCODE1(F_MARK_APPLY,"mark apply") +  strict_apply_svalue(Pike_fp->context.prog->constants + arg1, 0); + BREAK;    -  CASE(F_MARK_APPLY_POP); -  strict_apply_svalue(Pike_fp->context.prog->constants + GET_ARG(), 0); + OPCODE1(F_MARK_APPLY_POP,"mark, apply & pop") +  strict_apply_svalue(Pike_fp->context.prog->constants + arg1, 0);    pop_stack(); -  break; + BREAK;       CASE(F_APPLY);    strict_apply_svalue(Pike_fp->context.prog->constants + GET_ARG(), Pike_sp - *--Pike_mark_sp );
1503:    save_mark_sp=mark_sp;       addr=pc+EXTRACT_INT(pc); -  num_locals=EXTRACT_UCHAR(addr-1); +  num_locals=EXTRACT_UCHAR(addr-2);      #ifdef PIKE_DEBUG -  if(args != EXTRACT_UCHAR(addr-2)) -  fatal("Wrong number of arguments in F_RECUR %d!=%d\n",args,EXTRACT_UCHAR(addr-2)); +  if(args != EXTRACT_UCHAR(addr-1)) +  fatal("Wrong number of arguments in F_RECUR %d!=%d\n",args,EXTRACT_UCHAR(addr-1));   #endif       clear_svalues(sp, num_locals - args);
1533:   BREAK      /* Assume that the number of arguments is correct */ + OPCODE1_JUMP(F_COND_RECUR,"recur if not overloaded") + { +  int x,num_locals,args; +  char *addr; +  +  struct svalue *expendible=fp->expendible; +  struct svalue *locals=fp->locals; +  struct svalue *save_sp, **save_mark_sp; +  +  if(fp->current_object->prog != fp->context.prog) +  { +  apply_low(Pike_fp->current_object, +  arg1+Pike_fp->context.identifier_level, +  Pike_sp - *--Pike_mark_sp); +  }else{ +  fast_check_threads_etc(6); +  check_c_stack(8192); +  check_stack(256); +  +  save_sp=fp->expendible=fp->locals=*--Pike_mark_sp; +  args=sp-fp->locals; +  save_mark_sp=mark_sp; +  +  addr=pc+EXTRACT_INT(pc); +  num_locals=EXTRACT_UCHAR(addr-2); +  + #ifdef PIKE_DEBUG +  if(args != EXTRACT_UCHAR(addr-1)) +  fatal("Wrong number of arguments in F_RECUR %d!=%d\n",args,EXTRACT_UCHAR(addr-1)); + #endif +  +  clear_svalues(sp, num_locals - args); +  sp += num_locals - args; +  +  x=eval_instruction(addr); +  mark_sp=save_mark_sp; +  if(x!=-1) mega_apply(APPLY_STACK, x, 0,0); +  pc+=sizeof(INT32); +  if(save_sp+1 < sp) +  { +  assign_svalue(save_sp,sp-1); +  pop_n_elems(sp-save_sp-1); +  } +  fp->expendible=expendible; +  fp->locals=locals; +  print_return_value(); + #ifdef PIKE_DEBUG +  if(sp != save_sp+1) +  fatal("Stack whack in F_RECUR sp=%p, expected=%p\n",sp,save_sp+1); + #endif +  } + } + BREAK +  + /* Assume that the number of arguments is correct */   OPCODE0_JUMP(F_TAIL_RECUR,"tail recursion")   {    int x,num_locals;
1542:    fast_check_threads_etc(6);       addr=pc+EXTRACT_INT(pc); -  num_locals=EXTRACT_UCHAR(addr-1); +  num_locals=EXTRACT_UCHAR(addr-2);         #ifdef PIKE_DEBUG -  if(args != EXTRACT_UCHAR(addr-2)) -  fatal("Wrong number of arguments in F_TAIL_RECUR %d != %d\n",args,EXTRACT_UCHAR(addr-2)); +  if(args != EXTRACT_UCHAR(addr-1)) +  fatal("Wrong number of arguments in F_TAIL_RECUR %d != %d\n",args,EXTRACT_UCHAR(addr-1));   #endif       if(sp-args != fp->locals)