Branch: Tag:

2001-04-14

2001-04-14 09:44:22 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

Jumbopatch:

Saved 8 bytes per object (for objects that do not use their parent scope),
fixed some memory leaks and
first implementation of constant objects (Gmp.Bignum, Math.Matrix and Image.Colour)

Rev: src/backend.cmod:1.14
Rev: src/builtin.cmod:1.27
Rev: src/builtin_functions.c:1.362
Rev: src/docode.c:1.111
Rev: src/encode.c:1.98
Rev: src/gc.c:1.149
Rev: src/interpret.c:1.191
Rev: src/las.c:1.251
Rev: src/main.c:1.123
Rev: src/modules/Gmp/mpz_glue.c:1.93
Rev: src/modules/Image/colors.c:1.49
Rev: src/modules/Math/math_matrix.c:1.22
Rev: src/modules/Oracle/oracle.c:1.56
Rev: src/modules/files/socket.c:1.54
Rev: src/object.c:1.169
Rev: src/object.h:1.62
Rev: src/program.c:1.314
Rev: src/program.h:1.125
Rev: src/threads.h:1.114
Rev: src/version.h:1.273

30:      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.148 2001/03/28 10:02:41 hubbe Exp $"); + RCSID("$Id: gc.c,v 1.149 2001/04/14 09:44:19 hubbe Exp $");      /* Run garbage collect approximately every time    * 20 percent of all arrays, objects and programs is
375:    if(location == (void *)&p->next)    fprintf(stderr,"%*s **In p->next\n",indent,"");    +  if(location == (void *)&p->parent) +  fprintf(stderr,"%*s **In p->parent\n",indent,""); +     if(p->inherits &&    ptr >= (char *)p->inherits &&    ptr < (char*)(p->inherits+p->num_inherits))
429:    struct object *o=(struct object *)memblock;    struct program *p;    -  if(location == (void *)&o->parent) fprintf(stderr,"%*s **In o->parent\n",indent,""); +  if(o->prog && o->prog->flags & PROGRAM_USES_PARENT) +  { +  if(location == (void *)&PARENT_INFO(o)->parent) +  fprintf(stderr,"%*s **In o->parent\n",indent,""); +  }    if(location == (void *)&o->prog) fprintf(stderr,"%*s **In o->prog\n",indent,"");    if(location == (void *)&o->next) fprintf(stderr,"%*s **In o->next\n",indent,"");    if(location == (void *)&o->prev) fprintf(stderr,"%*s **In o->prev\n",indent,"");
643:       case T_OBJECT:    p=((struct object *)a)->prog; -  fprintf(stderr,"%*s**Parent identifier: %d\n",indent,"",((struct object *)a)->parent_identifier); +  if(p && (p->flags & PROGRAM_USES_PARENT)) +  { +  fprintf(stderr,"%*s**Parent identifier: %d\n",indent,"",PARENT_INFO( ((struct object *)a) )->parent_identifier); +  }    fprintf(stderr,"%*s**Program id: %ld\n",indent,"",((struct object *)a)->program_id);       if (((struct object *)a)->next == ((struct object *)a))
674:    low_describe_something(p, T_PROGRAM, indent, depth, flags);    }    -  if( ((struct object *)a)->parent) +  if(p && (p->flags & PROGRAM_USES_PARENT) && +  PARENT_INFO(((struct object *)a))->parent)    {    fprintf(stderr,"%*s**Describing object's parent:\n",indent,""); -  describe_something( ((struct object *)a)->parent, t, indent+2,depth-1, +  describe_something( PARENT_INFO((struct object *)a)->parent, t, indent+2,depth-1,    (flags | DESCRIBE_SHORT | DESCRIBE_NO_REFS )    & ~ (DESCRIBE_MEM));    }else{
691:    INT32 line,pos;    int foo=0;    -  fprintf(stderr,"%*s**Program id: %ld\n",indent,"",(long)(p->id)); +  fprintf(stderr,"%*s**Program id: %ld, flags: %x\n",indent,"", +  (long)(p->id), +  p->flags);       if(p->flags & PROGRAM_HAS_C_METHODS)    {
2259: Inside #if defined(PIKE_DEBUG)
   if ((get_marker(kill_list->data)->flags & (GC_LIVE|GC_LIVE_OBJ)) !=    (GC_LIVE|GC_LIVE_OBJ))    gc_fatal(o, 0, "Invalid thing in kill list.\n"); -  if (o->parent && !o->parent->prog && -  get_marker(o->parent)->flags & GC_LIVE_OBJ) +  if (o->prog && (o->prog->flags & PROGRAM_USES_PARENT) && +  PARENT_INFO(o)->parent && +  !PARENT_INFO(o)->parent->prog && +  get_marker(PARENT_INFO(o)->parent)->flags & GC_LIVE_OBJ)    gc_fatal(o, 0, "GC destructed parent prematurely.\n");   #endif    GC_VERBOSE_DO(fprintf(stderr, "| Killing %p with %d refs\n",