Branch: Tag:

2008-04-26

2008-04-26 19:04:26 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Moved compilation_depth to struct compilation.
Yet another step on the way to making the compiler thread safe.
Got rid of some now unused cleanup code in dynamic_load.c.

Rev: src/builtin_functions.c:1.656
Rev: src/dynamic_load.c:1.91
Rev: src/encode.c:1.264
Rev: src/language.yacc:1.416
Rev: src/pike_compiler.h:1.9
Rev: src/program.c:1.679
Rev: src/program.h:1.240

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.263 2008/04/14 10:14:38 grubba Exp $ + || $Id: encode.c,v 1.264 2008/04/26 19:04:25 grubba Exp $   */      #include "global.h"
2404:    (X)=pop_unfinished_type(); \   } while(0)    - static void cleanup_new_program_decode (int *orig_compilation_depth) + static void cleanup_new_program_decode (void *ignored)   {    debug_malloc_touch(Pike_compiler->new_program);    debug_malloc_touch(Pike_compiler->new_program->parent);    /* The program is consistent enough to be freed... */    Pike_compiler->new_program->flags &= ~PROGRAM_AVOID_CHECK;    end_first_pass(0); -  compilation_depth = *orig_compilation_depth; +    }      static DECLSPEC(noreturn) void decode_error (struct svalue *decoding,
3638:    struct program *p;    ONERROR err;    ONERROR err2; -  int orig_compilation_depth; +     int byteorder;    int bytecode_method;    int entry_type;
3712:    c->lex.pragmas = (old_pragmas & ~ID_SAVE_PARENT)|ID_DONT_SAVE_PARENT;       /* Start the new program. */ -  orig_compilation_depth = compilation_depth; -  compilation_depth = -1; +     low_start_new_program(p, 1, NULL, 0, NULL);    p = Pike_compiler->new_program;   #if TWO_PASS_DECODE_WORKS
3726:    /* Kludge to get end_first_pass() to free the program. */    Pike_compiler->num_parse_error++;    -  SET_ONERROR(err, cleanup_new_program_decode, &orig_compilation_depth); +  SET_ONERROR(err, cleanup_new_program_decode, NULL);       debug_malloc_touch(p);   
4398:    decode_error(Pike_sp - 1, NULL, "Failed to decode program.\n");    }    pop_stack(); -  compilation_depth = orig_compilation_depth; +     push_program(p);       exit_compiler();