Branch: Tag:

2001-02-25

2001-02-25 18:06:55 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

bugfix for constants

Rev: src/docode.c:1.68
Rev: src/docode.h:1.9
Rev: src/operators.c:1.91
Rev: src/testsuite.in:1.300

5:   \*/   /**/   #include "global.h" - RCSID("$Id: docode.c,v 1.67 2000/03/30 08:43:07 hubbe Exp $"); + RCSID("$Id: docode.c,v 1.68 2001/02/25 18:06:54 hubbe Exp $");   #include "las.h"   #include "program.h"   #include "language.h"
25:   #include "docode.h"   #include "operators.h"   #include "object.h" + #include "mapping.h" + #include "multiset.h"      static int do_docode2(node *n,int flags);   
71:    }   }    - #define DO_CODE_BLOCK(X) do_pop(do_docode((X),DO_NOT_COPY | DO_POP | DO_DEFER_POP)) + #define DO_CODE_BLOCK(X) do_pop(do_docode((X),DO_NOT_COPY | DO_POP))      int do_docode(node *n,INT16 flags)   {
490:    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);    emit2(n->token);
583:    a2[0]->u.sval.type==0x7fffffff &&    a1[0]->type == int_type_string)    { -  tmp2=do_docode(CAR(arr),DO_NOT_COPY); +  tmp2=do_docode(CAR(arr),DO_NOT_COPY_TOPLEVEL);    do_docode(*a1,DO_NOT_COPY);    goto foreach_arg_pushed;    }
1211:       /* 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)    emit2(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) +  emit2(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) +  emit2(F_COPY_VALUE); +  break; +  } +  }else{ +  emit2(F_COPY_VALUE); +  } +  } +     return 1;       }