pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:13:   #include "mapping.h"   #include "object.h"   #include "program.h"   #include "stralloc.h"   #include "stuff.h"   #include "error.h"   #include "pike_memory.h"   #include "pike_macros.h"   #include "pike_types.h"   #include "time_stuff.h" + #include "constants.h"      #include "gc.h"   #include "main.h"   #include <math.h>    - RCSID("$Id: gc.c,v 1.40 1998/12/16 07:49:35 hubbe Exp $"); + RCSID("$Id: gc.c,v 1.41 1999/03/17 21:49:24 hubbe Exp $");      /* Run garbage collect approximate every time we have    * 20 percent of all arrays, objects and programs is    * garbage.    */      #define GC_CONST 20   #define MIN_ALLOC_THRESHOLD 1000   #define MAX_ALLOC_THRESHOLD 10000000   #define MULTIPLIER 0.9
pike.git/src/gc.c:308: Inside #if defined(PIKE_DEBUG)
   fprintf(stderr,"**Location description: %s\n",(char *)a);    return;    }       fprintf(stderr,"**Location: %p Type: %s Refs: %d\n",a,    get_name_of_type(t),    *(INT32 *)a);       switch(t)    { +  case T_FUNCTION: +  if(attempt_to_identify(a) != T_OBJECT) +  { +  fprintf(stderr,"**Builtin function!\n"); +  break; +  } +     case T_OBJECT:    p=((struct object *)a)->prog;    fprintf(stderr,"**Parent identifier: %d\n",((struct object *)a)->parent_identifier);    if( ((struct object *)a)->parent)    {    fprintf(stderr,"**Describing object's parent:\n");    describe_something( ((struct object *)a)->parent, t, 1);    }else{    fprintf(stderr,"**There is no parent (any longer?)\n");    }
pike.git/src/gc.c:329: Inside #if defined(PIKE_DEBUG)
   {    fprintf(stderr,"**The object is destructed.\n");    break;    }    fprintf(stderr,"**Attempting to describe program object was instantiated from:\n");       case T_PROGRAM:    {    char *tmp;    INT32 line,pos; +  int foo=0;       fprintf(stderr,"**Program id: %ld\n",(long)(p->id));    if(p->flags & PROGRAM_HAS_C_METHODS)    { -  int e; +     fprintf(stderr,"**The program was written in C.\n"); -  fprintf(stderr,"**identifiers:\n"); -  for(e=0;e<p->num_identifiers;e++) -  fprintf(stderr,"**** %s\n",p->identifiers[e].name->str); +     } -  -  for(pos=0;pos<(long)p->num_program && pos<100;pos++) +  for(pos=0;pos<100;pos++)    {    tmp=get_line(p->program+pos, p, &line);    if(tmp && line)    {    fprintf(stderr,"**Location: %s:%ld\n",tmp,(long)line); -  +  foo=1;    break;    } -  +  if(pos+1>=(long)p->num_program) +  break;    } -  + #if 0 +  if(!foo && p->num_linenumbers>1 && EXTRACT_UCHAR(p->linenumbers)=='\177') +  { +  fprintf(stderr,"**From file: %s\n",p->linenumbers+1); +  foo=1; +  } + #endif +  +  if(!foo) +  { +  int e; + #if 0 +  fprintf(stderr,"**identifiers:\n"); +  for(e=0;e<p->num_identifiers;e++) +  fprintf(stderr,"**** %s\n",p->identifiers[e].name->str); + #else +  fprintf(stderr,"**identifiers:\n"); +  for(e=0;e<p->num_identifier_references;e++) +  fprintf(stderr,"**** %s\n",ID_FROM_INT(p,e)->name->str); +  + #endif +  +  fprintf(stderr,"**num inherits: %d\n",p->num_inherits); +  } +     break;    }       case T_ARRAY:    fprintf(stderr,"**Describing array:\n");    debug_dump_array((struct array *)a);    break;       case T_MAPPING:    fprintf(stderr,"**Describing mapping:\n");
pike.git/src/gc.c:395: Inside #if defined(PIKE_DEBUG)
   fprintf(stderr,"Svalue at %p is:\n",s);    switch(s->type)    {    case T_INT:    fprintf(stderr," %ld\n",(long)s->u.integer);    break;       case T_FLOAT:    fprintf(stderr," %f\n",s->u.float_number);    break; +  +  case T_FUNCTION: +  if(s->subtype == FUNCTION_BUILTIN) +  { +  fprintf(stderr," Builtin function: %s\n",s->u.efun->name->str); +  }else{ +  if(!s->u.object->prog) +  { +  fprintf(stderr," Function in destructed object.\n"); +  }else{ +  fprintf(stderr," Function name: %s\n",ID_FROM_INT(s->u.object->prog,s->subtype)->name->str);    } -  +  } +  }    describe_something(s->u.refs,s->type,1);   }      #endif      INT32 gc_check(void *a)   {   #ifdef PIKE_DEBUG    if(check_for)    {