Branch: Tag:

2004-05-29

2004-05-29 18:13:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Removed the field "name" from struct program_constant since it was only used for debug (the real constant name is in the corresponding struct identifier).
Replaced it with an offset to be used to locate the initialization function.

Rev: src/encode.c:1.216
Rev: src/gc.c:1.255
Rev: src/las.c:1.346
Rev: src/program.c:1.564
Rev: src/program.h:1.205

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: encode.c,v 1.215 2004/05/19 09:19:13 grubba Exp $ + || $Id: encode.c,v 1.216 2004/05/29 18:13:41 grubba Exp $   */      #include "global.h"
31:   #include "opcodes.h"   #include "peep.h"    - RCSID("$Id: encode.c,v 1.215 2004/05/19 09:19:13 grubba Exp $"); + RCSID("$Id: encode.c,v 1.216 2004/05/29 18:13:41 grubba Exp $");      /* #define ENCODE_DEBUG */   
1136:    for(d=0;d<p->num_constants;d++)    {    encode_value2(& p->constants[d].sval, data, 0); -  adddata3(p->constants[d].name); +  adddata3(NULL /* p->constants[d].name */);    }      #else /* !OLD_PIKE_ENCODE_PROGRAM */
1262: Inside #if defined(PIKE_PORTABLE_BYTECODE)
   encode_value2(&p->constants[d].sval, data, 0);       /* name */ + #if 0    if (p->constants[d].name) {    str_sval.u.string = p->constants[d].name;    encode_value2(&str_sval, data, 0);    } else { -  + #endif /* 0 */    push_int(0);    encode_value2(Pike_sp-1, data, 0);    dmalloc_touch_svalue(Pike_sp-1);    Pike_sp--; -  + #if 0    } -  + #endif /* 0 */    }    }   #endif /* PIKE_PORTABLE_BYTECODE */
1578:    encode_value2(&p->constants[d].sval, data, 0);       /* name */ + #if 0    if (p->constants[d].name) {    str_sval.u.string = p->constants[d].name;    encode_value2(&str_sval, data, 0);    } else { -  + #endif /* 0 */    push_int(0);    encode_value2(Pike_sp-1, data, 0);    dmalloc_touch_svalue(Pike_sp-1);    Pike_sp--; -  + #if 0    } -  + #endif /* 0 */    }    }   #endif /* OLD_PIKE_ENCODE_PROGRAM */
3131:    p->constants[d].sval=*--Pike_sp;    }    dmalloc_touch_svalue(Pike_sp); -  getdata3(p->constants[d].name); +  { +  struct pike_string *dummy = NULL; +  getdata3(dummy /*p->constants[d].name*/); +  if (dummy) free_string(dummy);    } -  +  }      #ifdef PIKE_DEBUG    {
3561:    */    {    struct program_constant constant; -  constant.name = NULL; +     constant.sval.type = T_INT;    constant.sval.subtype = NUMBER_UNDEFINED;    constant.sval.u.integer = 0; -  +  constant.offset = -1;       for(e=0;e<local_num_constants;e++) {    add_to_constants(constant);
3619:    }    /* name */    decode_value2(data); + #if 0    if (Pike_sp[-1].type == T_STRING) {    constant->name = Pike_sp[-1].u.string;    } else if ((Pike_sp[-1].type == T_INT) &&
3633:    dmalloc_touch_svalue(Pike_sp-1);    dmalloc_touch_svalue(Pike_sp-2);    Pike_sp -= 2; + #else /* !0 */ +  constant->offset = -1; +  pop_stack(); +  constant->sval = Pike_sp[-1]; +  dmalloc_touch_svalue(Pike_sp-1); +  Pike_sp -= 1; + #endif /* 0 */    decode_number(entry_type, data);    }    while (entry_type != ID_ENTRY_EOT) {
4070:    decode_value2(data);    /* name */    decode_value2(data); + #if 0    if (Pike_sp[-1].type == T_STRING) {    constant->name = Pike_sp[-1].u.string;    } else if ((Pike_sp[-1].type == T_INT) &&
4084:    dmalloc_touch_svalue(Pike_sp-1);    dmalloc_touch_svalue(Pike_sp-2);    Pike_sp -= 2; + #else /* !0 */ +  constant->offset = -1; +  pop_stack(); +  constant->sval = Pike_sp[-1]; +  dmalloc_touch_svalue(Pike_sp-1); +  Pike_sp -= 1; + #endif /* 0 */    EDB(5,    fprintf(stderr, "%*sDecoded constant %d to a %s\n",    data->depth, "",