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.107 2001/02/24 02:38:31 hubbe Exp $"); + RCSID("$Id: docode.c,v 1.108 2001/02/25 17:40:19 hubbe Exp $");   #include "las.h"   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "pike_memory.h"   #include "svalue.h"   #include "main.h"   #include "builtin_functions.h"   #include "peep.h"   #include "docode.h"   #include "operators.h"   #include "object.h"   #include "opcodes.h"   #include "language.h"   #include "lex.h" -  + #include "mapping.h" + #include "multiset.h"      static int do_docode2(node *n, INT16 flags);      typedef void (*cleanup_func)(void *);      struct cleanup_frame   {    struct cleanup_frame *prev;    cleanup_func cleanup;    void *cleanup_arg;
pike.git/src/docode.c:801:    case F_RSH:    case F_XOR:    case F_OR:    case F_AND:    case F_NOT:    case F_COMPL:    case F_NEGATE:    fatal("Optimizer error.\n");       case F_RANGE: -  tmp1=do_docode(CAR(n),DO_NOT_COPY); +  tmp1=do_docode(CAR(n),DO_NOT_COPY_TOPLEVEL);    if(do_docode(CDR(n),DO_NOT_COPY)!=2)    fatal("Compiler internal error (at %ld).\n",(long)lex.current_line);    emit0(n->token);    return DO_NOT_WARN((INT32)tmp1);       case F_INC:    case F_POST_INC:    tmp1=do_docode(CAR(n),DO_LVALUE);   #ifdef PIKE_DEBUG    if(tmp1 != 2)
pike.git/src/docode.c:882:    case F_FOREACH:    {    node *arr;    INT32 *prev_switch_jumptable = current_switch_jumptable;    arr=CAR(n);       if(CDR(arr) && CDR(arr)->token == ':')    {    BLOCK_BEGIN;    /* New-style */ -  tmp1=do_docode(CAR(arr), DO_NOT_COPY); +  tmp1=do_docode(CAR(arr), DO_NOT_COPY_TOPLEVEL);    emit0(F_MAKE_ITERATOR);       if(CADR(arr))    {    do_docode(CADR(arr), DO_LVALUE);    }else{    emit0(F_CONST0);    emit0(F_CONST0);    current_stack_depth+=2;    }
pike.git/src/docode.c:937:       if(CAR(arr) && CAR(arr)->token==F_RANGE)    {    node **a1=my_get_arg(&_CAR(arr),0);    node **a2=my_get_arg(&_CAR(arr),1);    if(a1 && a2 && a2[0]->token==F_CONSTANT &&    a2[0]->u.sval.type==T_INT &&    a2[0]->u.sval.type==0x7fffffff &&    a1[0]->type == int_type_string)    { -  do_docode(CAR(arr),DO_NOT_COPY); +  do_docode(CAR(arr),DO_NOT_COPY_TOPLEVEL);    do_docode(*a1,DO_NOT_COPY);    goto foreach_arg_pushed;    }    }    do_docode(CAR(n),DO_NOT_COPY);    emit0(F_CONST0);    current_stack_depth++;    foreach_arg_pushed:    PUSH_CLEANUP_FRAME(do_pop, 4);   
pike.git/src/docode.c:1685:    case T_ARRAY:    case T_MAPPING:    case T_MULTISET:    tmp1=store_constant(&(n->u.sval),    !(n->tree_info & OPT_EXTERNAL_DEPEND),    n->name);    emit1(F_CONSTANT, DO_NOT_WARN((INT32)tmp1));       /* copy now or later ? */    if(!(flags & DO_NOT_COPY) && !(n->tree_info & OPT_EXTERNAL_DEPEND)) +  { +  if(flags & DO_NOT_COPY_TOPLEVEL) +  { +  switch(n->u.sval.type) +  { +  case T_ARRAY: +  array_fix_type_field(n->u.sval.u.array); +  if(n->u.sval.u.array -> type_field & BIT_COMPLEX)    emit0(F_COPY_VALUE); -  +  break; +  +  case T_MAPPING: +  mapping_fix_type_field(n->u.sval.u.mapping); +  if((n->u.sval.u.mapping->data->ind_types | +  n->u.sval.u.mapping->data->val_types) & BIT_COMPLEX) +  emit0(F_COPY_VALUE); +  break; +  +  case T_MULTISET: +  array_fix_type_field(n->u.sval.u.multiset->ind); +  if(n->u.sval.u.multiset->ind-> type_field & BIT_COMPLEX) +  emit0(F_COPY_VALUE); +  break; +  } +  }else{ +  emit0(F_COPY_VALUE); +  } +  }    return 1;       }       case F_LOCAL:    if(n->u.integer.a >=    find_local_frame(n->u.integer.b)->max_number_of_locals)    yyerror("Illegal to use local variable here.");       if(n->u.integer.b)