Branch: Tag:

1998-11-06

1998-11-06 03:08:03 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

bugfix + more debug

Rev: src/compilation.h:1.11
Rev: src/pike_types.c:1.48
Rev: src/pike_types.h:1.15
Rev: src/program.c:1.101

1:   /* -  * $Id: compilation.h,v 1.10 1998/04/27 10:00:26 hubbe Exp $ +  * $Id: compilation.h,v 1.11 1998/11/06 03:08:00 hubbe Exp $    *    * Compilator state push / pop operator construction file    *
8:      /*    * IMEMBER: do not reset this member when popping +  * DMEMBER: This member should be the same when popping as when pushing.    * ZMEMBER: reset this member to zero when pushing -  +  * STACKMEMBER: Like IMEMBER, but is not allowed to become more when popping    *    * defining STRUCT defines the structures    * defining DECLARE creates global vars for saving linked list
19:    * define PROGRAM_STATE to select the program state    */    + #ifdef DEBUG + #define DO_DEBUG_CODE(X) X + #else + #define DO_DEBUG_CODE(X) + #endif +    #ifdef STRUCT   #define IMEMBER(X,Y) X Y ; -  + #define DMEMBER(X,Y) X Y ; + #define STACKMEMBER(X,Y) X Y ;   #define IMEMBER2(X,Y,Z) X Y Z ;   #define ZMEMBER(X,Y) X Y ;   #define ZMEMBER2(X,Y,Z) X Y Z ;
30: Inside #if defined(DECLARE)
     #ifdef DECLARE   #define IMEMBER(X,Y) + #define DMEMBER(X,Y) + #define STACKMEMBER(X,Y)   #define IMEMBER2(X,Y,Z)   #define ZMEMBER(X,Y)   #define ZMEMBER2(X,Y,Z)
39: Inside #if defined(PUSH)
     #ifdef PUSH   #define IMEMBER(X,Y) MEMCPY((char *)&(oLd->Y), (char *)&(Y), sizeof(Y)); + #define DMEMBER(X,Y) IMEMBER(X,Y) + #define STACKMEMBER(X,Y) (oLd->Y=Y);   #define IMEMBER2(X,Y,Z) IMEMBER(X,Y)   #define ZMEMBER(X,Y) MEMCPY((char *)&(oLd->Y), (char *)&(Y), sizeof(Y)); \    MEMSET((char *)&(Y), 0, sizeof(Y));
48:    oLd=ALLOC_STRUCT(X); \    oLd->previous=Y; Y=oLd;   #define SEND } +    #endif      
56:   #define IMEMBER2(X,Y,Z) IMEMBER(X,Y)   #define ZMEMBER(X,Y) MEMCPY((char *)&(Y), (char *)&(oLd->Y), sizeof(Y));   #define ZMEMBER2(X,Y,Z) ZMEMBER(X,Y) +  + #define DMEMBER(X,Y) DO_DEBUG_CODE( \ +  if(MEMCMP((char *)&(Y), (char *)&(oLd->Y), sizeof(Y))) \ +  fatal("Variable " #Y " became whacked during compilation.\n"); ) \ +  IMEMBER(X,Y) +  + #define STACKMEMBER(X,Y) DO_DEBUG_CODE( \ +  if(Y < oLd->Y) \ +  fatal("Stack " #Y " shrunk %d steps compilation, currently: %p.\n",oLd->Y - Y,Y); ) \ +  Y=oLd->Y; +    #define SNAME(X,Y) { \    struct X *oLd; \    oLd=Y; Y=oLd->previous;
91:    ZMEMBER(int,local_class_counter)    ZMEMBER(int,catch_level)    ZMEMBER(struct mapping *,module_index_cache) +  STACKMEMBER(unsigned char *,type_stackp) +  STACKMEMBER(unsigned char **,pike_type_mark_stackp)    SEND      #undef PCODE   #undef STRMEMBER   #undef IMEMBER -  + #undef DMEMBER   #undef ZMEMBER   #undef IMEMBER2   #undef ZMEMBER2
106:   #undef PUSH   #undef POP   #undef DECLARE + #undef DO_DEBUG_CODE