pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: docode.c,v 1.68 2000/04/20 02:41:44 hubbe Exp $"); + RCSID("$Id: docode.c,v 1.69 2000/04/25 09:32:45 hubbe Exp $");   #include "las.h"   #include "program.h"   #include "language.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"   #include "pike_macros.h"   #include "error.h"
pike.git/src/docode.c:193:    }   }      static inline struct compiler_frame *find_local_frame(INT32 depth)   {    struct compiler_frame *f=compiler_frame;    while(--depth>=0) f=f->previous;    return f;   }    + int do_lfun_call(int id,node *args) + { + #if 1 +  if(id == compiler_frame->current_function_number) +  { +  if(new_program->identifier_references[id].id_flags & ID_INLINE) +  { +  int n=count_args(args); +  if(n == count_arguments(ID_FROM_INT(new_program, id) -> type)) +  { +  emit0(F_MARK); +  do_docode(args,0); +  emit1(F_RECUR,0); /* 0 is label at beginning of function */ +  return 1; +  } +  } +  } + #endif +  emit0(F_MARK); +  do_docode(args,0); +  emit1(F_CALL_LFUN, id); +  return 1; + } +    static int do_docode2(node *n,int flags)   {    INT32 tmp1,tmp2,tmp3;       if(!n) return 0;       if(flags & DO_LVALUE)    {    switch(n->token)    {
pike.git/src/docode.c:736:    !(CAR(n)->tree_info & OPT_EXTERNAL_DEPEND),    CAR(n)->name);    emit1(F_APPLY,tmp1);    }    if(n->type == void_type_string)    return 0;       return 1;    }else{    if(CAR(n)->u.sval.u.object == fake_object) -  { -  emit0(F_MARK); -  do_docode(CDR(n),0); -  emit1(F_CALL_LFUN, CAR(n)->u.sval.subtype); -  return 1; +  return do_lfun_call(CAR(n)->u.sval.subtype,CDR(n));    }    } -  } +        emit0(F_MARK);    do_docode(CDR(n),0);    tmp1=store_constant(& CAR(n)->u.sval,    !(CAR(n)->tree_info & OPT_EXTERNAL_DEPEND),    CAR(n)->name);    emit1(F_APPLY,tmp1);       return 1;    }    else if(CAR(n)->token == F_IDENTIFIER && -  IDENTIFIER_IS_FUNCTION(ID_FROM_INT(new_program, CAR(n)->u.id.number)->identifier_flags)) +  IDENTIFIER_IS_FUNCTION(ID_FROM_INT(new_program, +  CAR(n)->u.id.number)->identifier_flags))    { -  emit0(F_MARK); -  do_docode(CDR(n),0); -  emit1(F_CALL_LFUN, CAR(n)->u.id.number); -  return 1; +  return do_lfun_call(CAR(n)->u.id.number,CDR(n));    }    else    {    struct pike_string *tmp;    struct efun *fun;    node *foo;       emit0(F_MARK);    do_docode(CAR(n),0);    do_docode(CDR(n),0);
pike.git/src/docode.c:1270:       default:    fatal("Infernal compiler error (unknown parse-tree-token).\n");    return 0; /* make gcc happy */    }   }      void do_code_block(node *n)   {    init_bytecode(); -  label_no=0; +  label_no=1; +  emit1(F_LABEL,0);    DO_CODE_BLOCK(n);    assemble();   }      int docode(node *n)   {    int tmp;    int label_no_save = label_no;    dynamic_buffer instrbuf_save = instrbuf;       instrbuf.s.str=0; -  label_no=0; +  label_no=1;    init_bytecode();       tmp=do_docode(n,0);    assemble();       instrbuf=instrbuf_save;    label_no = label_no_save;    return tmp;   }