comparison src/alloc.c @ 104:cf808b4c4290 r20-1b4

Import from CVS: tag r20-1b4
author cvs
date Mon, 13 Aug 2007 09:16:51 +0200
parents a145efe76779
children 360340f9fd5f
comparison
equal deleted inserted replaced
103:30eda07fe280 104:cf808b4c4290
215 pure_lossage += size; 215 pure_lossage += size;
216 return (0); 216 return (0);
217 } 217 }
218 else if (pureptr + size > PURESIZE) 218 else if (pureptr + size > PURESIZE)
219 { 219 {
220 message ("\nERROR: Pure Lisp storage exhausted!\n"); 220 /* This can cause recursive bad behavior, we'll yell at the end */
221 /* when we're done. */
222 /* message ("\nERROR: Pure Lisp storage exhausted!\n"); */
221 pure_lossage = size; 223 pure_lossage = size;
222 return (0); 224 return (0);
223 } 225 }
224 else 226 else
225 return (1); 227 return (1);
2572 { 2574 {
2573 if (COMPILED_FUNCTIONP (obj)) 2575 if (COMPILED_FUNCTIONP (obj))
2574 { 2576 {
2575 struct Lisp_Compiled_Function *o = XCOMPILED_FUNCTION (obj); 2577 struct Lisp_Compiled_Function *o = XCOMPILED_FUNCTION (obj);
2576 Lisp_Object new = make_compiled_function (1); 2578 Lisp_Object new = make_compiled_function (1);
2577 struct Lisp_Compiled_Function *n = XCOMPILED_FUNCTION (obj); 2579 /* How on earth could this code have worked before? -sb */
2580 struct Lisp_Compiled_Function *n = XCOMPILED_FUNCTION (new);
2578 n->flags = o->flags; 2581 n->flags = o->flags;
2579 n->bytecodes = Fpurecopy (o->bytecodes); 2582 n->bytecodes = Fpurecopy (o->bytecodes);
2580 n->constants = Fpurecopy (o->constants); 2583 n->constants = Fpurecopy (o->constants);
2581 n->arglist = Fpurecopy (o->arglist); 2584 n->arglist = Fpurecopy (o->arglist);
2582 n->doc_and_interactive = Fpurecopy (o->doc_and_interactive); 2585 n->doc_and_interactive = Fpurecopy (o->doc_and_interactive);
2586 n->maxdepth = o->maxdepth;
2583 return (new); 2587 return (new);
2584 } 2588 }
2585 #ifdef LISP_FLOAT_TYPE 2589 #ifdef LISP_FLOAT_TYPE
2586 else if (FLOATP (obj)) 2590 else if (FLOATP (obj))
2587 return make_pure_float (float_data (XFLOAT (obj))); 2591 return make_pure_float (float_data (XFLOAT (obj)));
2597 2601
2598 static void 2602 static void
2599 PURESIZE_h(long int puresize) 2603 PURESIZE_h(long int puresize)
2600 { 2604 {
2601 int fd; 2605 int fd;
2602 char *PURESIZE_h_file = "PURESIZE.h"; 2606 char *PURESIZE_h_file = "puresize_adjust.h";
2603 char *WARNING = "/* This file is generated by XEmacs, DO NOT MODIFY!!! */\n"; 2607 char *WARNING = "/* This file is generated by XEmacs, DO NOT MODIFY!!! */\n";
2604 char define_PURESIZE[256]; 2608 char define_PURESIZE[256];
2605 2609
2606 if ((fd = open(PURESIZE_h_file, O_WRONLY|O_CREAT)) < 0) { 2610 if ((fd = open(PURESIZE_h_file, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) {
2607 report_file_error("Can't write PURESIZE", 2611 report_file_error("Can't write PURESIZE_ADJUSTMENT",
2608 Fcons(build_ext_string(PURESIZE_h_file, FORMAT_FILENAME), 2612 Fcons(build_ext_string(PURESIZE_h_file, FORMAT_FILENAME),
2609 Qnil)); 2613 Qnil));
2610 } 2614 }
2611 2615
2612 write(fd, WARNING, strlen(WARNING)); 2616 write(fd, WARNING, strlen(WARNING));
2613 sprintf(define_PURESIZE, "# define PURESIZE %ld\n", puresize); 2617 sprintf(define_PURESIZE, "# define PURESIZE_ADJUSTMENT %ld\n",
2618 puresize - RAW_PURESIZE);
2614 write(fd, define_PURESIZE, strlen(define_PURESIZE)); 2619 write(fd, define_PURESIZE, strlen(define_PURESIZE));
2615 close(fd); 2620 close(fd);
2616 } 2621 }
2617 2622
2618 void 2623 void
2733 garbage_collect_1 (); /* GC garbage_collect's garbage */ 2738 garbage_collect_1 (); /* GC garbage_collect's garbage */
2734 } 2739 }
2735 clear_message (); 2740 clear_message ();
2736 2741
2737 if (rc < 0) { 2742 if (rc < 0) {
2738 fatal ("Pure size adjusted, please type `make' again"); 2743 fatal ("Pure size adjusted, will restart `make'");
2739 } else if (pure_lossage && die_if_pure_storage_exceeded) { 2744 } else if (pure_lossage && die_if_pure_storage_exceeded) {
2740 fatal ("Pure storage exhausted"); 2745 fatal ("Pure storage exhausted");
2741 } 2746 }
2747 (void)sys_unlink("SATISFIED");
2742 } 2748 }
2743 2749
2744 2750
2745 /**********************************************************************/ 2751 /**********************************************************************/
2746 /* staticpro */ 2752 /* staticpro */
4222 { 4228 {
4223 Lisp_Object pl = Qnil; 4229 Lisp_Object pl = Qnil;
4224 Lisp_Object ret[6]; 4230 Lisp_Object ret[6];
4225 int i; 4231 int i;
4226 4232
4233 if (purify_flag && pure_lossage)
4234 {
4235 return Qnil;
4236 }
4237
4227 garbage_collect_1 (); 4238 garbage_collect_1 ();
4228 4239
4229 for (i = 0; i < last_lrecord_type_index_assigned; i++) 4240 for (i = 0; i < last_lrecord_type_index_assigned; i++)
4230 { 4241 {
4231 if (lcrecord_stats[i].bytes_in_use != 0 4242 if (lcrecord_stats[i].bytes_in_use != 0