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: dynamic_load.c,v 1.90 2008/04/14 10:14:38 grubba Exp $ + || $Id: dynamic_load.c,v 1.91 2008/04/26 19:04:25 grubba Exp $   */      #ifdef TESTING
377:   #define CAST_TO_FUN(X) ((modfun)X)   #endif /* NO_CAST_TO_FUN */    - struct compilation_save + static void cleanup_compilation(void *ignored)   { -  struct lex lex; -  int compilation_depth; - }; -  - static void cleanup_compilation(struct compilation_save *save) - { +     struct program *p = end_program();    if (p) {    free_program(p);    } -  compilation_depth = save->compilation_depth; +    }      /*! @decl program load_module(string module_name)
411:    */   void f_load_module(INT32 args)   { -  extern int compilation_depth; +     extern int global_callable_flags;       void *module;
421:       ONERROR err;    -  struct compilation_save save; -  +     module_name = Pike_sp[-args].u.string;       if((Pike_sp[-args].type != T_STRING) ||
538:       enter_compiler(new_module->name, 1);    -  save.compilation_depth=compilation_depth; -  compilation_depth=-1; +     start_new_program();       global_callable_flags|=CALLABLE_DYNAMIC;
547: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    { struct svalue *save_sp=Pike_sp;   #endif -  SET_ONERROR(err, cleanup_compilation, &save); +  SET_ONERROR(err, cleanup_compilation, NULL);   #if defined(__NT__) && defined(_M_IA64)    fprintf(stderr, "Calling pike_module_init()...\n");   #endif /* __NT__ && _M_IA64 */
568:    {    struct program *p = end_program();    exit_compiler(); -  compilation_depth = save.compilation_depth; +     if (p) {    if (   #if 0