diff --git a/src/encode.c b/src/encode.c index 09ec882daaa625d0d5ee9334b371cd6dc1cf2787..401d16ee139882c56c2b11ac19a74d5b53b1d4f6 100644 --- a/src/encode.c +++ b/src/encode.c @@ -2,7 +2,7 @@ || 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,7 +31,7 @@ #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,7 +1136,7 @@ static void encode_value2(struct svalue *val, struct encode_data *data, int forc 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,15 +1262,19 @@ static void encode_value2(struct svalue *val, struct encode_data *data, int forc 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,15 +1582,19 @@ static void encode_value2(struct svalue *val, struct encode_data *data, int forc 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,7 +3139,11 @@ static void decode_value2(struct decode_data *data) 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,10 +3573,10 @@ static void decode_value2(struct decode_data *data) */ { 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,6 +3631,7 @@ static void decode_value2(struct decode_data *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) && @@ -3633,6 +3646,13 @@ static void decode_value2(struct decode_data *data) 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,6 +4090,7 @@ static void decode_value2(struct decode_data *data) 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,6 +4105,13 @@ static void decode_value2(struct decode_data *data) 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, "", diff --git a/src/gc.c b/src/gc.c index ee64a8ce08b0be438b2e0356f1eb7286062292b1..1df59955ac0563e59d963a9c48eed667d5158e73 100644 --- a/src/gc.c +++ b/src/gc.c @@ -2,7 +2,7 @@ || 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: gc.c,v 1.254 2004/05/23 00:44:34 nilsson Exp $ +|| $Id: gc.c,v 1.255 2004/05/29 18:13:41 grubba Exp $ */ #include "global.h" @@ -33,7 +33,7 @@ struct callback *gc_evaluator_callback=0; #include "block_alloc.h" -RCSID("$Id: gc.c,v 1.254 2004/05/23 00:44:34 nilsson Exp $"); +RCSID("$Id: gc.c,v 1.255 2004/05/29 18:13:41 grubba Exp $"); int gc_enabled = 1; @@ -440,8 +440,13 @@ void describe_location(void *real_memblock, { e = ((char *)ptr - (char *)(p->constants)) / sizeof(struct program_constant); +#if 0 fprintf(stderr,"%*s **In p->constants[%"PRINTPTRDIFFT"d] (%s)\n",indent,"", e, p->constants[e].name ? p->constants[e].name->str : "no name"); +#else /* !0 */ + fprintf(stderr,"%*s **In p->constants[%"PRINTPTRDIFFT"d] (%d)\n",indent,"", + e, p->constants[e].offset); +#endif /* 0 */ break; } diff --git a/src/las.c b/src/las.c index 2357747db09f81449c98e52121043ce4388b2528..a2b22d835eb4b70a1f4e363399d9b0b8d9026766 100644 --- a/src/las.c +++ b/src/las.c @@ -2,13 +2,12 @@ || 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: las.c,v 1.345 2004/03/16 13:42:30 grubba Exp $ +|| $Id: las.c,v 1.346 2004/05/29 18:13:41 grubba Exp $ */ #include "global.h" -RCSID("$Id: las.c,v 1.345 2004/03/16 13:42:30 grubba Exp $"); +RCSID("$Id: las.c,v 1.346 2004/05/29 18:13:41 grubba Exp $"); -#include "language.h" #include "interpret.h" #include "las.h" #include "array.h" @@ -5470,10 +5469,12 @@ ptrdiff_t eval_low(node *n,int print_error) p_const = prog->constants + prog->num_constants; free_svalue(&p_const->sval); +#if 0 if (p_const->name) { free_string(p_const->name); p_const->name = NULL; } +#endif /* 0 */ } #ifdef PIKE_USE_MACHINE_CODE diff --git a/src/program.c b/src/program.c index e5967e378abac6c766dfd62dab5694fc4d9cf365..0899901af6d767ff21c03fac8605d6e670e1df94 100644 --- a/src/program.c +++ b/src/program.c @@ -2,18 +2,17 @@ || 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: program.c,v 1.563 2004/04/18 02:16:06 mast Exp $ +|| $Id: program.c,v 1.564 2004/05/29 18:13:41 grubba Exp $ */ #include "global.h" -RCSID("$Id: program.c,v 1.563 2004/04/18 02:16:06 mast Exp $"); +RCSID("$Id: program.c,v 1.564 2004/05/29 18:13:41 grubba Exp $"); #include "program.h" #include "object.h" #include "dynamic_buffer.h" #include "pike_types.h" #include "stralloc.h" #include "las.h" -#include "language.h" #include "lex.h" #include "pike_macros.h" #include "fsort.h" @@ -2380,7 +2379,9 @@ static void exit_program_struct(struct program *p) for(e=0;e<p->num_constants;e++) { free_svalue(& p->constants[e].sval); +#if 0 if(p->constants[e].name) free_string(p->constants[e].name); +#endif /* 0 */ } } @@ -2673,10 +2674,17 @@ void dump_program_tables (struct program *p, int indent) indent, "", indent, ""); for (d = 0; d < p->num_constants; d++) { struct program_constant *c = p->constants + d; +#if 0 fprintf(stderr, "%*s %4d: %-15s %s%s%s\n", indent, "", d, get_name_of_type (c->sval.type), c->name?"\"":"",c->name?c->name->str:"NULL",c->name?"\"":""); +#else /* !0 */ + fprintf(stderr, "%*s %4d: %-15s %d\n", + indent, "", + d, get_name_of_type (c->sval.type), + c->offset); +#endif /* 0 */ } fprintf(stderr, "\n" @@ -2756,7 +2764,14 @@ void check_program(struct program *p) if (p->flags & PROGRAM_FINISHED && s->type == T_OBJECT && s->u.object->next == s->u.object) Pike_fatal ("Got fake object in constant in finished program.\n"); +#if 0 if(p->constants[e].name) check_string(p->constants[e].name); +#else /* ! 0 */ + if (p->constants[e].offset >= p->num_identifiers) { + Pike_fatal("Constant initializer outside num_identifiers (%d >= %d).\n", + p->constants[e].offset, p->num_identifiers); + } +#endif /* 0 */ } for(e=0;e<p->num_strings;e++) @@ -5206,8 +5221,7 @@ int store_constant(struct svalue *foo, } else { struct program_constant *c= Pike_compiler->new_program->constants+e; - if(c->name == constant_name && - (equal ? is_equal(& c->sval,foo) : is_eq(& c->sval,foo))) + if((equal ? is_equal(& c->sval,foo) : is_eq(& c->sval,foo))) { UNSETJMP(jmp); return e; @@ -5216,7 +5230,11 @@ int store_constant(struct svalue *foo, UNSETJMP(jmp); } assign_svalue_no_free(&tmp.sval,foo); +#if 0 if((tmp.name=constant_name)) add_ref(constant_name); +#else /* !0 */ + tmp.offset = -1; +#endif /* 0 */ add_to_constants(tmp); diff --git a/src/program.h b/src/program.h index 7601b5402c949d32dbaa7137870c999861381c34..ed7eea850a5d780b93b26a47a2c09c28b72b36e7 100644 --- a/src/program.h +++ b/src/program.h @@ -2,7 +2,7 @@ || 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: program.h,v 1.204 2004/05/23 00:45:11 nilsson Exp $ +|| $Id: program.h,v 1.205 2004/05/29 18:13:42 grubba Exp $ */ #ifndef PROGRAM_H @@ -246,8 +246,8 @@ struct identifier */ struct program_constant { - struct svalue sval; - struct pike_string *name; + struct svalue sval; /* Value. */ + ptrdiff_t offset; /* Offset in identifiers to initialization function. */ }; /*