Branch: Tag:

1999-09-18

1999-09-18 09:21:30 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

name tracking for constants underway (not yet finished)

Rev: src/docode.c:1.51
Rev: src/interpreter.h:1.13
Rev: src/language.yacc:1.123
Rev: src/las.c:1.88
Rev: src/lex.c:1.66
Rev: src/object.c:1.82
Rev: src/object.h:1.29
Rev: src/pike_types.h:1.21
Rev: src/program.c:1.151
Rev: src/program.h:1.59
Rev: src/program_areas.h:1.6
Rev: src/testsuite.in:1.197

5:   \*/   /**/   #include "global.h" - RCSID("$Id: program.c,v 1.150 1999/09/16 20:30:34 hubbe Exp $"); + RCSID("$Id: program.c,v 1.151 1999/09/18 09:21:26 hubbe Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
687:    }       if(p->constants) -  free_svalues(p->constants, p->num_constants, BIT_MIXED); +  for(e=0;e<p->num_constants;e++) +  free_svalue(& p->constants[e].sval);       if(p->inherits)    for(e=0; e<p->num_inherits; e++)
863: Inside #if defined(PIKE_DEBUG)
   fatal("Too many identifier index entries in program!\n");       for(e=0;e<(int)p->num_constants;e++) -  check_svalue(p->constants + e); +  { +  check_svalue(& p->constants[e].sval); +  if(p->constants[e].name) check_string(p->constants[e].name); +  }       for(e=0;e<(int)p->num_strings;e++)    check_string(p->strings[e]);
1102: Inside #if defined(PIKE_DEBUG)
   fatal("add_storage failed horribly!\n");       if( (offset + OFFSETOF(object,storage) - modulo_orig ) % alignment ) -  fatal("add_storage failed horribly(2) %d %d %d %d!\n", -  offset, -  OFFSETOF(object,storage), -  modulo_orig, -  alignment +  fatal("add_storage failed horribly(2) %ld %ld %ld %ld!\n", +  (long)offset, +  (long)OFFSETOF(object,storage), +  (long)modulo_orig, +  (long)alignment    );      #endif
1508:       if(IDENTIFIER_IS_CONSTANT(i->identifier_flags))    { -  struct svalue *s=PROG_FROM_INT(p, numid)->constants + i->func.offset; +  struct svalue *s=&PROG_FROM_INT(p, numid)-> +  constants[i->func.offset].sval;    if(s->type != T_PROGRAM)    {    do_inherit(s,flags,name);
1760: Inside #if 1
   if(id->func.offset>=0)    {    struct pike_string *s; -  struct svalue *c=PROG_FROM_INT(new_program,n)->constants+ -  id->func.offset; +  struct svalue *c=&PROG_FROM_INT(new_program,n)-> +  constants[id->func.offset].sval;    s=get_type_of_svalue(c);    free_string(id->type);    id->type=s;
1785:    dummy.identifier_flags = IDENTIFIER_CONSTANT;    dummy.run_time_type=c->type;    -  dummy.func.offset=store_constant(c, 0); +  dummy.func.offset=store_constant(c, 0, 0);       ref.id_flags=flags;    ref.identifier_offset=new_program->num_identifiers;
2255:    return i;   }    - int store_constant(struct svalue *foo, int equal) + int store_constant(struct svalue *foo, +  int equal, +  struct pike_string *constant_name)   { -  struct svalue tmp; +  struct program_constant tmp;    unsigned int e;       for(e=0;e<new_program->num_constants;e++)    { -  struct svalue *s=new_program->constants + e; -  if(equal ? is_equal(s,foo) : is_eq(s,foo)) +  struct program_constant *c= new_program->constants+e; +  if((equal ? is_equal(& c->sval,foo) : is_eq(& c->sval,foo)) && +  c->name == constant_name)    return e;    }    -  assign_svalue_no_free(&tmp,foo); +  assign_svalue_no_free(&tmp.sval,foo); +  if((tmp.name=constant_name)) add_ref(constant_name); +     add_to_constants(tmp);    return e;   }
2312:    id = ID_FROM_INT(p, e);    if (IDENTIFIER_IS_CONSTANT(id->identifier_flags)) {    struct program *p2 = PROG_FROM_INT(p, e); -  push_svalue(p2->constants + id->func.offset); +  push_svalue( & p2->constants[id->func.offset].sval);    n++;    }    }
2354:   #endif    if (IDENTIFIER_IS_CONSTANT(id->identifier_flags)) {    struct program *p2 = PROG_FROM_INT(p, e); -  assign_svalue_no_free(to, (p2->constants + id->func.offset)); +  assign_svalue_no_free(to, ( & p2->constants[id->func.offset].sval));    return;    } else {    if (s->len < 1024) {
2853: Inside #if defined(GC2)
   if(gc_mark(p))    {    int e; -  gc_mark_svalues(p->constants, p->num_constants); +  for(e=0;e<p->num_constants;e++) +  gc_mark_svalues(& p->constants[e].sval, 1);       for(e=0;e<p->num_inherits;e++)    {
2873: Inside #if defined(GC2)
   for(p=first_program;p;p=p->next)    {    int e; -  debug_gc_check_svalues(p->constants, p->num_constants, T_PROGRAM, p); +  for(e=0;e<p->num_constants;e++) +  debug_gc_check_svalues(& p->constants[e].sval, 1, T_PROGRAM, p);       for(e=0;e<p->num_inherits;e++)    {
2931:    {    int e;    add_ref(p); -  free_svalues(p->constants, p->num_constants, -1); +  for(e=0;e<p->num_constants;e++) +  free_svalue(& p->constants[e].sval); +     for(e=0;e<p->num_inherits;e++)    {    if(p->inherits[e].parent)
3068:    struct identifier *id=ID_FROM_INT(p, i);    if(!IDENTIFIER_IS_CONSTANT(id->identifier_flags)) return 0;    if(id->func.offset==-1) return 0; -  f=PROG_FROM_INT(p,i)->constants + id->func.offset; +  f=& PROG_FROM_INT(p,i)->constants[id->func.offset].sval;    if(f->type!=T_PROGRAM) return 0;    return f->u.program;   }