Branch: Tag:

2017-03-29

2017-03-29 15:58:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Make do_code_block() reentrant.

do_code_block() can be called recursively during constant expression
evaluation via eval_low(). Eg the expression

Module["String"]

can cause the module Module.String to be compiled.

Fixes fatal "Reentrance in do_code_block().".

2819:    struct reference *id = NULL;    INT32 entry_point;    int aggregate_cnum = -1; - #ifdef PIKE_DEBUG -  if (current_stack_depth != -4711) Pike_fatal("Reentrance in do_code_block().\n"); +  int save_stack_depth = current_stack_depth;    current_stack_depth = 0; - #endif +        if (Pike_compiler->compiler_frame->current_function_number >= 0) {    id = Pike_compiler->new_program->identifier_references +
2925:    }    entry_point = assemble(1);    - #ifdef PIKE_DEBUG -  current_stack_depth = -4711; - #endif +  current_stack_depth = save_stack_depth;    return entry_point;   }