pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1:   /*   || 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.474 2003/08/18 15:11:38 mast Exp $ + || $Id: program.c,v 1.475 2003/08/19 15:15:37 grubba Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.474 2003/08/18 15:11:38 mast Exp $"); + RCSID("$Id: program.c,v 1.475 2003/08/19 15:15:37 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"
pike.git/src/program.c:3734: Inside #if defined(PROGRAM_BUILD_DEBUG)
   Pike_compiler->compiler_pass);    push_string (name);    print_svalue (stderr, --Pike_sp);    }    putc ('\n', stderr);    }   #endif       if (!c) {    zero.type = T_INT; -  zero.subtype = 0; +  zero.subtype = NUMBER_LOCKED; /* Make sure we get a new unique entry. */    zero.u.integer = 0;    c = &zero;    }      #ifdef PIKE_DEBUG    if(name!=debug_findstring(name))    Pike_fatal("define_constant on nonshared string.\n");   #endif       do {
pike.git/src/program.c:4541:       reference_shared_string(str);    add_to_strings(str);    return i;   }      int store_constant(struct svalue *foo,    int equal,    struct pike_string *constant_name)   { -  struct program_constant tmp; -  unsigned int e; +     JMP_BUF tmp2;       if(SETJMP(tmp2))    {    struct svalue zero, thrown = throw_value;    throw_value.type = T_INT;       yyerror("Couldn't store constant.");       push_svalue(&thrown);
pike.git/src/program.c:4565:    pop_stack();    free_svalue(&thrown);       zero.type = T_INT;    zero.subtype = NUMBER_NUMBER;    zero.u.integer=0;       UNSETJMP(tmp2);    return store_constant(&zero, equal, constant_name);    }else{ +  struct program_constant tmp; +  unsigned int e; +  +  if ((foo->type == T_INT) && (foo->subtype == NUMBER_LOCKED)) { +  /* Allocate a locked entry. */ +  e = Pike_compiler->new_program->num_constants; +  } else {    for(e=0;e<Pike_compiler->new_program->num_constants;e++)    {    JMP_BUF tmp1;    /* Assume that if `==() throws an error, the svalues aren't equal. */    if (!SETJMP(tmp1)) {    struct program_constant *c= Pike_compiler->new_program->constants+e; -  +  if ((c->sval.type == T_INT) && (c->sval.subtype == NUMBER_LOCKED)) { +  /* Never share locked entries. */ +  } else {    if((equal ? is_equal(& c->sval,foo) : is_eq(& c->sval,foo)) &&    c->name == constant_name)    {    UNSETJMP(tmp1);    UNSETJMP(tmp2);    return e;    }    } -  +  }    UNSETJMP(tmp1);    } -  +  }    assign_svalue_no_free(&tmp.sval,foo);    if((tmp.name=constant_name)) add_ref(constant_name);       add_to_constants(tmp);       UNSETJMP(tmp2);    return e;    }   }