1998-04-16
1998-04-16 21:30:09 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
-
0e88611d1a2b127881fb955b4430b79aa92a4a1f
(53 lines)
(+31/-22)
[
Show
| Annotate
]
Branch: 7.9
new efun: _reset_dmalloc()
Rev: src/builtin_functions.c:1.99
Rev: src/dmalloc.h:1.7
Rev: src/pike_memory.c:1.22
4:
||| See the files COPYING and DISCLAIMER for more information.
\*/
#include "global.h"
- RCSID("$Id: builtin_functions.c,v 1.98 1998/04/16 01:14:16 hubbe Exp $");
+ RCSID("$Id: builtin_functions.c,v 1.99 1998/04/16 21:30:08 hubbe Exp $");
#include "interpret.h"
#include "svalue.h"
#include "pike_macros.h"
311:
ITEM(i)[2].type=T_FUNCTION;
ITEM(i)[2].subtype=f->fun;
ITEM(i)[2].u.object=f->current_object;
- f->current_object->refs++;
+ add_ref(f->current_object);
}else{
ITEM(i)[2].type=T_INT;
ITEM(i)[2].subtype=NUMBER_DESTRUCTED;
593:
void f_all_constants(INT32 args)
{
pop_n_elems(args);
- push_mapping(get_builtin_constants());
- sp[-1].u.mapping->refs++;
+ ref_push_mapping(get_builtin_constants());
}
void f_allocate(INT32 args)
652:
{
sp->u.object=fp->current_object;
sp->type=T_OBJECT;
- fp->current_object->refs++;
+ add_ref(fp->current_object);
sp++;
}else{
push_int(0);
887:
{
push_int(0);
}else{
- o->refs++;
- push_object(o);
+ ref_push_object(o);
}
}
907:
{
INT32 id=o->parent_identifier;
o=o->parent;
- o->refs++;
+ add_ref(o);
pop_n_elems(args);
push_object(o);
sp[-1].subtype=id;
sp[-1].type=T_FUNCTION;
return;
}else{
- p->refs++;
+ add_ref(p);
pop_n_elems(args);
push_program(p);
return;
1368:
for(e=0;e<a->size;e++)
index_no_free(ITEM(a)+e, sp-args-1, ITEM(tmp)+e);
- a->refs++;
+ add_ref(a);
pop_n_elems(args+1);
push_array(a);
}
1388:
tmp=sp[-args].u.array;
if((a=(struct array *)BEGIN_CYCLIC(tmp,0)))
{
- a->refs++;
+ add_ref(a);
pop_n_elems(args);
push_array(a);
}else{
1399:
index_no_free(ITEM(a)+e, ITEM(tmp)+e, sp-args);
END_CYCLIC();
- a->refs++;
+ add_ref(a);
pop_n_elems(args+1);
push_array(a);
}
1631:
glob->str,
glob->len))
{
- ITEM(a)[i].u.string->refs++;
+ add_ref(ITEM(a)[i].u.string);
push_string(ITEM(a)[i].u.string);
matches++;
}
1791:
if (!pval)
{
res->item[i].type=T_ARRAY;
- (res->item[i].u.array=&empty_array)->refs++;
+ add_ref(res->item[i].u.array=&empty_array);
}
else
{
2061:
dml->refs = 1;
if (pos)
- (dml->prev = stack[pos-1])->refs++;
+ add_ref(dml->prev = stack[pos-1]);
else
dml->prev = NULL;
2094:
dml->refs = 1;
if (pos)
- (dml->prev = stack[pos-1])->refs++;
+ add_ref(dml->prev = stack[pos-1]);
else
dml->prev = NULL;
2419:
free_object(master_object);
master_object=sp[-args].u.object;
- master_object->refs++;
+ add_ref(master_object);
free_program(master_program);
master_program=master_object->prog;
- master_program->refs++;
+ add_ref(master_program);
pop_n_elems(args);
}
2431:
void f_master(INT32 args)
{
pop_n_elems(args);
- master_object->refs++;
- push_object(master_object);
+ ref_push_object(master_object);
}
#ifdef HAVE_GETHRVTIME
2478: Inside #if defined(PROFILING)
prog = program_from_svalue(sp-args);
if(!prog) ERROR("get_profiling_info", "Bad argument 1.\n", sp, args);
- prog->refs++;
+ add_ref(prog);
pop_n_elems(args);
2490: Inside #if defined(PROFILING)
if (prog->identifiers[i].num_calls)
{
num_functions++;
- prog->identifiers[i].name->refs++;
+ add_ref(prog->identifiers[i].name);
push_string(prog->identifiers[i].name);
push_int(prog->identifiers[i].num_calls);
2671:
return;
}
+ #ifdef DEBUG_MALLOC
+ void f__reset_dmalloc(INT32 args)
+ {
+ pop_n_elems(args);
+ reset_debug_malloc();
+ }
+ #endif
+
void init_builtin_efuns(void)
{
init_operators();
2779:
add_function("diff_compare_table",f_diff_compare_table,"function(array,array:array(array))",OPT_TRY_OPTIMIZE);
add_function("longest_ordered_sequence",f_longest_ordered_sequence,"function(array:array(int))",0);
add_function("sort",f_sort,"function(array(mixed),array(mixed)...:array(mixed))",OPT_SIDE_EFFECT);
+ #ifdef DEBUG_MALLOC
+ add_efun("_reset_dmalloc",f__reset_dmalloc,"function(void:void)",OPT_SIDE_EFFECT);
+ #endif
}