pike.git / src / interpret.h

version» Context lines:

pike.git/src/interpret.h:72:    struct svalue **save_mark_sp; /** saved mark sp level */       PIKE_OPCODE_T *pc; /** Address of current opcode. */    struct svalue *locals; /** Start of local variables. */    char *current_storage; /** == current_object->storage + context->storage_offset */    struct object *current_object;    struct inherit *context; /** inherit context */    struct program *current_program; /* program containing the context. */    PIKE_OPCODE_T *return_addr; /** Address of opcode to continue at after call. */    +  /** +  * If PIKE_FRAME_SAVE_LOCALS is set, this is a pointer to a bitmask +  * represented by an array of 16-bit ints. A set bit indicates that +  * the corresponding local variable is used from a subscope and +  * needs to be preserved in LOW_POP_PIKE_FRAME. The least +  * significant bit of the first entry represents the first local +  * variable and so on. The array is (num_locals >> 4) + 1 entries +  * (i.e. it will always have enough space to represent all +  * locals). */ +  unsigned INT16 *save_locals_bitmask; +     unsigned INT16 flags; /** PIKE_FRAME_* */    /**    * This tells us the current level of svalues on the stack that can    * be discarded once the current function is done with them. It is an offset    * from locals and is always positive.    */    INT16 expendible_offset;    INT16 num_locals; /** Number of local variables. */    INT16 num_args; /** Number of argument variables. */   
pike.git/src/interpret.h:93:    /**    * This is an offset from locals and denotes the place where the return value    * should go.    *    * It can be -1 if the function to be called is on the stack.    * It can be even more negative in case of recursion when the return value location    * get replaced by that of the previous frame.    */    INT16 save_sp_offset;    -  /** -  * If PIKE_FRAME_SAVE_LOCALS is set, this is a pointer to a bitmask -  * represented by an array of 16-bit ints. A set bit indicates that -  * the corresponding local variable is used from a subscope and -  * needs to be preserved in LOW_POP_PIKE_FRAME. The least -  * significant bit of the first entry represents the first local -  * variable and so on. The array is (num_locals >> 4) + 1 entries -  * (i.e. it will always have enough space to represent all -  * locals). */ -  INT16 *save_locals_bitmask; -  +    #ifdef PROFILING    cpu_time_t children_base; /** Accounted time when the frame started. */    cpu_time_t start_time; /** Adjusted time when thr frame started. */   #endif /* PROFILING */   };      static inline struct svalue *frame_get_save_sp(const struct pike_frame *frame) {    return frame->locals + frame->save_sp_offset;   }   
pike.git/src/interpret.h:575:    if (_fp_->flags & PIKE_FRAME_SAVE_LOCALS) { \    /* We need to save the locals indicated by save_locals_bitmask, \    but we can ignore/discard the rest. */ \    ptrdiff_t offset; \    struct svalue *locals = _fp_->locals; \    INT16 num_locals = _fp_->num_locals; \    INT16 num_entries = (num_locals >> 4) + 1; \    struct svalue *s=(struct svalue *)xalloc(sizeof(struct svalue)* \    _fp_->num_locals); \    for (offset = 0; offset < num_entries; offset++) { \ -  INT16 entry = *(_fp_->save_locals_bitmask + offset); \ -  INT16 idx; \ +  unsigned INT16 entry = *(_fp_->save_locals_bitmask + offset); \ +  int idx; \ +  if (!entry) continue; \ +  \    for (idx = 0; idx < 16; idx++) { \ -  INT16 local_var_idx = offset * 16 + idx; \ +  int local_var_idx = offset * 16 + idx; \    if (local_var_idx >= num_locals) { \    break; \    } \    if (entry & (1 << idx)) { \    assign_svalue(s + (ptrdiff_t)local_var_idx, \    locals + (ptrdiff_t)local_var_idx); \    } else { \    mark_free_svalue(s + (ptrdiff_t)local_var_idx); \    } \    } \