Branch: Tag:

2008-05-07

2008-05-07 17:26:17 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Fixed over-optimization of lambdas caused by 1.419.

Rev: src/language.yacc:1.421

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: language.yacc,v 1.420 2008/05/07 15:10:39 grubba Exp $ + || $Id: language.yacc,v 1.421 2008/05/07 17:26:17 grubba Exp $   */      %pure_parser
2151:    $<number>$ = Pike_compiler->varargs;    Pike_compiler->varargs = 0;    +  if (Pike_compiler->compiler_pass == 1) {    /* Define a tentative prototype for the lambda. */    push_finished_type(mixed_type_string);    e=$6-1;
2170:    }    type=compiler_pop_type();    Pike_compiler->compiler_frame->current_function_number = -  define_function(name, type, ID_STATIC | ID_PRIVATE | ID_INLINE | ID_USED, -  IDENTIFIER_PIKE_FUNCTION, NULL, 0); +  define_function(name, type, +  ID_STATIC | ID_PRIVATE | ID_INLINE | ID_USED, +  IDENTIFIER_PIKE_FUNCTION, NULL, +  (unsigned INT16) +  (Pike_compiler->compiler_frame->opt_flags));    free_type(type); -  +  } else { +  /* In pass 2 we just reuse the type from pass 1. */ +  Pike_compiler->compiler_frame->current_function_number = +  isidentifier(name);    } -  +  }    failsafe_block    {    struct pike_type *type;
2232:    simple_describe_type(type);    fprintf(stderr, "\n");   #endif /* LAMBDA_DEBUG */ -  if(Pike_compiler->compiler_pass == 2) -  Pike_compiler->compiler_frame->current_function_number=isidentifier(name); +        f=dooptcode(name,    $8,    type,    ID_STATIC | ID_PRIVATE | ID_INLINE | ID_USED);    -  + #ifdef PIKE_DEBUG +  if (f != Pike_compiler->compiler_frame->current_function_number) { +  Pike_fatal("Lost track of lambda %s.\n", name->str); +  } + #endif /* PIKE_DEBUG */ +    #ifdef LAMBDA_DEBUG    fprintf(stderr, "%d: lexical_scope: 0x%08x\n",    Pike_compiler->compiler_pass,