? src/ChangeLog.add Index: src/alloc.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/alloc.c,v retrieving revision 1.42.2.19 diff -u -r1.42.2.19 alloc.c --- alloc.c 1999/09/28 00:42:59 1.42.2.19 +++ alloc.c 1999/09/29 17:10:02 @@ -63,6 +63,11 @@ #include #endif +#ifdef HAVE_MMAP +#include +#include +#endif + EXFUN (Fgarbage_collect, 0); /* Return the true size of a struct with a variable-length array field. */ @@ -2396,7 +2401,7 @@ = {0}; static int staticidx_nodump; -/* Put an entry in staticvec, pointing at the variable whose address is given +/* Put an entry in staticvec_nodump, pointing at the variable whose address is given */ void staticpro_nodump (Lisp_Object *varaddress) @@ -2408,6 +2413,26 @@ staticvec_nodump[staticidx_nodump++] = varaddress; } +/* Not "static" because of linker lossage on some systems */ +struct { + void *data; + const struct struct_description *desc; +} dumpstructvec[200]; + +static int dumpstructidx; + +/* Put an entry in staticvec, pointing at the variable whose address is given + */ +void +dumpstruct (void *varaddress, const struct struct_description *desc) +{ + if (dumpstructidx >= countof (dumpstructvec)) + abort (); + dumpstructvec[dumpstructidx].data = varaddress; + dumpstructvec[dumpstructidx].desc = desc; + dumpstructidx++; +} + /* Mark reference to a Lisp_Object. If the object referred to has not been seen yet, recursively mark all the references contained in it. */ @@ -3850,32 +3875,8 @@ /* Initialization */ void -init_alloc_once_early (void) +reinit_alloc_once_early (void) { - int iii; - - last_lrecord_type_index_assigned = -1; - for (iii = 0; iii < countof (lrecord_implementations_table); iii++) - { - lrecord_implementations_table[iii] = 0; - } - - /* - * All the staticly - * defined subr lrecords were initialized with lheader->type == 0. - * See subr_lheader_initializer in lisp.h. Force type index 0 to be - * assigned to lrecord_subr so that those predefined indexes match - * reality. - */ - lrecord_type_index (&lrecord_subr); - assert (*(lrecord_subr.lrecord_type_index) == 0); - /* - * The same is true for symbol_value_forward objects, except the - * type is 1. - */ - lrecord_type_index (&lrecord_symbol_value_forward); - assert (*(lrecord_symbol_value_forward.lrecord_type_index) == 1); - gc_generation_number[0] = 0; /* purify_flag 1 is correct even if CANNOT_DUMP. * loadup.el will set to nil at end. */ @@ -3905,8 +3906,9 @@ init_event_alloc (); ignore_malloc_warnings = 0; - staticidx = 0; + staticidx_nodump = 0; + dumpstructidx = 0; consing_since_gc = 0; #if 1 gc_cons_threshold = 500000; /* XEmacs change */ @@ -3935,6 +3937,38 @@ #endif /* ERROR_CHECK_TYPECHECK */ } +void +init_alloc_once_early (void) +{ + int iii; + + reinit_alloc_once_early (); + + last_lrecord_type_index_assigned = -1; + for (iii = 0; iii < countof (lrecord_implementations_table); iii++) + { + lrecord_implementations_table[iii] = 0; + } + + /* + * All the staticly + * defined subr lrecords were initialized with lheader->type == 0. + * See subr_lheader_initializer in lisp.h. Force type index 0 to be + * assigned to lrecord_subr so that those predefined indexes match + * reality. + */ + lrecord_type_index (&lrecord_subr); + assert (*(lrecord_subr.lrecord_type_index) == 0); + /* + * The same is true for symbol_value_forward objects, except the + * type is 1. + */ + lrecord_type_index (&lrecord_symbol_value_forward); + assert (*(lrecord_symbol_value_forward.lrecord_type_index) == 1); + + staticidx = 0; +} + int pure_bytes_used = 0; void @@ -4063,8 +4097,36 @@ #ifdef PDUMP + +/* The structure of the file + * + * 0 - header + * 256 - dumped objects + * stab_offset - nb_staticpro*(Lisp_Object *) from staticvec + * - nb_staticpro*(relocated Lisp_Object) pointed to by staticpro + * - nb_structdmp*pair(void *, adr) for pointers to structures + * - lrecord_implementations_table[] + * - relocation table + */ +typedef struct +{ + char signature[8]; + EMACS_UINT stab_offset; + EMACS_UINT reloc_address; + int nb_staticpro; + int nb_structdmp; +} dump_header; -static const unsigned char align_table[256] = { +typedef struct +{ + const struct lrecord_description *desc; + int count; +} reloc_table; + +static char *pdump_reload; + +static const unsigned char align_table[256] = +{ 8, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, @@ -4083,24 +4145,30 @@ 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 }; -typedef struct { +typedef struct pdump_entry_list_elmt +{ + struct pdump_entry_list_elmt *next, *hash_next; const void *obj; size_t size; + int is_lrecord; + EMACS_INT save_offset; } pdump_entry_list_elmt; -typedef struct { +typedef struct +{ pdump_entry_list_elmt *list; - int count; - int size; int align; + int count; } pdump_entry_list; -typedef struct { +typedef struct pdump_struct_list_elmt +{ pdump_entry_list list; const struct struct_description *sdesc; } pdump_struct_list_elmt; -typedef struct { +typedef struct +{ pdump_struct_list_elmt *list; int count; int size; @@ -4111,54 +4179,86 @@ static pdump_struct_list pdump_struct_table; static int pdump_alert_undump_object[256]; + +static unsigned long cur_offset; +static size_t max_size; +static int pdump_fd; +static void *pdump_buf; + +#define PDUMP_HASHSIZE 100001 -static int pdump_has_entry(pdump_entry_list *list, const void *obj) +static pdump_entry_list_elmt **pdump_hash; + +static int +pdump_make_hash (const void *obj) { - int i; - for(i=0;icount;i++) - if(list->list[i].obj == obj) - return 1; + return (unsigned long)(obj) % PDUMP_HASHSIZE; +} + +static pdump_entry_list_elmt * +pdump_get_entry (const void *obj) +{ + pdump_entry_list_elmt *e = pdump_hash[pdump_make_hash(obj)];; + while (e) + { + if (e->obj == obj) + return e; + e = e->hash_next; + } return 0; } -static void pdump_add_entry(pdump_entry_list *list, const void *obj, size_t size) +static void +pdump_add_entry (pdump_entry_list *list, const void *obj, size_t size, int is_lrecord) { - assert (!pdump_has_entry(list, obj)); + pdump_entry_list_elmt *e; + int align; - if(list->size <= list->count) { - if(list->size == -1) - list->size = 10; - else - list->size = list->size * 2; - list->list = xrealloc(list->list, list->size*sizeof(pdump_entry_list_elmt)); - } - list->list[list->count].obj = obj; - list->list[list->count].size = size; - if(align_table[size & 255] < list->align) - list->align = align_table[size & 255]; + if (pdump_get_entry(obj)) + return; + + e = malloc (sizeof (pdump_entry_list_elmt)); + + e->next = list->list; + e->hash_next = pdump_hash[pdump_make_hash (obj)]; + e->obj = obj; + e->size = size; + e->is_lrecord = is_lrecord; + + list->list = e; list->count++; + pdump_hash[pdump_make_hash (obj)] = e; + + align = align_table[size & 255]; + if (align<2 && is_lrecord) + align = 2; + + if(align < list->align) + list->align = align; } -static pdump_entry_list *pdump_get_entry_list(const struct struct_description *sdesc) +static pdump_entry_list * +pdump_get_entry_list(const struct struct_description *sdesc) { int i; - for(i=0;iname, - backtrace[i].position, - backtrace[i].offset); + fprintf (stderr, "pdump backtrace :\n"); + for (i=0;iname, + backtrace[i].position, + backtrace[i].offset); + } } - } } static void pdump_register_object (Lisp_Object obj); static void pdump_register_struct (const void *data, const struct struct_description *sdesc); -static EMACS_INT pdump_get_indirect_count(EMACS_INT code, const struct lrecord_description *idesc, const void *idata) +static EMACS_INT +pdump_get_indirect_count (EMACS_INT code, const struct lrecord_description *idesc, const void *idata) { EMACS_INT count; const void *irdata; - int line = XD_INDIRECT_VAL(code); - int delta = XD_INDIRECT_DELTA(code); + int line = XD_INDIRECT_VAL (code); + int delta = XD_INDIRECT_DELTA (code); - if(XD_INDIRECT_TYPE_PARENT(code)) - abort(); + if (XD_INDIRECT_TYPE_PARENT (code)) + abort (); irdata = ((char *)idata) + idesc[line].offset; - switch(idesc[line].type) { + switch (idesc[line].type) { case XD_SIZE_T: count = *(size_t *)irdata; break; @@ -4216,164 +4318,447 @@ count = *(Bytecount *)irdata; break; default: - fprintf(stderr, "Unsupported count type : %d (line = %d, code=%ld)\n", idesc[line].type, line, (long)code); - pdump_backtrace(); - abort(); + fprintf (stderr, "Unsupported count type : %d (line = %d, code=%ld)\n", idesc[line].type, line, (long)code); + pdump_backtrace (); + abort (); } count += delta; return count; } -static void pdump_register_sub (const void *data, const struct lrecord_description *desc, int me) +static void +pdump_register_sub (const void *data, const struct lrecord_description *desc, int me) { int pos; const void *rdata; restart: - for(pos = 0; desc[pos].type != XD_END; pos++) { + for (pos = 0; desc[pos].type != XD_END; pos++) + { + backtrace[me].position = pos; + backtrace[me].offset = desc[pos].offset; + + rdata = ((const char *)data) + desc[pos].offset; + switch(desc[pos].type) + { + case XD_SPECIFIER_END: + pos = 0; + desc = ((const struct Lisp_Specifier *)data)->methods->extra_description; + goto restart; + case XD_SIZE_T: + case XD_INT: + case XD_LONG: + case XD_BYTECOUNT: + case XD_LO_RESET_NIL: + case XD_DUMP_FLAG: + break; + case XD_OPAQUE_DATA_PTR: + { + EMACS_INT count = desc[pos].data1; + if (XD_IS_INDIRECT(count)) + count = pdump_get_indirect_count (count, desc, data); + + pdump_add_entry (&pdump_opaque_data_list, + *(void **)rdata, + count, + 0); + break; + } + case XD_C_STRING: + { + const char *str = *(const char **)rdata; + if (str) + pdump_add_entry (&pdump_opaque_data_list, str, strlen (str)+1, 0); + break; + } + case XD_DOC_STRING: + { + const char *str = *(const char **)rdata; + if ((EMACS_INT)str > 0) + pdump_add_entry (&pdump_opaque_data_list, str, strlen (str)+1, 0); + break; + } + case XD_LISP_OBJECT: + { + EMACS_INT count = desc[pos].data1; + int i; + if (XD_IS_INDIRECT (count)) + count = pdump_get_indirect_count (count, desc, data); + + for(i=0;isize; + } + } + break; + } + default: + fprintf (stderr, "Unsupported dump type : %d\n", desc[pos].type); + pdump_backtrace (); + abort (); + }; + } +} + +static void +pdump_register_object (Lisp_Object obj) +{ + if (!obj || + !POINTER_TYPE_P (XGCTYPE (obj)) || + pdump_get_entry (XRECORD_LHEADER (obj))) + return; + + if (XRECORD_LHEADER_IMPLEMENTATION (obj)->description) + { + int me = depth++; + if (me>65536) + { + fprintf (stderr, "Backtrace overflow, loop ?\n"); + abort (); + } + backtrace[me].obj = obj; + backtrace[me].position = 0; + backtrace[me].offset = 0; + + pdump_add_entry (pdump_object_table + XRECORD_LHEADER (obj)->type, + XRECORD_LHEADER (obj), + XRECORD_LHEADER_IMPLEMENTATION (obj)->static_size ? + XRECORD_LHEADER_IMPLEMENTATION (obj)->static_size : + XRECORD_LHEADER_IMPLEMENTATION (obj)->size_in_bytes_method (XRECORD_LHEADER (obj)), + 1); + pdump_register_sub (XRECORD_LHEADER (obj), + XRECORD_LHEADER_IMPLEMENTATION (obj)->description, + me); + --depth; + } + else + { + pdump_alert_undump_object[XRECORD_LHEADER (obj)->type]++; + fprintf (stderr, "Undumpable object type : %s\n", XRECORD_LHEADER_IMPLEMENTATION (obj)->name); + pdump_backtrace (); + } +} - backtrace[me].position = pos; - backtrace[me].offset = desc[pos].offset; +static void +pdump_register_struct (const void *data, const struct struct_description *sdesc) +{ + if (data && !pdump_get_entry (data)) + { + int me = depth++; + if (me>65536) + { + fprintf (stderr, "Backtrace overflow, loop ?\n"); + abort (); + } + backtrace[me].obj = 0; + backtrace[me].position = 0; + backtrace[me].offset = 0; + + pdump_add_entry (pdump_get_entry_list (sdesc), + data, + sdesc->size, + 0); + pdump_register_sub (data, + sdesc->description, + me); + --depth; + } +} - rdata = ((const char *)data) + desc[pos].offset; - switch(desc[pos].type) { - case XD_SPECIFIER_END: - pos = 0; - desc = ((const struct Lisp_Specifier *)data)->methods->extra_description; - goto restart; - case XD_SIZE_T: - case XD_INT: - case XD_LONG: - case XD_BYTECOUNT: - case XD_LO_RESET_NIL: - break; - case XD_OPAQUE_DATA_PTR: { - EMACS_INT count = desc[pos].data1; - if(XD_IS_INDIRECT(count)) - count = pdump_get_indirect_count(count, desc, data); - - pdump_add_entry(&pdump_opaque_data_list, - *(void **)rdata, - count); - break; - } - case XD_C_STRING: { - const char *str = *(const char **)rdata; - if(str) - pdump_add_entry(&pdump_opaque_data_list, str, strlen(str)+1); - break; - } - case XD_DOC_STRING: { - const char *str = *(const char **)rdata; - if((EMACS_INT)str > 0) - pdump_add_entry(&pdump_opaque_data_list, str, strlen(str)+1); - break; - } - case XD_LISP_OBJECT: { - EMACS_INT count = desc[pos].data1; - int i; - if(XD_IS_INDIRECT(count)) - count = pdump_get_indirect_count(count, desc, data); - - for(i=0;isize; + if (desc) + { + int pos; + void *rdata; + memcpy (pdump_buf, elmt->obj, size); - backtrace[me].offset = (const char *)pobj - (const char *)data; - pdump_register_object(dobj); + restart: + for (pos = 0; desc[pos].type != XD_END; pos++) + { + rdata = ((char *)pdump_buf) + desc[pos].offset; + switch (desc[pos].type) + { + case XD_SPECIFIER_END: + pos = 0; + desc = ((const struct Lisp_Specifier *)(elmt->obj))->methods->extra_description; + goto restart; + case XD_SIZE_T: + case XD_INT: + case XD_LONG: + case XD_BYTECOUNT: + break; + case XD_LO_RESET_NIL: + *(EMACS_INT *)rdata = pdump_get_entry (XRECORD_LHEADER (Qnil))->save_offset; + break; + case XD_DUMP_FLAG: + *(int *)rdata = -1; + break; + case XD_OPAQUE_DATA_PTR: + case XD_C_STRING: + case XD_STRUCT_PTR: { + void *ptr = *(void **)rdata; + if (ptr) + *(EMACS_INT *)rdata = pdump_get_entry (ptr)->save_offset; + break; + } + case XD_LISP_OBJECT: { + EMACS_INT count = desc[pos].data1; + int i; + if (XD_IS_INDIRECT (count)) + count = pdump_get_indirect_count (count, desc, elmt->obj); + + for(i=0; isave_offset; + } + break; + } + case XD_DOC_STRING: { + EMACS_INT str = *(EMACS_INT *)rdata; + if (str > 0) + *(EMACS_INT *)rdata = pdump_get_entry ((void *)str)->save_offset; + break; + } + default: + fprintf (stderr, "Unsupported dump type : %d\n", desc[pos].type); + abort (); + }; + } + if (elmt->is_lrecord) { + ((struct lrecord_header *)pdump_buf)->dumped = 1; + ((struct lrecord_header *)pdump_buf)->data_dumped = 1; } - break; } - case XD_STRUCT_PTR: { - EMACS_INT count = desc[pos].data1; - const struct struct_description *sdesc = desc[pos].data2; - const char *dobj = *(const char **)rdata; - if(dobj) { - int i; - if(XD_IS_INDIRECT(count)) - count = pdump_get_indirect_count(count, desc, data); + write (pdump_fd, desc ? pdump_buf : elmt->obj, size); + if (elmt->is_lrecord && (size & 3)) + write (pdump_fd, "\0\0\0", 4-(size & 3)); +} + +static void +pdump_reloc_one (void *data, EMACS_INT delta, const struct lrecord_description *desc) +{ + int pos; + void *rdata; - for(i=0;isize; + restart: + for (pos = 0; desc[pos].type != XD_END; pos++) + { + rdata = ((char *)data) + desc[pos].offset; + switch (desc[pos].type) { + case XD_SPECIFIER_END: + pos = 0; + desc = ((const struct Lisp_Specifier *)data)->methods->extra_description; + goto restart; + case XD_SIZE_T: + case XD_INT: + case XD_LONG: + case XD_BYTECOUNT: + case XD_DUMP_FLAG: + break; + case XD_LO_RESET_NIL: + case XD_OPAQUE_DATA_PTR: + case XD_C_STRING: + case XD_STRUCT_PTR: + { + EMACS_INT ptr = *(EMACS_INT *)rdata; + if (ptr) + *(EMACS_INT *)rdata = ptr+delta; + break; } - } - break; + case XD_LISP_OBJECT: + { + EMACS_INT count = desc[pos].data1; + int i; + if (XD_IS_INDIRECT (count)) + count = pdump_get_indirect_count (count, desc, data); + + for (i=0; i 0) + *(EMACS_INT *)rdata = str + delta; + break; + } + default: + fprintf (stderr, "Unsupported dump type : %d\n", desc[pos].type); + abort (); + }; } - default: - fprintf(stderr, "Unsupported dump type : %d\n", desc[pos].type); - pdump_backtrace(); - abort(); - }; - } } -static void pdump_register_object (Lisp_Object obj) +static void +pdump_allocate_offset (pdump_entry_list_elmt *elmt, const struct lrecord_description *desc) { - if(!obj || - !POINTER_TYPE_P(XGCTYPE(obj)) || - pdump_has_entry(pdump_object_table + XRECORD_LHEADER(obj)->type, - XRECORD_LHEADER(obj))) - return; + size_t size = elmt->is_lrecord ? (elmt->size + 3) & ~3 : elmt->size; + elmt->save_offset = cur_offset; + if (size>max_size) + max_size = size; + cur_offset += size; +} - counter++; - if(!(counter % 100)) { - printf("1. Enumerating data %d\r", counter); - fflush(stdout); - } - - if(XRECORD_LHEADER_IMPLEMENTATION(obj)->description) { - int me = depth++; - if(me>65536) { - fprintf(stderr, "Backtrace overflow, loop ?\n"); - abort(); - } - backtrace[me].obj = obj; - backtrace[me].position = 0; - backtrace[me].offset = 0; - - pdump_add_entry(pdump_object_table + XRECORD_LHEADER(obj)->type, - XRECORD_LHEADER(obj), - XRECORD_LHEADER_IMPLEMENTATION(obj)->static_size ? - XRECORD_LHEADER_IMPLEMENTATION(obj)->static_size : - XRECORD_LHEADER_IMPLEMENTATION(obj)->size_in_bytes_method(XRECORD_LHEADER(obj))); - pdump_register_sub(XRECORD_LHEADER(obj), - XRECORD_LHEADER_IMPLEMENTATION(obj)->description, - me); - --depth; - } else { - pdump_alert_undump_object[XRECORD_LHEADER(obj)->type]++; - fprintf(stderr, "Undumpable object type : %s\n", XRECORD_LHEADER_IMPLEMENTATION(obj)->name); - pdump_backtrace(); +static void +pdump_scan_by_alignement (void (*f)(pdump_entry_list_elmt *, const struct lrecord_description *)) +{ + int align, i; + const struct lrecord_description *idesc; + pdump_entry_list_elmt *elmt; + for (align=8; align>=0; align--) + { + for (i=0; i<256; i++) + if (pdump_object_table[i].align == align) + { + elmt = pdump_object_table[i].list; + if (!elmt) + continue; + idesc = lrecord_implementations_table[i]->description; + while (elmt) + { + f (elmt, idesc); + elmt = elmt->next; + } + } + + for (i=0; idescription; + while (elmt) + { + f (elmt, idesc); + elmt = elmt->next; + } + } + + elmt = pdump_opaque_data_list.list; + while (elmt) + { + if (align_table[elmt->size & 255] == align) + f (elmt, 0); + elmt = elmt->next; + } + } +} + +static void +pdump_dump_staticvec (void) +{ + Lisp_Object *reloc = malloc (staticidx*sizeof (Lisp_Object)); + int i; + write (pdump_fd, staticvec, staticidx*sizeof (Lisp_Object *)); + + for(i=0; isave_offset; + else + reloc[i] = obj; + } + write (pdump_fd, reloc, staticidx*sizeof (Lisp_Object)); + free (reloc); +} + +static void +pdump_dump_structvec (void) +{ + int i; + for (i=0; isave_offset; + write (pdump_fd, &adr, sizeof (adr)); } } -static void pdump_register_struct (const void *data, const struct struct_description *sdesc) +static void +pdump_dump_itable (void) { - if(data && !pdump_has_entry(pdump_get_entry_list(sdesc), data)) { - int me = depth++; - if(me>65536) { - fprintf(stderr, "Backtrace overflow, loop ?\n"); - abort(); - } - backtrace[me].obj = 0; - backtrace[me].position = 0; - backtrace[me].offset = 0; - - pdump_add_entry(pdump_get_entry_list(sdesc), - data, - sdesc->size); - pdump_register_sub(data, - sdesc->description, - me); - --depth; + write (pdump_fd, lrecord_implementations_table, sizeof (lrecord_implementations_table)); +} + +static void +pdump_dump_rtables (void) +{ + int i; + pdump_entry_list_elmt *elmt; + reloc_table rt; + + for (i=0; i<256; i++) { + elmt = pdump_object_table[i].list; + if(!elmt) + continue; + rt.desc = lrecord_implementations_table[i]->description; + rt.count = pdump_object_table[i].count; + write (pdump_fd, &rt, sizeof (rt)); + while (elmt) + { + EMACS_INT rdata = pdump_get_entry (XRECORD_LHEADER (elmt->obj))->save_offset; + write (pdump_fd, &rdata, sizeof (rdata)); + elmt = elmt->next; + } } + + for (i=0; idescription; + rt.count = pdump_struct_table.list[i].list.count; + write (pdump_fd, &rt, sizeof (rt)); + while (elmt) + { + EMACS_INT rdata = pdump_get_entry (XRECORD_LHEADER (elmt->obj))->save_offset; + write (pdump_fd, &rdata, sizeof (rdata)); + elmt = elmt->next; + } + } + rt.desc = 0; + rt.count = 0; + write (pdump_fd, &rt, sizeof (rt)); } -void pdump (void) +void +pdump (void) { int i; Lisp_Object t_console, t_device, t_frame; + int none; + dump_header hd; + t_console = Vterminal_console; t_frame = Vterminal_frame; t_device = Vterminal_device; @@ -4382,36 +4767,164 @@ Vterminal_frame = Qnil; Vterminal_device = Qnil; - for(i=0;i<256;i++) { - pdump_object_table[i].list = 0; - pdump_object_table[i].count = 0; - pdump_object_table[i].size = -1; - pdump_object_table[i].align = 8; - pdump_alert_undump_object[i] = 0; - } - pdump_struct_table.list = 0; + pdump_hash = malloc (PDUMP_HASHSIZE*sizeof (pdump_entry_list_elmt *)); + memset (pdump_hash, 0, PDUMP_HASHSIZE*sizeof (pdump_entry_list_elmt *)); + + for (i=0; i<256; i++) + { + pdump_object_table[i].list = 0; + pdump_object_table[i].align = 8; + pdump_object_table[i].count = 0; + pdump_alert_undump_object[i] = 0; + } pdump_struct_table.count = 0; pdump_struct_table.size = -1; - + pdump_opaque_data_list.list = 0; - pdump_opaque_data_list.count = 0; - pdump_opaque_data_list.size = -1; pdump_opaque_data_list.align = 8; + pdump_opaque_data_list.count = 0; depth = 0; - for(i=0; iname, pdump_alert_undump_object[i]); + if (pdump_alert_undump_object[i]) + { + if (none) + printf ("Undumpable types list :\n"); + none = 0; + printf (" - %s (%d)\n", lrecord_implementations_table[i]->name, pdump_alert_undump_object[i]); + } + if (!none) + return; + + for (i=0; inb_staticpro; + delta = ((EMACS_INT)pdump_reload) - ((dump_header *)pdump_reload)->reloc_address; + p = pdump_reload + ((dump_header *)pdump_reload)->stab_offset; + + /* Put back the staticvec in place */ + memcpy (staticvec, p, staticidx*sizeof (Lisp_Object *)); + p += staticidx*sizeof (Lisp_Object); + for (i=0; inb_structdmp; i++) + { + void **adr = *(void **)p; + p += sizeof (void *); + *adr = (void *)((*(EMACS_INT *)p) + delta); + p += sizeof (EMACS_INT); + } + + /* Put back the lrecord_implementations_table */ + memcpy (lrecord_implementations_table, p, sizeof (lrecord_implementations_table)); + p += sizeof (lrecord_implementations_table); + + /* Give back their numbers to the lrecord implementations */ + for (i=0; ilrecord_type_index) = i; + last_lrecord_type_index_assigned = i; + } + + /* Do the relocations */ + for(;;) + { + reloc_table *rt = (reloc_table *)p; + p += sizeof (reloc_table); + if (!rt->desc) + break; + for (i=0; icount; i++) + { + pdump_reloc_one ((void *)((*((EMACS_INT *)p)) + delta), delta, rt->desc); + p += sizeof (EMACS_INT); + } + } + + /* Rewire Qnil */ + Qnil = Vterminal_console; + return 1; } #endif Index: src/buffer.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/buffer.c,v retrieving revision 1.36.2.12 diff -u -r1.36.2.12 buffer.c --- buffer.c 1999/09/23 07:39:44 1.36.2.12 +++ buffer.c 1999/09/29 17:10:02 @@ -1872,21 +1872,27 @@ "Attempt to modify a protected field", Qerror); } +void +reinit_vars_of_buffer (void) +{ + staticpro_nodump (&Vbuffer_alist); + Vbuffer_alist = Qnil; + current_buffer = 0; +} + /* initialize the buffer routines */ void vars_of_buffer (void) { /* This function can GC */ + reinit_vars_of_buffer (); + staticpro (&QSFundamental); staticpro (&QSscratch); - staticpro_nodump (&Vbuffer_alist); QSFundamental = Fpurecopy (build_string ("Fundamental")); QSscratch = Fpurecopy (build_string (DEFER_GETTEXT ("*scratch*"))); - Vbuffer_alist = Qnil; - current_buffer = 0; - DEFVAR_LISP ("change-major-mode-hook", &Vchange_major_mode_hook /* List of hooks to be run before killing local variables in a buffer. This should be used by any mode that temporarily alters the contents or @@ -2071,7 +2077,7 @@ } void -complex_vars_of_buffer (void) +reinit_complex_vars_of_buffer (void) { /* Make sure all markable slots in buffer_defaults are initialized reasonably, so mark_buffer won't choke. */ @@ -2195,10 +2201,16 @@ buffer_local_flags.buffer_file_coding_system = make_int (1<<14); #endif - /* #### Warning: 1<<28 is the largest number currently allowable + /* #### Warning: 1<<31 is the largest number currently allowable due to the XINT() handling of this value. With some rearrangement you can get 3 more bits. */ } +} + +void +complex_vars_of_buffer (void) +{ + reinit_complex_vars_of_buffer (); DEFVAR_BUFFER_DEFAULTS ("default-modeline-format", modeline_format /* Default value of `modeline-format' for buffers that don't override it. Index: src/console-msw.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/console-msw.c,v retrieving revision 1.4.2.2 diff -u -r1.4.2.2 console-msw.c --- console-msw.c 1998/12/14 12:25:50 1.4.2.2 +++ console-msw.c 1999/09/29 17:10:02 @@ -70,6 +70,12 @@ } void +reinit_console_type_create_mswindows (void) +{ + REINITIALIZE_CONSOLE_TYPE (mswindows); +} + +void vars_of_console_mswindows (void) { Fprovide (Qmswindows); Index: src/console-stream.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/console-stream.c,v retrieving revision 1.11.2.2 diff -u -r1.11.2.2 console-stream.c --- console-stream.c 1999/03/07 15:25:17 1.11.2.2 +++ console-stream.c 1999/09/29 17:10:02 @@ -298,6 +298,12 @@ } void +reinit_console_type_create_stream (void) +{ + REINITIALIZE_CONSOLE_TYPE (stream); +} + +void vars_of_console_stream (void) { DEFVAR_LISP ("terminal-console", &Vterminal_console /* @@ -324,12 +330,15 @@ init_console_stream (void) { /* This function can GC */ +#ifndef PDUMP if (!initialized) { +#endif Vterminal_device = Fmake_device (Qstream, Qnil, Qnil); Vterminal_console = Fdevice_console (Vterminal_device); Vterminal_frame = Fmake_frame (Qnil, Vterminal_device); minibuf_window = XFRAME (Vterminal_frame)->minibuffer_window; +#ifndef PDUMP } else { @@ -338,4 +347,5 @@ if (noninteractive) event_stream_select_console (XCONSOLE (Vterminal_console)); } +#endif } Index: src/console-tty.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/console-tty.c,v retrieving revision 1.18.2.3 diff -u -r1.18.2.3 console-tty.c --- console-tty.c 1999/07/05 07:28:21 1.18.2.3 +++ console-tty.c 1999/09/29 17:10:02 @@ -372,6 +372,12 @@ } void +reinit_console_type_create_tty (void) +{ + REINITIALIZE_CONSOLE_TYPE (tty); +} + +void image_instantiator_format_create_glyphs_tty (void) { IIFORMAT_VALID_CONSOLE (tty, nothing); Index: src/console-x.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/console-x.c,v retrieving revision 1.3.2.1 diff -u -r1.3.2.1 console-x.c --- console-x.c 1998/12/05 16:55:25 1.3.2.1 +++ console-x.c 1999/09/29 17:10:02 @@ -280,3 +280,9 @@ CONSOLE_HAS_METHOD (x, initially_selected_for_input); } + +void +reinit_console_type_create_x (void) +{ + REINITIALIZE_CONSOLE_TYPE (x); +} Index: src/console.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/console.c,v retrieving revision 1.17.2.7 diff -u -r1.17.2.7 console.c --- console.c 1999/09/23 07:39:45 1.17.2.7 +++ console.c 1999/09/29 17:10:03 @@ -69,7 +69,7 @@ consoles. If a slot is -1, then there is a DEFVAR_CONSOLE_LOCAL for it - as well as a default value which is used to initialize newly-created + as well as a default value which is used to initialize newly-created consoles and as a reset-value when local-vars are killed. If a slot is -2, there is no DEFVAR_CONSOLE_LOCAL for it. @@ -1096,10 +1096,43 @@ defsymbol (&Qsuspend_resume_hook, "suspend-resume-hook"); } +static const struct lrecord_description cte_description_1[] = { + { XD_LISP_OBJECT, offsetof(console_type_entry, symbol), 1 }, + { XD_STRUCT_PTR, offsetof(console_type_entry, meths), 1, &console_methods_description }, + { XD_END } +}; + +static const struct struct_description cte_description = { + sizeof(console_type_entry), + cte_description_1 +}; + +static const struct lrecord_description cted_description_1[] = { + XD_DYNARR_DESC(console_type_entry_dynarr, &cte_description), + { XD_END } +}; + +static const struct struct_description cted_description = { + sizeof(console_type_entry_dynarr), + cted_description_1 +}; + +static const struct lrecord_description console_methods_description_1[] = { + { XD_LISP_OBJECT, offsetof(struct console_methods, symbol), 2 }, + { XD_END } +}; + +const struct struct_description console_methods_description = { + sizeof(struct console_methods), + console_methods_description_1 +}; + + void console_type_create (void) { the_console_type_entry_dynarr = Dynarr_new (console_type_entry); + dumpstruct(&the_console_type_entry_dynarr, &cted_description); Vconsole_type_list = Qnil; staticpro (&Vconsole_type_list); @@ -1114,8 +1147,19 @@ } void +reinit_vars_of_console (void) +{ + staticpro_nodump (&Vconsole_list); + Vconsole_list = Qnil; + staticpro_nodump (&Vselected_console); + Vselected_console = Qnil; +} + +void vars_of_console (void) { + reinit_vars_of_console (); + DEFVAR_LISP ("create-console-hook", &Vcreate_console_hook /* Function or functions to call when a console is created. One argument, the newly-created console. @@ -1131,11 +1175,6 @@ */ ); Vdelete_console_hook = Qnil; - staticpro_nodump (&Vconsole_list); - Vconsole_list = Qnil; - staticpro_nodump (&Vselected_console); - Vselected_console = Qnil; - #ifdef HAVE_WINDOW_SYSTEM Fprovide (intern ("window-system")); #endif @@ -1190,7 +1229,7 @@ } void -complex_vars_of_console (void) +reinit_complex_vars_of_console (void) { /* Make sure all markable slots in console_defaults are initialized reasonably, so mark_console won't choke. @@ -1254,6 +1293,12 @@ currently allowable due to the XINT() handling of this value. With some rearrangement you can get 4 more bits. */ } +} + +void +complex_vars_of_console (void) +{ + reinit_complex_vars_of_console (); DEFVAR_CONSOLE_DEFAULTS ("default-function-key-map", function_key_map /* Default value of `function-key-map' for consoles that don't override it. Index: src/console.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/console.h,v retrieving revision 1.22.2.11 diff -u -r1.22.2.11 console.h --- console.h 1999/09/16 16:56:48 1.22.2.11 +++ console.h 1999/09/29 17:10:03 @@ -60,6 +60,8 @@ DM_slow_device, DM_security }; +extern const struct struct_description console_methods_description; + struct console_methods { CONST char *name; /* Used by print_console, print_device, print_frame */ @@ -356,11 +358,18 @@ type##_console_methods = xnew_and_zero (struct console_methods); \ type##_console_methods->name = obj_name; \ type##_console_methods->symbol = Q##type; \ - defsymbol (&type##_console_methods->predicate_symbol, pred_sym); \ + defsymbol_nodump (&type##_console_methods->predicate_symbol, pred_sym); \ add_entry_to_console_type_list (Q##type, type##_console_methods); \ type##_console_methods->image_conversion_list = Qnil; \ - staticpro (&type##_console_methods->image_conversion_list); \ + staticpro_nodump (&type##_console_methods->image_conversion_list); \ + dumpstruct (&type##_console_methods, &console_methods_description); \ +} while (0) + +#define REINITIALIZE_CONSOLE_TYPE(type) do { \ + staticpro_nodump (&type##_console_methods->predicate_symbol); \ + staticpro_nodump (&type##_console_methods->image_conversion_list); \ } while (0) + /* Declare that console-type TYPE has method M; used in initialization routines */ Index: src/device.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/device.c,v retrieving revision 1.15.2.7 diff -u -r1.15.2.7 device.c --- device.c 1999/09/14 06:50:57 1.15.2.7 +++ device.c 1999/09/29 17:10:03 @@ -1297,8 +1297,18 @@ } void +reinit_vars_of_device (void) +{ + staticpro_nodump (&Vdefault_device); + Vdefault_device = Qnil; + asynch_device_change_pending = 0; +} + +void vars_of_device (void) { + reinit_vars_of_device (); + DEFVAR_LISP ("create-device-hook", &Vcreate_device_hook /* Function or functions to call when a device is created. One argument, the newly-created device. @@ -1313,11 +1323,6 @@ One argument, the to-be-deleted device. */ ); Vdelete_device_hook = Qnil; - - staticpro_nodump (&Vdefault_device); - Vdefault_device = Qnil; - - asynch_device_change_pending = 0; Vdevice_class_list = list3 (Qcolor, Qgrayscale, Qmono); staticpro (&Vdevice_class_list); Index: src/dynarr.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/dynarr.c,v retrieving revision 1.3.2.1 diff -u -r1.3.2.1 dynarr.c --- dynarr.c 1998/12/05 16:55:33 1.3.2.1 +++ dynarr.c 1999/09/29 17:10:03 @@ -111,6 +111,18 @@ int Dynarr_min_size = 1; +void +Dynarr_realloc (Dynarr *dy, int new_size) +{ + if(dy->dumped & 2) { + void *new_base = malloc(new_size); + memcpy(new_base, dy->base, dy->max > new_size ? new_size : dy->max); + dy->base = new_base; + dy->dumped &= ~2; + } else + dy->base = xrealloc(dy->base, new_size); +} + void * Dynarr_newf (int elsize) { @@ -138,7 +150,7 @@ /* Don't do anything if the array is already big enough. */ if (newsize > dy->max) { - dy->base = xrealloc (dy->base, newsize*dy->elsize); + Dynarr_realloc (dy, newsize*dy->elsize); dy->max = newsize; } } @@ -186,9 +198,10 @@ { Dynarr *dy = (Dynarr *) d; - if (dy->base) + if (dy->base && !(dy->dumped & 2)) xfree (dy->base); - xfree (dy); + if(!(dy->dumped & 1)) + xfree (dy); } #ifdef MEMORY_USAGE_STATS Index: src/emacs.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/emacs.c,v retrieving revision 1.82.2.24 diff -u -r1.82.2.24 emacs.c --- emacs.c 1999/09/28 00:27:00 1.82.2.24 +++ emacs.c 1999/09/29 17:10:04 @@ -855,8 +855,13 @@ We try to do things in an order that minimizes the non-obvious dependencies between functions. */ +#ifdef PDUMP + initialized = restart || pdump_load (); +#endif + if (!initialized) { + /* Initialize things so that new Lisp objects can be created and objects can be staticpro'd. Must be basically the very first thing done @@ -1608,8 +1613,57 @@ garbage_collect_1 (); } #endif +#ifdef PDUMP + } else if (!restart) { + reinit_alloc_once_early (); + reinit_opaque_once_early (); + + reinit_console_type_create_stream (); +#ifdef HAVE_TTY + reinit_console_type_create_tty (); +#endif +#ifdef HAVE_X_WINDOWS + reinit_console_type_create_x (); +#endif +#ifdef HAVE_MS_WINDOWS + reinit_console_type_create_mswindows (); +#endif + + reinit_specifier_type_create (); + reinit_specifier_type_create_image (); + reinit_specifier_type_create_gutter (); + reinit_specifier_type_create_objects (); +#ifdef HAVE_TOOLBARS + reinit_specifier_type_create_toolbar (); +#endif + + reinit_image_instantiator_format_create (); + reinit_image_instantiator_format_create_glyphs_eimage (); + reinit_image_instantiator_format_create_glyphs_widget (); +#ifdef HAVE_X_WINDOWS + reinit_image_instantiator_format_create_glyphs_x (); +#endif /* HAVE_X_WINDOWS */ +#ifdef HAVE_MS_WINDOWS + reinit_image_instantiator_format_create_glyphs_mswindows (); +#endif /* HAVE_MSWINDOWS_WINDOWS */ + + reinit_vars_of_buffer (); + reinit_vars_of_console (); + reinit_vars_of_device (); + reinit_vars_of_eval (); + reinit_vars_of_event_stream (); + reinit_vars_of_lread (); + reinit_vars_of_lstream (); + reinit_vars_of_objects (); + reinit_vars_of_search (); + reinit_vars_of_window (); + + reinit_complex_vars_of_buffer (); + reinit_complex_vars_of_console (); +#endif } + /* CONGRATULATIONS!!! We have successfully initialized the Lisp engine. */ @@ -2521,11 +2575,8 @@ garbage_collect_1 (); #ifdef PDUMP - { - extern void pdump(void); - pdump(); - } -#endif + pdump (); +#else #ifdef DOUG_LEA_MALLOC malloc_state_ptr = malloc_get_state (); @@ -2540,6 +2591,7 @@ #ifdef DOUG_LEA_MALLOC free (malloc_state_ptr); #endif +#endif /* not PDUMP */ } #endif /* not MSDOS and EMX */ Index: src/eval.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/eval.c,v retrieving revision 1.27.2.8 diff -u -r1.27.2.8 eval.c --- eval.c 1999/09/28 00:27:00 1.27.2.8 +++ eval.c 1999/09/29 17:10:05 @@ -5060,8 +5060,28 @@ } void +reinit_vars_of_eval (void) +{ + preparing_for_armageddon = 0; + in_warnings = 0; + Qunbound_suspended_errors_tag = make_opaque_ptr (&Qunbound_suspended_errors_tag); + staticpro_nodump (&Qunbound_suspended_errors_tag); + + specpdl_size = 50; + specpdl = xnew_array (struct specbinding, specpdl_size); + /* XEmacs change: increase these values. */ + max_specpdl_size = 3000; + max_lisp_eval_depth = 500; +#if 0 /* no longer used */ + throw_level = 0; +#endif +} + +void vars_of_eval (void) { + reinit_vars_of_eval (); + DEFVAR_INT ("max-specpdl-size", &max_specpdl_size /* Limit on number of Lisp variable bindings & unwind-protects before error. */ ); @@ -5163,13 +5183,10 @@ */ ); Vdebugger = Qnil; - preparing_for_armageddon = 0; - staticpro (&Vpending_warnings); Vpending_warnings = Qnil; - Vpending_warnings_tail = Qnil; /* no need to protect this */ - - in_warnings = 0; + staticpro (&Vpending_warnings_tail); + Vpending_warnings_tail = Qnil; staticpro (&Vautoload_queue); Vautoload_queue = Qnil; @@ -5181,19 +5198,6 @@ staticpro (&Vcurrent_error_state); Vcurrent_error_state = Qnil; /* errors as normal */ - - Qunbound_suspended_errors_tag = make_opaque_ptr (&Qunbound_suspended_errors_tag); - staticpro_nodump (&Qunbound_suspended_errors_tag); - - specpdl_size = 50; - specpdl_depth_counter = 0; - specpdl = xnew_array (struct specbinding, specpdl_size); - /* XEmacs change: increase these values. */ - max_specpdl_size = 3000; - max_lisp_eval_depth = 500; -#if 0 /* no longer used */ - throw_level = 0; -#endif reinit_eval (); } Index: src/event-stream.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/event-stream.c,v retrieving revision 1.45.2.10 diff -u -r1.45.2.10 event-stream.c --- event-stream.c 1999/09/28 00:26:55 1.45.2.10 +++ event-stream.c 1999/09/29 17:10:06 @@ -4963,22 +4963,36 @@ } void -vars_of_event_stream (void) +reinit_vars_of_event_stream (void) { recent_keys_ring_index = 0; recent_keys_ring_size = 100; + num_input_chars = 0; + Vtimeout_free_list = make_lcrecord_list (sizeof (struct Lisp_Timeout), + &lrecord_timeout); + staticpro_nodump (&Vtimeout_free_list); + the_low_level_timeout_blocktype = + Blocktype_new (struct low_level_timeout_blocktype); + something_happened = 0; + recursive_sit_for = Qnil; +} + +void +vars_of_event_stream (void) +{ + reinit_vars_of_event_stream (); Vrecent_keys_ring = Qnil; staticpro (&Vrecent_keys_ring); Vthis_command_keys = Qnil; staticpro (&Vthis_command_keys); Vthis_command_keys_tail = Qnil; + staticpro (&Vthis_command_keys_tail); - num_input_chars = 0; - command_event_queue = Qnil; staticpro (&command_event_queue); command_event_queue_tail = Qnil; + staticpro (&command_event_queue_tail); Vlast_selected_frame = Qnil; staticpro (&Vlast_selected_frame); @@ -4989,19 +5003,8 @@ pending_async_timeout_list = Qnil; staticpro (&pending_async_timeout_list); - Vtimeout_free_list = make_lcrecord_list (sizeof (struct Lisp_Timeout), - &lrecord_timeout); - staticpro_nodump (&Vtimeout_free_list); - - the_low_level_timeout_blocktype = - Blocktype_new (struct low_level_timeout_blocktype); - - something_happened = 0; - last_point_position_buffer = Qnil; staticpro (&last_point_position_buffer); - - recursive_sit_for = Qnil; DEFVAR_LISP ("echo-keystrokes", &Vecho_keystrokes /* *Nonzero means echo unfinished commands after this many seconds of pause. Index: src/glyphs-eimage.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-eimage.c,v retrieving revision 1.3.2.5 diff -u -r1.3.2.5 glyphs-eimage.c --- glyphs-eimage.c 1999/01/18 22:00:18 1.3.2.5 +++ glyphs-eimage.c 1999/09/29 17:10:06 @@ -1343,6 +1343,23 @@ } void +reinit_image_instantiator_format_create_glyphs_eimage (void) +{ +#ifdef HAVE_JPEG + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (jpeg); +#endif +#ifdef HAVE_GIF + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (gif); +#endif +#ifdef HAVE_PNG + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (png); +#endif +#ifdef HAVE_TIFF + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tiff); +#endif +} + +void vars_of_glyphs_eimage (void) { #ifdef HAVE_JPEG Index: src/glyphs-msw.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-msw.c,v retrieving revision 1.21.2.24 diff -u -r1.21.2.24 glyphs-msw.c --- glyphs-msw.c 1999/09/20 10:48:29 1.21.2.24 +++ glyphs-msw.c 1999/09/29 17:10:07 @@ -2940,6 +2940,13 @@ } void +reinit_image_instantiator_format_create_glyphs_mswindows (void) +{ + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (bmp); + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (mswindows_resource); +} + +void vars_of_glyphs_mswindows (void) { DEFVAR_LISP ("mswindows-bitmap-file-path", &Vmswindows_bitmap_file_path /* Index: src/glyphs-widget.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/Attic/glyphs-widget.c,v retrieving revision 1.1.2.13 diff -u -r1.1.2.13 glyphs-widget.c --- glyphs-widget.c 1999/09/23 05:57:02 1.1.2.13 +++ glyphs-widget.c 1999/09/29 17:10:07 @@ -910,6 +910,21 @@ check_valid_glyph_or_instantiator_list); } + +void +reinit_image_instantiator_format_create_glyphs_widget (void) +{ + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (button); + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit_field); + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo_box); + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (scrollbar); + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge); + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree_view); + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab_control); + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label); + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (layout); +} + void vars_of_glyphs_widget (void) { Index: src/glyphs-x.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-x.c,v retrieving revision 1.49.2.30 diff -u -r1.49.2.30 glyphs-x.c --- glyphs-x.c 1999/09/28 00:42:57 1.49.2.30 +++ glyphs-x.c 1999/09/29 17:10:08 @@ -2797,6 +2797,14 @@ } void +reinit_image_instantiator_format_create_glyphs_x (void) +{ + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (cursor_font); + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (font); + REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT (autodetect); +} + +void vars_of_glyphs_x (void) { DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path /* Index: src/glyphs.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs.c,v retrieving revision 1.23.2.28 diff -u -r1.23.2.28 glyphs.c --- glyphs.c 1999/09/23 07:39:59 1.23.2.28 +++ glyphs.c 1999/09/29 17:10:08 @@ -4339,6 +4339,43 @@ } void +reinit_specifier_type_create_image (void) +{ + REINITIALIZE_SPECIFIER_TYPE (image); +} + +static const struct lrecord_description iife_description_1[] = { + { XD_LISP_OBJECT, offsetof(image_instantiator_format_entry, symbol), 2 }, + { XD_STRUCT_PTR, offsetof(image_instantiator_format_entry, meths), 1, &iim_description }, + { XD_END } +}; + +static const struct struct_description iife_description = { + sizeof(image_instantiator_format_entry), + iife_description_1 +}; + +static const struct lrecord_description iifed_description_1[] = { + XD_DYNARR_DESC(image_instantiator_format_entry_dynarr, &iife_description), + { XD_END } +}; + +static const struct struct_description iifed_description = { + sizeof(image_instantiator_format_entry_dynarr), + iifed_description_1 +}; + +static const struct lrecord_description iim_description_1[] = { + { XD_LISP_OBJECT, offsetof(struct image_instantiator_methods, symbol), 2 }, + { XD_END } +}; + +const struct struct_description iim_description = { + sizeof(struct image_instantiator_methods), + iim_description_1 +}; + +void image_instantiator_format_create (void) { /* image instantiators */ @@ -4349,6 +4386,8 @@ Vimage_instantiator_format_list = Qnil; staticpro (&Vimage_instantiator_format_list); + dumpstruct (&the_image_instantiator_format_entry_dynarr, &iifed_description); + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (nothing, "nothing"); IIFORMAT_HAS_METHOD (nothing, possible_dest_types); @@ -4430,6 +4469,27 @@ IIFORMAT_VALID_KEYWORD (xpm, Q_data, check_valid_string); IIFORMAT_VALID_KEYWORD (xpm, Q_file, check_valid_string); IIFORMAT_VALID_KEYWORD (xpm, Q_color_symbols, check_valid_xpm_color_symbols); +#endif /* HAVE_XPM */ +} + + +void +reinit_image_instantiator_format_create (void) +{ + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (nothing, "nothing"); + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (inherit, "inherit"); + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (string, "string"); + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (text, "text"); + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (formatted_string, "formatted-string"); + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (subwindow, "subwindow"); +#ifdef HAVE_WINDOW_SYSTEM + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xbm, "xbm"); +#endif /* HAVE_WINDOW_SYSTEM */ +#ifdef HAVE_XFACE + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xface, "xface"); +#endif +#ifdef HAVE_XPM + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xpm, "xpm"); #endif /* HAVE_XPM */ } Index: src/glyphs.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs.h,v retrieving revision 1.18.2.17 diff -u -r1.18.2.17 glyphs.h --- glyphs.h 1999/09/16 16:56:50 1.18.2.17 +++ glyphs.h 1999/09/29 17:10:08 @@ -81,6 +81,8 @@ Dynarr_declare (ii_keyword_entry); } ii_keyword_entry_dynarr; +extern const struct struct_description iim_description; + struct image_instantiator_methods { Lisp_Object symbol; @@ -179,12 +181,19 @@ Dynarr_new (console_type_entry); \ add_entry_to_image_instantiator_format_list \ (Q##format, format##_image_instantiator_methods); \ + dumpstruct (&format##_image_instantiator_methods, \ + &iim_description); \ } while (0) #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \ do { \ - defsymbol (&Q##format, obj_name); \ - INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name); \ + defsymbol_nodump (&Q##format, obj_name); \ + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name);\ +} while (0) + +#define REINITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format) \ +do { \ + staticpro (&Q##format); \ } while (0) /* Declare that image-instantiator format FORMAT has method M; used in @@ -249,6 +258,8 @@ add_entry_to_device_ii_format_list \ (Q##type, Q##format, type##_##format##_image_instantiator_methods); \ IIFORMAT_VALID_CONSOLE(type,format); \ + dumpstruct (&format##_image_instantiator_methods, \ + &iim_description); \ } while (0) /* Declare that image-instantiator format FORMAT has method M; used in Index: src/gutter.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/Attic/gutter.c,v retrieving revision 1.1.2.12 diff -u -r1.1.2.12 gutter.c --- gutter.c 1999/09/23 05:57:03 1.1.2.12 +++ gutter.c 1999/09/29 17:10:09 @@ -738,6 +738,13 @@ } void +reinit_specifier_type_create_gutter (void) +{ + REINITIALIZE_SPECIFIER_TYPE (gutter); + REINITIALIZE_SPECIFIER_TYPE (gutter_size); +} + +void specifier_vars_of_gutter (void) { Lisp_Object fb; Index: src/lisp.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/lisp.h,v retrieving revision 1.38.2.24 diff -u -r1.38.2.24 lisp.h --- lisp.h 1999/09/28 00:42:57 1.38.2.24 +++ lisp.h 1999/09/29 17:10:09 @@ -52,7 +52,8 @@ int elsize; \ int cur; \ int largest; \ - int max + int max; \ + int dumped typedef struct dynarr { @@ -1952,6 +1953,9 @@ /* var will not be saved at dump time */ void staticpro_nodump (Lisp_Object *); +/* Call dumpstruct(&var, &desc) to dump the structure pointed to by `var'. */ +void dumpstruct (void *, const struct struct_description *); + /* Nonzero means Emacs has already been initialized. Used during startup to detect startup of dumped Emacs. */ extern int initialized; @@ -2069,6 +2073,10 @@ #ifdef MEMORY_USAGE_STATS size_t malloced_storage_size (void *, size_t, struct overhead_stats *); size_t fixed_type_block_overhead (size_t); +#endif +#ifdef PDUMP +void pdump (void); +int pdump_load (void); #endif /* Defined in buffer.c */ Index: src/lread.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/lread.c,v retrieving revision 1.36.2.11 diff -u -r1.36.2.11 lread.c --- lread.c 1999/09/23 05:57:04 1.36.2.11 +++ lread.c 1999/09/29 17:10:10 @@ -3149,8 +3149,17 @@ } void +reinit_vars_of_lread (void) +{ + Vread_buffer_stream = Qnil; + staticpro_nodump (&Vread_buffer_stream); +} + +void vars_of_lread (void) { + reinit_vars_of_lread (); + DEFVAR_LISP ("values", &Vvalues /* List of values of all expressions which were read, evaluated and printed. Order is reverse chronological. @@ -3267,9 +3276,6 @@ /* This must be initialized in init_lread otherwise it may start out with values saved when the image is dumped. */ staticpro (&Vload_descriptor_list); - - Vread_buffer_stream = Qnil; - staticpro_nodump (&Vread_buffer_stream); /* Initialized in init_lread. */ staticpro (&Vload_force_doc_string_list); Index: src/lrecord.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/lrecord.h,v retrieving revision 1.8.2.9 diff -u -r1.8.2.9 lrecord.h --- lrecord.h 1999/09/03 04:34:12 1.8.2.9 +++ lrecord.h 1999/09/29 17:10:10 @@ -67,6 +67,10 @@ unsigned c_readonly : 1; /* 1 if the object is readonly from lisp */ unsigned lisp_readonly : 1; + /* 1 if the object is a dumped one */ + unsigned dumped : 1; + /* 1 if the data pointed by the object is dumped */ + unsigned data_dumped : 1; }; struct lrecord_implementation; @@ -254,6 +258,10 @@ Pointer to a doc string (C string if positive, opaque value if negative) + XD_DUMP_FLAG + An integer set to -1 in the dump image. + + XD_SIZE_T size_t value. Used for counts. @@ -292,6 +300,7 @@ XD_OPAQUE_DATA_PTR, XD_C_STRING, XD_DOC_STRING, + XD_DUMP_FLAG, XD_SIZE_T, XD_INT, XD_LONG, @@ -322,7 +331,8 @@ #define XD_DYNARR_DESC(base_type, sub_desc) \ { XD_STRUCT_PTR, offsetof(base_type, base), XD_INDIRECT(1, 0), sub_desc }, \ - { XD_INT, offsetof(base_type, max) } + { XD_INT, offsetof(base_type, max) }, \ + { XD_DUMP_FLAG, offsetof(base_type, dumped) } /* Declaring the following structures as const puts them in the text (read-only) segment, which makes debugging inconvenient Index: src/lstream.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/lstream.c,v retrieving revision 1.12.2.4 diff -u -r1.12.2.4 lstream.c --- lstream.c 1999/09/02 16:45:42 1.12.2.4 +++ lstream.c 1999/09/29 17:10:10 @@ -1673,7 +1673,7 @@ } void -vars_of_lstream (void) +reinit_vars_of_lstream (void) { int i; @@ -1682,4 +1682,10 @@ Vlstream_free_list[i] = Qnil; staticpro_nodump (&Vlstream_free_list[i]); } +} + +void +vars_of_lstream (void) +{ + reinit_vars_of_lstream (); } Index: src/mule-charset.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/mule-charset.c,v retrieving revision 1.12.2.16 diff -u -r1.12.2.16 mule-charset.c --- mule-charset.c 1999/07/23 06:09:22 1.12.2.16 +++ mule-charset.c 1999/09/29 17:10:10 @@ -74,12 +74,18 @@ #endif /* ENABLE_COMPOSITE_CHARS */ -/* Table of charsets indexed by leading byte. */ -Lisp_Object charset_by_leading_byte[128]; +struct charset_lookup *chlook; -/* Table of charsets indexed by type/final-byte/direction. */ -Lisp_Object charset_by_attributes[4][128][2]; +static const struct lrecord_description charset_lookup_description_1[] = { + { XD_LISP_OBJECT, offsetof(struct charset_lookup, charset_by_leading_byte), 128+4*128*2 }, + { XD_END } +}; +static const struct struct_description charset_lookup_description = { + sizeof(struct charset_lookup), + charset_lookup_description_1 +}; + /* Table of number of bytes in the string representation of a character indexed by the first byte of that representation. @@ -488,12 +494,12 @@ /* some charsets do not have final characters. This includes ASCII, Control-1, Composite, and the two faux private charsets. */ - assert (NILP (charset_by_attributes[type][final][direction])); - charset_by_attributes[type][final][direction] = obj; + assert (NILP (chlook->charset_by_attributes[type][final][direction])); + chlook->charset_by_attributes[type][final][direction] = obj; } - assert (NILP (charset_by_leading_byte[id - 128])); - charset_by_leading_byte[id - 128] = obj; + assert (NILP (chlook->charset_by_leading_byte[id - 128])); + chlook->charset_by_leading_byte[id - 128] = obj; if (id < 0xA0) /* official leading byte */ rep_bytes_by_first_byte[id] = rep_bytes; @@ -1294,15 +1300,18 @@ { int i, j, k; + chlook = malloc(sizeof(*chlook)); + dumpstruct (&chlook, &charset_lookup_description); + /* Table of charsets indexed by leading byte. */ - for (i = 0; i < countof (charset_by_leading_byte); i++) - charset_by_leading_byte[i] = Qnil; + for (i = 0; i < countof (chlook->charset_by_leading_byte); i++) + chlook->charset_by_leading_byte[i] = Qnil; /* Table of charsets indexed by type/final-byte/direction. */ - for (i = 0; i < countof (charset_by_attributes); i++) - for (j = 0; j < countof (charset_by_attributes[0]); j++) - for (k = 0; k < countof (charset_by_attributes[0][0]); k++) - charset_by_attributes[i][j][k] = Qnil; + for (i = 0; i < countof (chlook->charset_by_attributes); i++) + for (j = 0; j < countof (chlook->charset_by_attributes[0]); j++) + for (k = 0; k < countof (chlook->charset_by_attributes[0][0]); k++) + chlook->charset_by_attributes[i][j][k] = Qnil; next_allocated_1_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_1; next_allocated_2_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_2; @@ -1318,6 +1327,7 @@ /* Predefined character sets. We store them into variables for ease of access. */ + staticpro (&Vcharset_ascii); Vcharset_ascii = make_charset (LEADING_BYTE_ASCII, Qascii, 1, CHARSET_TYPE_94, 1, 0, 'B', @@ -1326,6 +1336,7 @@ build_string ("ASCII)"), build_string ("ASCII (ISO646 IRV)"), build_string ("\\(iso8859-[0-9]*\\|-ascii\\)")); + staticpro (&Vcharset_control_1); Vcharset_control_1 = make_charset (LEADING_BYTE_CONTROL_1, Qcontrol_1, 2, CHARSET_TYPE_94, 1, 1, 0, @@ -1334,6 +1345,7 @@ build_string ("Control characters"), build_string ("Control characters 128-191"), build_string ("")); + staticpro (&Vcharset_latin_iso8859_1); Vcharset_latin_iso8859_1 = make_charset (LEADING_BYTE_LATIN_ISO8859_1, Qlatin_iso8859_1, 2, CHARSET_TYPE_96, 1, 1, 'A', @@ -1342,6 +1354,7 @@ build_string ("ISO8859-1 (Latin-1)"), build_string ("ISO8859-1 (Latin-1)"), build_string ("iso8859-1")); + staticpro (&Vcharset_latin_iso8859_2); Vcharset_latin_iso8859_2 = make_charset (LEADING_BYTE_LATIN_ISO8859_2, Qlatin_iso8859_2, 2, CHARSET_TYPE_96, 1, 1, 'B', @@ -1350,6 +1363,7 @@ build_string ("ISO8859-2 (Latin-2)"), build_string ("ISO8859-2 (Latin-2)"), build_string ("iso8859-2")); + staticpro (&Vcharset_latin_iso8859_3); Vcharset_latin_iso8859_3 = make_charset (LEADING_BYTE_LATIN_ISO8859_3, Qlatin_iso8859_3, 2, CHARSET_TYPE_96, 1, 1, 'C', @@ -1358,6 +1372,7 @@ build_string ("ISO8859-3 (Latin-3)"), build_string ("ISO8859-3 (Latin-3)"), build_string ("iso8859-3")); + staticpro (&Vcharset_latin_iso8859_4); Vcharset_latin_iso8859_4 = make_charset (LEADING_BYTE_LATIN_ISO8859_4, Qlatin_iso8859_4, 2, CHARSET_TYPE_96, 1, 1, 'D', @@ -1366,6 +1381,7 @@ build_string ("ISO8859-4 (Latin-4)"), build_string ("ISO8859-4 (Latin-4)"), build_string ("iso8859-4")); + staticpro (&Vcharset_thai_tis620); Vcharset_thai_tis620 = make_charset (LEADING_BYTE_THAI_TIS620, Qthai_tis620, 2, CHARSET_TYPE_96, 1, 1, 'T', @@ -1374,6 +1390,7 @@ build_string ("TIS620 (Thai)"), build_string ("TIS620.2529 (Thai)"), build_string ("tis620")); + staticpro (&Vcharset_greek_iso8859_7); Vcharset_greek_iso8859_7 = make_charset (LEADING_BYTE_GREEK_ISO8859_7, Qgreek_iso8859_7, 2, CHARSET_TYPE_96, 1, 1, 'F', @@ -1382,6 +1399,7 @@ build_string ("ISO8859-7 (Greek)"), build_string ("ISO8859-7 (Greek)"), build_string ("iso8859-7")); + staticpro (&Vcharset_arabic_iso8859_6); Vcharset_arabic_iso8859_6 = make_charset (LEADING_BYTE_ARABIC_ISO8859_6, Qarabic_iso8859_6, 2, CHARSET_TYPE_96, 1, 1, 'G', @@ -1390,6 +1408,7 @@ build_string ("ISO8859-6 (Arabic)"), build_string ("ISO8859-6 (Arabic)"), build_string ("iso8859-6")); + staticpro (&Vcharset_hebrew_iso8859_8); Vcharset_hebrew_iso8859_8 = make_charset (LEADING_BYTE_HEBREW_ISO8859_8, Qhebrew_iso8859_8, 2, CHARSET_TYPE_96, 1, 1, 'H', @@ -1398,6 +1417,7 @@ build_string ("ISO8859-8 (Hebrew)"), build_string ("ISO8859-8 (Hebrew)"), build_string ("iso8859-8")); + staticpro (&Vcharset_katakana_jisx0201); Vcharset_katakana_jisx0201 = make_charset (LEADING_BYTE_KATAKANA_JISX0201, Qkatakana_jisx0201, 2, CHARSET_TYPE_94, 1, 1, 'I', @@ -1406,6 +1426,7 @@ build_string ("JISX0201.1976 (Japanese Kana)"), build_string ("JISX0201.1976 Japanese Kana"), build_string ("jisx0201.1976")); + staticpro (&Vcharset_latin_jisx0201); Vcharset_latin_jisx0201 = make_charset (LEADING_BYTE_LATIN_JISX0201, Qlatin_jisx0201, 2, CHARSET_TYPE_94, 1, 0, 'J', @@ -1414,6 +1435,7 @@ build_string ("JISX0201.1976 (Japanese Roman)"), build_string ("JISX0201.1976 Japanese Roman"), build_string ("jisx0201.1976")); + staticpro (&Vcharset_cyrillic_iso8859_5); Vcharset_cyrillic_iso8859_5 = make_charset (LEADING_BYTE_CYRILLIC_ISO8859_5, Qcyrillic_iso8859_5, 2, CHARSET_TYPE_96, 1, 1, 'L', @@ -1422,6 +1444,7 @@ build_string ("ISO8859-5 (Cyrillic)"), build_string ("ISO8859-5 (Cyrillic)"), build_string ("iso8859-5")); + staticpro (&Vcharset_latin_iso8859_9); Vcharset_latin_iso8859_9 = make_charset (LEADING_BYTE_LATIN_ISO8859_9, Qlatin_iso8859_9, 2, CHARSET_TYPE_96, 1, 1, 'M', @@ -1430,6 +1453,7 @@ build_string ("ISO8859-9 (Latin-5)"), build_string ("ISO8859-9 (Latin-5)"), build_string ("iso8859-9")); + staticpro (&Vcharset_japanese_jisx0208_1978); Vcharset_japanese_jisx0208_1978 = make_charset (LEADING_BYTE_JAPANESE_JISX0208_1978, Qjapanese_jisx0208_1978, 3, CHARSET_TYPE_94X94, 2, 0, '@', @@ -1439,6 +1463,7 @@ build_string ("JISX0208.1978 Japanese Kanji (so called \"old JIS\")"), build_string ("\\(jisx0208\\|jisc6226\\)\\.1978")); + staticpro (&Vcharset_chinese_gb2312); Vcharset_chinese_gb2312 = make_charset (LEADING_BYTE_CHINESE_GB2312, Qchinese_gb2312, 3, CHARSET_TYPE_94X94, 2, 0, 'A', @@ -1447,6 +1472,7 @@ build_string ("GB2312)"), build_string ("GB2312 Chinese simplified"), build_string ("gb2312")); + staticpro (&Vcharset_japanese_jisx0208); Vcharset_japanese_jisx0208 = make_charset (LEADING_BYTE_JAPANESE_JISX0208, Qjapanese_jisx0208, 3, CHARSET_TYPE_94X94, 2, 0, 'B', @@ -1455,6 +1481,7 @@ build_string ("JISX0208.1983/1990 (Japanese)"), build_string ("JISX0208.1983/1990 Japanese Kanji"), build_string ("jisx0208.19\\(83\\|90\\)")); + staticpro (&Vcharset_korean_ksc5601); Vcharset_korean_ksc5601 = make_charset (LEADING_BYTE_KOREAN_KSC5601, Qkorean_ksc5601, 3, CHARSET_TYPE_94X94, 2, 0, 'C', @@ -1463,6 +1490,7 @@ build_string ("KSC5601 (Korean"), build_string ("KSC5601 Korean Hangul and Hanja"), build_string ("ksc5601")); + staticpro (&Vcharset_japanese_jisx0212); Vcharset_japanese_jisx0212 = make_charset (LEADING_BYTE_JAPANESE_JISX0212, Qjapanese_jisx0212, 3, CHARSET_TYPE_94X94, 2, 0, 'D', @@ -1473,6 +1501,7 @@ build_string ("jisx0212")); #define CHINESE_CNS_PLANE_RE(n) "cns11643[.-]\\(.*[.-]\\)?" n "$" + staticpro (&Vcharset_chinese_cns11643_1); Vcharset_chinese_cns11643_1 = make_charset (LEADING_BYTE_CHINESE_CNS11643_1, Qchinese_cns11643_1, 3, CHARSET_TYPE_94X94, 2, 0, 'G', @@ -1482,6 +1511,7 @@ build_string ("CNS 11643 Plane 1 Chinese traditional"), build_string (CHINESE_CNS_PLANE_RE("1"))); + staticpro (&Vcharset_chinese_cns11643_2); Vcharset_chinese_cns11643_2 = make_charset (LEADING_BYTE_CHINESE_CNS11643_2, Qchinese_cns11643_2, 3, CHARSET_TYPE_94X94, 2, 0, 'H', @@ -1491,6 +1521,7 @@ build_string ("CNS 11643 Plane 2 Chinese traditional"), build_string (CHINESE_CNS_PLANE_RE("2"))); + staticpro (&Vcharset_chinese_big5_1); Vcharset_chinese_big5_1 = make_charset (LEADING_BYTE_CHINESE_BIG5_1, Qchinese_big5_1, 3, CHARSET_TYPE_94X94, 2, 0, '0', @@ -1500,6 +1531,7 @@ build_string ("Big5 Level-1 Chinese traditional"), build_string ("big5")); + staticpro (&Vcharset_chinese_big5_2); Vcharset_chinese_big5_2 = make_charset (LEADING_BYTE_CHINESE_BIG5_2, Qchinese_big5_2, 3, CHARSET_TYPE_94X94, 2, 0, '1', @@ -1515,6 +1547,7 @@ /* #### For simplicity, we put composite chars into a 96x96 charset. This is going to lead to problems because you can run out of room, esp. as we don't yet recycle numbers. */ + staticpro (&Vcharset_composite); Vcharset_composite = make_charset (LEADING_BYTE_COMPOSITE, Qcomposite, 3, CHARSET_TYPE_96X96, 2, 0, 0, Index: src/mule-charset.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/mule-charset.h,v retrieving revision 1.7.2.3 diff -u -r1.7.2.3 mule-charset.h --- mule-charset.h 1999/09/23 07:39:54 1.7.2.3 +++ mule-charset.h 1999/09/29 17:10:11 @@ -540,11 +540,15 @@ #define XCHARSET_REVERSE_DIRECTION_CHARSET(cs) \ CHARSET_REVERSE_DIRECTION_CHARSET (XCHARSET (cs)) -/* Table of charsets indexed by (leading byte - 128). */ -extern Lisp_Object charset_by_leading_byte[128]; +struct charset_lookup { + /* Table of charsets indexed by leading byte. */ + Lisp_Object charset_by_leading_byte[128]; + + /* Table of charsets indexed by type/final-byte/direction. */ + Lisp_Object charset_by_attributes[4][128][2]; +}; -/* Table of charsets indexed by type/final-byte/direction. */ -extern Lisp_Object charset_by_attributes[4][128][2]; +extern struct charset_lookup *chlook; /* Table of number of bytes in the string representation of a character indexed by the first byte of that representation. @@ -566,17 +570,17 @@ CHARSET_BY_LEADING_BYTE (int lb) { assert (lb >= 0x80 && lb <= 0xFF); - return charset_by_leading_byte[lb - 128]; + return chlook->charset_by_leading_byte[lb - 128]; } #else -#define CHARSET_BY_LEADING_BYTE(lb) (charset_by_leading_byte[(lb) - 128]) +#define CHARSET_BY_LEADING_BYTE(lb) (chlook->charset_by_leading_byte[(lb) - 128]) #endif #define CHARSET_BY_ATTRIBUTES(type, final, dir) \ - (charset_by_attributes[type][final][dir]) + (chlook->charset_by_attributes[type][final][dir]) #ifdef ERROR_CHECK_TYPECHECK Index: src/objects.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/objects.c,v retrieving revision 1.5.2.6 diff -u -r1.5.2.6 objects.c --- objects.c 1999/09/23 07:39:55 1.5.2.6 +++ objects.c 1999/09/29 17:10:11 @@ -1085,7 +1085,15 @@ } void -vars_of_objects (void) +reinit_specifier_type_create_objects (void) +{ + REINITIALIZE_SPECIFIER_TYPE (color); + REINITIALIZE_SPECIFIER_TYPE (font); + REINITIALIZE_SPECIFIER_TYPE (face_boolean); +} + +void +reinit_vars_of_objects (void) { staticpro_nodump (&Vthe_null_color_instance); { @@ -1113,4 +1121,10 @@ XSETFONT_INSTANCE (Vthe_null_font_instance, f); } +} + +void +vars_of_objects (void) +{ + reinit_vars_of_objects (); } Index: src/opaque.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/opaque.c,v retrieving revision 1.6.2.8 diff -u -r1.6.2.8 opaque.c --- opaque.c 1999/09/02 16:45:43 1.6.2.8 +++ opaque.c 1999/09/29 17:10:11 @@ -164,8 +164,14 @@ } void -init_opaque_once_early (void) +reinit_opaque_once_early (void) { Vopaque_ptr_free_list = make_lcrecord_list (sizeof (Lisp_Opaque_Ptr), &lrecord_opaque_ptr); staticpro_nodump (&Vopaque_ptr_free_list); +} + +void +init_opaque_once_early (void) +{ + reinit_opaque_once_early (); } Index: src/search.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/search.c,v retrieving revision 1.14.2.5 diff -u -r1.14.2.5 search.c --- search.c 1999/09/28 00:26:54 1.14.2.5 +++ search.c 1999/09/29 17:10:11 @@ -2574,10 +2574,18 @@ } void +reinit_vars_of_search (void) +{ + last_thing_searched = Qnil; + staticpro_nodump (&last_thing_searched); +} + +void vars_of_search (void) { - REGISTER int i; + int i; + reinit_vars_of_search (); for (i = 0; i < REGEXP_CACHE_SIZE; ++i) { searchbufs[i].buf.allocated = 100; @@ -2588,9 +2596,6 @@ searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); } searchbuf_head = &searchbufs[0]; - - last_thing_searched = Qnil; - staticpro_nodump (&last_thing_searched); DEFVAR_LISP ("forward-word-regexp", &Vforward_word_regexp /* *Regular expression to be used in `forward-word'. Index: src/specifier.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/specifier.c,v retrieving revision 1.15.2.8 diff -u -r1.15.2.8 specifier.c --- specifier.c 1999/09/28 00:26:54 1.15.2.8 +++ specifier.c 1999/09/29 17:10:12 @@ -66,6 +66,27 @@ static specifier_type_entry_dynarr *the_specifier_type_entry_dynarr; +static const struct lrecord_description ste_description_1[] = { + { XD_LISP_OBJECT, offsetof(specifier_type_entry, symbol), 1 }, + { XD_STRUCT_PTR, offsetof(specifier_type_entry, meths), 1, &specifier_methods_description }, + { XD_END } +}; + +static const struct struct_description ste_description = { + sizeof(specifier_type_entry), + ste_description_1 +}; + +static const struct lrecord_description sted_description_1[] = { + XD_DYNARR_DESC(specifier_type_entry_dynarr, &ste_description), + { XD_END } +}; + +static const struct struct_description sted_description = { + sizeof(specifier_type_entry_dynarr), + sted_description_1 +}; + static Lisp_Object Vspecifier_type_list; static Lisp_Object Vcached_specifiers; @@ -336,11 +357,11 @@ sizeof_specifier (CONST void *header) { if (GHOST_SPECIFIER_P ((struct Lisp_Specifier *) header)) - return sizeof (struct Lisp_Specifier); + return offsetof (struct Lisp_Specifier, data); else { CONST struct Lisp_Specifier *p = (CONST struct Lisp_Specifier *) header; - return sizeof (*p) + p->methods->extra_data_size - 1; + return offsetof (struct Lisp_Specifier, data) + p->methods->extra_data_size; } } @@ -349,7 +370,7 @@ { XD_END } }; -static const struct struct_description specifier_methods_description = { +const struct struct_description specifier_methods_description = { sizeof(struct specifier_methods), specifier_methods_description_1 }; @@ -446,8 +467,8 @@ { Lisp_Object specifier; struct Lisp_Specifier *sp = (struct Lisp_Specifier *) - alloc_lcrecord (sizeof (struct Lisp_Specifier) + - data_size - 1, &lrecord_specifier); + alloc_lcrecord (offsetof (struct Lisp_Specifier, data) + + data_size, &lrecord_specifier); sp->methods = spec_meths; sp->global_specs = Qnil; @@ -3157,6 +3178,7 @@ specifier_type_create (void) { the_specifier_type_entry_dynarr = Dynarr_new (specifier_type_entry); + dumpstruct (&the_specifier_type_entry_dynarr, &sted_description); Vspecifier_type_list = Qnil; staticpro (&Vspecifier_type_list); @@ -3178,6 +3200,16 @@ INITIALIZE_SPECIFIER_TYPE (display_table, "display-table", "display-table-p"); SPECIFIER_HAS_METHOD (display_table, validate); +} + +void +reinit_specifier_type_create (void) +{ + REINITIALIZE_SPECIFIER_TYPE (generic); + REINITIALIZE_SPECIFIER_TYPE (integer); + REINITIALIZE_SPECIFIER_TYPE (natnum); + REINITIALIZE_SPECIFIER_TYPE (boolean); + REINITIALIZE_SPECIFIER_TYPE (display_table); } void Index: src/specifier.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/specifier.h,v retrieving revision 1.6.2.3 diff -u -r1.6.2.3 specifier.h --- specifier.h 1999/09/23 07:39:56 1.6.2.3 +++ specifier.h 1999/09/29 17:10:12 @@ -83,6 +83,8 @@ same time. */ +extern const struct struct_description specifier_methods_description; + struct specifier_methods { CONST char *name; @@ -287,8 +289,13 @@ type##_specifier_methods->name = obj_name; \ type##_specifier_methods->extra_description = \ specifier_empty_extra_description; \ - defsymbol (&type##_specifier_methods->predicate_symbol, pred_sym); \ + defsymbol_nodump (&type##_specifier_methods->predicate_symbol, pred_sym); \ add_entry_to_specifier_type_list (Q##type, type##_specifier_methods); \ + dumpstruct (&type##_specifier_methods, &specifier_methods_description); \ +} while (0) + +#define REINITIALIZE_SPECIFIER_TYPE(type) do { \ + staticpro_nodump (&type##_specifier_methods->predicate_symbol); \ } while (0) #define INITIALIZE_SPECIFIER_TYPE_WITH_DATA(type, obj_name, pred_sym) \ Index: src/symbols.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/symbols.c,v retrieving revision 1.22.2.13 diff -u -r1.22.2.13 symbols.c --- symbols.c 1999/09/23 07:39:57 1.22.2.13 +++ symbols.c 1999/09/29 17:10:13 @@ -1554,7 +1554,9 @@ /* This can also get called while we're preparing to shutdown. #### What should really happen in that case? Should we actually fix things so we can't get here in that case? */ +#ifndef PDUMP assert (!initialized || preparing_for_armageddon); +#endif con = 0; } @@ -1590,7 +1592,9 @@ /* This can also get called while we're preparing to shutdown. #### What should really happen in that case? Should we actually fix things so we can't get here in that case? */ +#ifndef PDUMP assert (!initialized || preparing_for_armageddon); +#endif con = 0; } @@ -3160,6 +3164,15 @@ defsymbol (&Qt, "t"); XSYMBOL (Qt)->value = Qt; /* Veritas aetera */ Vquit_flag = Qnil; +} + +void +defsymbol_nodump (Lisp_Object *location, CONST char *name) +{ + *location = Fintern (make_string_nocopy ((CONST Bufbyte *) name, + strlen (name)), + Qnil); + staticpro_nodump (location); } void Index: src/symeval.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/symeval.h,v retrieving revision 1.4.2.4 diff -u -r1.4.2.4 symeval.h --- symeval.h 1999/06/23 08:05:00 1.4.2.4 +++ symeval.h 1999/09/29 17:10:13 @@ -282,6 +282,7 @@ #define DEFSUBR_MACRO(Fname) defsubr_macro (&S##Fname) void defsymbol (Lisp_Object *location, CONST char *name); +void defsymbol_nodump (Lisp_Object *location, CONST char *name); void defkeyword (Lisp_Object *location, CONST char *name); Index: src/symsinit.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/symsinit.h,v retrieving revision 1.31.2.8 diff -u -r1.31.2.8 symsinit.h --- symsinit.h 1999/07/16 19:05:44 1.31.2.8 +++ symsinit.h 1999/09/29 17:10:13 @@ -33,11 +33,13 @@ void init_ralloc (void); void init_signals_very_early (void); -/* Early Lisp-engine initialization (dump-time only). */ +/* Early Lisp-engine initialization (dump-time for init, run-time for reinit). */ void init_alloc_once_early (void); +void reinit_alloc_once_early (void); void init_symbols_once_early (void); void init_errors_once_early (void); +void reinit_opaque_once_early (void); void init_opaque_once_early (void); /* Declare the built-in symbols and primitives (dump-time only). */ @@ -147,16 +149,19 @@ void syms_of_xselect (void); void syms_of_eldap (void); -/* Initialize the console types (dump-time only). */ +/* Initialize the console types (dump-time but for reinit_). */ void console_type_create (void); void console_type_create_stream (void); +void reinit_console_type_create_stream (void); void console_type_create_tty (void); +void reinit_console_type_create_tty (void); void console_type_create_device_tty (void); void console_type_create_frame_tty (void); void console_type_create_objects_tty (void); void console_type_create_redisplay_tty (void); void console_type_create_x (void); +void reinit_console_type_create_x (void); void console_type_create_device_x (void); void console_type_create_frame_x (void); void console_type_create_glyphs_x (void); @@ -168,6 +173,7 @@ void console_type_create_toolbar_x (void); void console_type_create_dialog_x (void); void console_type_create_mswindows (void); +void reinit_console_type_create_mswindows (void); void console_type_create_device_mswindows (void); void console_type_create_frame_mswindows (void); void console_type_create_menubar_mswindows (void); @@ -182,10 +188,15 @@ /* Initialize the specifier types (dump-time only). */ void specifier_type_create (void); +void reinit_specifier_type_create (void); void specifier_type_create_image (void); +void reinit_specifier_type_create_image (void); void specifier_type_create_gutter (void); +void reinit_specifier_type_create_gutter (void); void specifier_type_create_objects (void); +void reinit_specifier_type_create_objects (void); void specifier_type_create_toolbar (void); +void reinit_specifier_type_create_toolbar (void); /* Initialize the structure types (dump-time only). */ @@ -198,10 +209,15 @@ /* Initialize the image instantiator types (dump-time only). */ void image_instantiator_format_create (void); +void reinit_image_instantiator_format_create (void); void image_instantiator_format_create_glyphs_eimage (void); +void reinit_image_instantiator_format_create_glyphs_eimage (void); void image_instantiator_format_create_glyphs_widget (void); +void reinit_image_instantiator_format_create_glyphs_widget (void); void image_instantiator_format_create_glyphs_x (void); +void reinit_image_instantiator_format_create_glyphs_x (void); void image_instantiator_format_create_glyphs_mswindows (void); +void reinit_image_instantiator_format_create_glyphs_mswindows (void); void image_instantiator_format_create_glyphs_tty (void); /* Initialize the lstream types (dump-time only). */ @@ -220,12 +236,13 @@ void init_provide_once (void); -/* Initialize most variables (dump-time only). */ +/* Initialize most variables (dump-time for vars_, run-time for reinit_vars). */ void vars_of_abbrev (void); void vars_of_alloc (void); void vars_of_balloon_x (void); void vars_of_buffer (void); +void reinit_vars_of_buffer (void); void vars_of_bytecode (void); void vars_of_callint (void); void vars_of_callproc (void); @@ -233,6 +250,7 @@ void vars_of_cmdloop (void); void vars_of_cmds (void); void vars_of_console (void); +void reinit_vars_of_console (void); void vars_of_console_stream (void); void vars_of_console_mswindows (void); void vars_of_console_tty (void); @@ -240,6 +258,7 @@ void vars_of_database (void); void vars_of_debug (void); void vars_of_device (void); +void reinit_vars_of_device (void); void vars_of_device_mswindows (void); void vars_of_device_x (void); void vars_of_dialog (void); @@ -253,7 +272,9 @@ void vars_of_elhash (void); void vars_of_emacs (void); void vars_of_eval (void); +void reinit_vars_of_eval (void); void vars_of_event_stream (void); +void reinit_vars_of_event_stream (void); void vars_of_event_tty (void); void vars_of_event_mswindows (void); void vars_of_event_Xt (void); @@ -283,7 +304,9 @@ void vars_of_intl (void); void vars_of_keymap (void); void vars_of_lread (void); +void reinit_vars_of_lread (void); void vars_of_lstream (void); +void reinit_vars_of_lstream (void); void vars_of_macros (void); void vars_of_md5 (void); void vars_of_menubar_x (void); @@ -299,6 +322,7 @@ void vars_of_mule_wnn (void); void vars_of_ntproc (void); void vars_of_objects (void); +void reinit_vars_of_objects (void); void vars_of_objects_tty (void); void vars_of_objects_mswindows (void); void vars_of_objects_x (void); @@ -313,6 +337,7 @@ void vars_of_scrollbar (void); void vars_of_scrollbar_mswindows (void); void vars_of_search (void); +void reinit_vars_of_search (void); void vars_of_select (void); void vars_of_select_mswindows (void); void vars_of_sound (void); @@ -324,6 +349,7 @@ void vars_of_tooltalk (void); void vars_of_undo (void); void vars_of_window (void); +void reinit_vars_of_window (void); void vars_of_xselect (void); void vars_of_eldap (void); @@ -338,7 +364,7 @@ void specifier_vars_of_window (void); /* Initialize variables with complex dependencies - on other variables (dump-time only). */ + on other variables (dump-time for complex_vars_, run-time for reinit_). */ void complex_vars_of_regex (void); void complex_vars_of_search (void); @@ -358,7 +384,9 @@ void complex_vars_of_syntax (void); void complex_vars_of_chartab (void); void complex_vars_of_buffer (void); +void reinit_complex_vars_of_buffer (void); void complex_vars_of_console (void); +void reinit_complex_vars_of_console (void); void complex_vars_of_emacs (void); void complex_vars_of_minibuf (void); void complex_vars_of_callproc (void); Index: src/toolbar.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/toolbar.c,v retrieving revision 1.18.2.3 diff -u -r1.18.2.3 toolbar.c --- toolbar.c 1999/06/22 18:03:00 1.18.2.3 +++ toolbar.c 1999/09/29 17:10:13 @@ -1312,6 +1312,12 @@ } void +reinit_specifier_type_create_toolbar (void) +{ + REINITIALIZE_SPECIFIER_TYPE (toolbar); +} + +void specifier_vars_of_toolbar (void) { Lisp_Object fb; Index: src/window.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/window.c,v retrieving revision 1.41.2.19 diff -u -r1.41.2.19 window.c --- window.c 1999/09/28 00:27:03 1.41.2.19 +++ window.c 1999/09/29 17:10:15 @@ -5779,12 +5779,27 @@ } void -vars_of_window (void) +reinit_vars_of_window (void) { + int i; /* Make sure all windows get marked */ minibuf_window = Qnil; staticpro_nodump (&minibuf_window); + for (i = 0; i < countof (Vwindow_configuration_free_list); i++) + { + Vwindow_configuration_free_list[i] = + make_lcrecord_list (sizeof_window_config_for_n_windows (i + 1), + &lrecord_window_configuration); + staticpro_nodump (&Vwindow_configuration_free_list[i]); + } +} + +void +vars_of_window (void) +{ + reinit_vars_of_window (); + DEFVAR_BOOL ("scroll-on-clipped-lines", &scroll_on_clipped_lines /* *Non-nil means to scroll if point lands on a line which is clipped. */ ); @@ -5835,18 +5850,6 @@ *Delete any window less than this wide. */ ); window_min_width = 10; - - { - int i; - - for (i = 0; i < countof (Vwindow_configuration_free_list); i++) - { - Vwindow_configuration_free_list[i] = - make_lcrecord_list (sizeof_window_config_for_n_windows (i + 1), - &lrecord_window_configuration); - staticpro_nodump (&Vwindow_configuration_free_list[i]); - } - } } void