Branch: Tag:

2003-03-14

2003-03-14 15:57:49 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Improved dmalloc.

Rev: src/apply_low.h:1.16
Rev: src/array.c:1.138
Rev: src/backend.cmod:1.38
Rev: src/bignum.c:1.34
Rev: src/block_alloc.h:1.63
Rev: src/builtin_functions.c:1.479
Rev: src/code/ia32.c:1.25
Rev: src/cpp.c:1.115
Rev: src/encode.c:1.169
Rev: src/error.c:1.102
Rev: src/gc.c:1.209
Rev: src/interpret.c:1.295
Rev: src/interpret.h:1.131
Rev: src/interpret_functions.h:1.141
Rev: src/iterators.cmod:1.35
Rev: src/las.c:1.330
Rev: src/mapping.c:1.163
Rev: src/modules/Image/orient.c:1.24
Rev: src/modules/Image/phase.h:1.6
Rev: src/modules/Java/jvm.c:1.60
Rev: src/modules/SANE/sane.c:1.17
Rev: src/modules/_Roxen/roxen.c:1.33
Rev: src/multiset.c:1.69
Rev: src/object.c:1.228
Rev: src/opcodes.c:1.143
Rev: src/operators.c:1.172
Rev: src/pike_types.c:1.211
Rev: src/post_modules/Shuffler/Shuffler.cmod:1.23
Rev: src/post_modules/Shuffler/a_source_pikestring.c:1.8
Rev: src/post_modules/Shuffler/a_source_system_memory.c:1.9
Rev: src/post_modules/Shuffler/b_source_normal_file.c:1.8
Rev: src/post_modules/Shuffler/c_source_stream.c:1.7
Rev: src/post_modules/Shuffler/d_source_pikestream.c:1.6
Rev: src/post_modules/Shuffler/e_source_block_pikestream.c:1.2
Rev: src/preprocessor.h:1.58
Rev: src/program.c:1.486
Rev: src/signal_handler.c:1.249
Rev: src/stralloc.c:1.153
Rev: src/stralloc.h:1.73
Rev: src/svalue.c:1.161
Rev: src/threads.c:1.211

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: interpret.h,v 1.130 2003/02/24 20:27:11 mast Exp $ + || $Id: interpret.h,v 1.131 2003/03/14 15:50:44 grubba Exp $   */      #ifndef INTERPRET_H
215:   #define push_constant_text(T) do{ Pike_sp->subtype=0; REF_MAKE_CONST_STRING(Pike_sp->u.string,T); Pike_sp++->type=PIKE_T_STRING; }while(0)   #define push_function(OBJ, FUN) do {struct object *_=(OBJ); debug_malloc_touch(_); Pike_sp->u.object=_; Pike_sp->subtype=(FUN); Pike_sp++->type=PIKE_T_FUNCTION;} while (0)    - #define ref_push_program(P) do{ struct program *_=(P); debug_malloc_touch(_); _->refs++; Pike_sp->u.program=_; Pike_sp++->type=PIKE_T_PROGRAM; }while(0) - #define ref_push_mapping(M) do{ struct mapping *_=(M); debug_malloc_touch(_); _->refs++; Pike_sp->u.mapping=_; Pike_sp++->type=PIKE_T_MAPPING; }while(0) - #define ref_push_array(A) do{ struct array *_=(A); debug_malloc_touch(_); _->refs++; Pike_sp->u.array=_ ;Pike_sp++->type=PIKE_T_ARRAY; }while(0) - #define ref_push_multiset(L) do{ struct multiset *_=(L); debug_malloc_touch(_); _->refs++; Pike_sp->u.multiset=_; Pike_sp++->type=PIKE_T_MULTISET; }while(0) - #define ref_push_string(S) do{ struct pike_string *_=(S); debug_malloc_touch(_); _->refs++; Pike_sp->subtype=0; Pike_sp->u.string=_; Pike_sp++->type=PIKE_T_STRING; }while(0) - #define ref_push_type_value(S) do{ struct pike_type *_=(S); debug_malloc_touch(_); _->refs++; Pike_sp->u.type=_; Pike_sp++->type=PIKE_T_TYPE; }while(0) - #define ref_push_object(O) do{ struct object *_=(O); debug_malloc_touch(_); _->refs++; Pike_sp->u.object=_; Pike_sp++->type=PIKE_T_OBJECT; }while(0) - #define ref_push_function(OBJ, FUN) do {struct object *_=(OBJ); debug_malloc_touch(_); _->refs++; Pike_sp->u.object=_; Pike_sp->subtype=(FUN); Pike_sp++->type=PIKE_T_FUNCTION;} while (0) + #define ref_push_program(P) do{ struct program *_=(P); add_ref(_); Pike_sp->u.program=_; Pike_sp++->type=PIKE_T_PROGRAM; }while(0) + #define ref_push_mapping(M) do{ struct mapping *_=(M); add_ref(_); Pike_sp->u.mapping=_; Pike_sp++->type=PIKE_T_MAPPING; }while(0) + #define ref_push_array(A) do{ struct array *_=(A); add_ref(_); Pike_sp->u.array=_ ;Pike_sp++->type=PIKE_T_ARRAY; }while(0) + #define ref_push_multiset(L) do{ struct multiset *_=(L); add_ref(_); Pike_sp->u.multiset=_; Pike_sp++->type=PIKE_T_MULTISET; }while(0) + #define ref_push_string(S) do{ struct pike_string *_=(S); add_ref(_); Pike_sp->subtype=0; Pike_sp->u.string=_; Pike_sp++->type=PIKE_T_STRING; }while(0) + #define ref_push_type_value(S) do{ struct pike_type *_=(S); add_ref(_); Pike_sp->u.type=_; Pike_sp++->type=PIKE_T_TYPE; }while(0) + #define ref_push_object(O) do{ struct object *_=(O); add_ref(_); Pike_sp->u.object=_; Pike_sp++->type=PIKE_T_OBJECT; }while(0) + #define ref_push_function(OBJ, FUN) do {struct object *_=(OBJ); add_ref(_); Pike_sp->u.object=_; Pike_sp->subtype=(FUN); Pike_sp++->type=PIKE_T_FUNCTION;} while (0)      #define push_svalue(S) do { const struct svalue *_=(S); assign_svalue_no_free(Pike_sp,_); Pike_sp++; }while(0)   
262:    */   #define stack_unlink(X) do { if(X) { free_svalue(Pike_sp-(X)-1); Pike_sp[-(X)-1]=Pike_sp[-1]; Pike_sp--; pop_n_elems(X-1); } }while(0)    - #define free_pike_frame(F) do{ struct pike_frame *f_=(F); debug_malloc_touch(f_); if(!--f_->refs) really_free_pike_frame(f_); }while(0) + #define free_pike_frame(F) do{ struct pike_frame *f_=(F); if(!sub_ref(f_)) really_free_pike_frame(f_); }while(0)      /* A scope is any frame which may have malloced locals */ - #define free_pike_scope(F) do{ struct pike_frame *f_=(F); debug_malloc_touch(f_); if(!--f_->refs) really_free_pike_scope(f_); }while(0) + #define free_pike_scope(F) do{ struct pike_frame *f_=(F); if(!sub_ref(f_)) really_free_pike_scope(f_); }while(0)      #define POP_PIKE_FRAME() do { \ -  struct pike_frame *tmp_=Pike_fp->next; \ +  struct pike_frame *tmp_=Pike_fp->next; \    if(!sub_ref(Pike_fp)) \    { \ -  really_free_pike_frame(Pike_fp); \ +  really_free_pike_frame(Pike_fp); \    }else{ \ -  DO_IF_DEBUG(if( Pike_fp->locals + Pike_fp->num_locals > Pike_sp || Pike_sp < Pike_fp->expendible) Pike_fatal("Stack failure in POP_PIKE_FRAME %p+%d=%p %p %p!\n",Pike_fp->locals,Pike_fp->num_locals,Pike_fp->locals+Pike_fp->num_locals,Pike_sp,Pike_fp->expendible)); \ -  debug_malloc_touch(Pike_fp); \ -  if(Pike_fp->num_locals) \ +  DO_IF_DEBUG( \ +  if( (Pike_fp->locals + Pike_fp->num_locals > Pike_sp) || \ +  (Pike_sp < Pike_fp->expendible)) \ +  Pike_fatal("Stack failure in POP_PIKE_FRAME %p+%d=%p %p %p!\n", \ +  Pike_fp->locals, Pike_fp->num_locals, \ +  Pike_fp->locals+Pike_fp->num_locals, \ +  Pike_sp,Pike_fp->expendible)); \ +  debug_malloc_touch(Pike_fp); \ +  if(Pike_fp->num_locals) \    { \    struct svalue *s=(struct svalue *)xalloc(sizeof(struct svalue)* \ -  Pike_fp->num_locals); \ -  assign_svalues_no_free(s,Pike_fp->locals,Pike_fp->num_locals,BIT_MIXED); \ -  Pike_fp->locals=s; \ -  Pike_fp->flags|=PIKE_FRAME_MALLOCED_LOCALS; \ +  Pike_fp->num_locals); \ +  assign_svalues_no_free(s, Pike_fp->locals, Pike_fp->num_locals, \ +  BIT_MIXED); \ +  Pike_fp->locals=s; \ +  Pike_fp->flags|=PIKE_FRAME_MALLOCED_LOCALS; \    }else{ \ -  Pike_fp->locals=0; \ +  Pike_fp->locals=0; \    } \ -  Pike_fp->next=0; \ +  Pike_fp->next=0; \    } \    Pike_fp=tmp_; \    }while(0)