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

5:   \*/      /* -  * $Id: program.h,v 1.124 2001/04/08 10:11:40 hubbe Exp $ +  * $Id: program.h,v 1.125 2001/04/14 09:44:21 hubbe Exp $    */   #ifndef PROGRAM_H   #define PROGRAM_H
234:   /* Program will be destructed as soon at it runs out of references.    * Normally only used for mutex lock keys and similar    */ - #define PROGRAM_DESTRUCT_IMMEDIATE 16 + #define PROGRAM_DESTRUCT_IMMEDIATE 0x10      /* Self explanatory, automatically detected */ - #define PROGRAM_HAS_C_METHODS 32 + #define PROGRAM_HAS_C_METHODS 0x20    - /* All non-static functions are inlinable */ - #define PROGRAM_CONSTANT 64 + /* Objects created from this program are constant and shareable */ + #define PROGRAM_CONSTANT 0x40      /* */ - #define PROGRAM_USES_PARENT 128 + #define PROGRAM_USES_PARENT 0x80      /* Objects should not be destructed even when they only has weak    * references left. */ - #define PROGRAM_NO_WEAK_FREE 256 + #define PROGRAM_NO_WEAK_FREE 0x100      /* Objects should not be destructed by f_destruct(). */ - #define PROGRAM_NO_EXPLICIT_DESTRUCT 512 + #define PROGRAM_NO_EXPLICIT_DESTRUCT 0x200      /* Program is in an inconsistant state */ - #define PROGRAM_AVOID_CHECK 512 + #define PROGRAM_AVOID_CHECK 0x400      /* Program has not yet been used for compilation */ - #define PROGRAM_VIRGIN 1024 + #define PROGRAM_VIRGIN 0x800      enum pike_program_event   {
267:    NUM_PROG_EVENTS,   };    + /* These macros should only be used if (p->flags & PROGRAM_USES_PARENT) +  * is true +  */ + #define LOW_PARENT_INFO(O,P) ((struct parent_info *)(PIKE_OBJ_STORAGE((O)) + (P)->parent_info_storage)) + #define PARENT_INFO(O) LOW_PARENT_INFO( (O), (O)->prog) +  + struct parent_info + { +  struct object *parent; +  INT16 parent_identifier; + }; +    struct program   {    PIKE_MEMORY_OBJECT_MEMBERS; /* Must be first */
278:    * subtracted when inheriting.    */    ptrdiff_t storage_needed; /* storage needed in the object struct */ +  ptrdiff_t xstorage; /* Non-inherited storage */ +  ptrdiff_t parent_info_storage; +     INT16 flags; /* PROGRAM_* */    unsigned INT8 alignment_needed;    struct timeval timestamp;       struct program *next;    struct program *prev; -  struct program *parent; /* FIXME: Use this -Hubbe */ +  struct program *parent;    -  +     void (*event_handler)(enum pike_program_event);   #ifdef PIKE_DEBUG    unsigned INT32 checksum;