pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.c:2781:    emit0(F_CONST0);    }    return 1;       default:    Pike_fatal("Infernal compiler error (unknown parse-tree-token %d).\n", n->token);    UNREACHABLE(return 0);    }   }    + static void emit_save_locals(struct compiler_frame *f) + { +  struct compilation *c = THIS_COMPILATION; +  unsigned INT16 offset; +  unsigned INT16 idx; +  int num_locals = f->max_number_of_locals; +  +  for (offset = 0; offset < (num_locals >> 4) + 1; offset++) { +  unsigned int bitmask = 0; +  for (idx = 0; idx < 16; idx++) { +  int local_var_idx = offset * 16 + idx; +  if (local_var_idx >= num_locals) { +  break; +  } +  if (f->variable[local_var_idx].flags & LOCAL_VAR_USED_IN_SCOPE) { +  bitmask |= 1 << idx; +  } +  } +  if (bitmask) { +  emit1(F_SAVE_LOCALS, (offset << 16) | bitmask); +  } +  } + } +    /* Used to generate code for functions. */   INT32 do_code_block(node *n)   {    struct compilation *c = THIS_COMPILATION;    struct reference *id = NULL;    struct identifier *i = NULL;    INT32 entry_point;    int aggregate_cnum = -1;   #ifdef PIKE_DEBUG    if (current_stack_depth != -4711) Pike_fatal("Reentrance in do_code_block().\n");
pike.git/src/docode.c:2838:    emit0(F_POP_TO_MARK);    if (Pike_compiler->compiler_frame->max_number_of_locals !=    Pike_compiler->compiler_frame->num_args) {    emit2(F_FILL_STACK,    Pike_compiler->compiler_frame->max_number_of_locals, 0);    }    }    emit2(F_INIT_FRAME, Pike_compiler->compiler_frame->num_args,    Pike_compiler->compiler_frame->max_number_of_locals);    if (Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPE_USED) { -  emit1(F_PROTECT_STACK, Pike_compiler->compiler_frame->max_number_of_locals); +  emit_save_locals(Pike_compiler->compiler_frame);    }       if(id && (id->id_flags & ID_INLINE))    {    Pike_compiler->compiler_frame->recur_label=0;    Pike_compiler->compiler_frame->is_inline=1;    }       DO_CODE_BLOCK(n);   
pike.git/src/docode.c:2889:    emit0(F_POP_TO_MARK);    if (Pike_compiler->compiler_frame->max_number_of_locals !=    Pike_compiler->compiler_frame->num_args) {    emit2(F_FILL_STACK,    Pike_compiler->compiler_frame->max_number_of_locals, 0);    }    emit2(F_INIT_FRAME, Pike_compiler->compiler_frame->num_args,    Pike_compiler->compiler_frame->max_number_of_locals);    }    if (Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPE_USED) { -  emit1(F_PROTECT_STACK, -  Pike_compiler->compiler_frame->max_number_of_locals); +  emit_save_locals(Pike_compiler->compiler_frame);    }       DO_CODE_BLOCK(n);    }    entry_point = assemble(1);      #ifdef PIKE_DEBUG    current_stack_depth = -4711;   #endif    return entry_point;