comparison src/sheap.c @ 5125:b5df3737028a ben-lisp-object

merge
author Ben Wing <ben@xemacs.org>
date Wed, 24 Feb 2010 01:58:04 -0600
parents 19a72041c5ed
children 308d34e9f07d
comparison
equal deleted inserted replaced
5124:623d57b7fbe8 5125:b5df3737028a
25 25
26 #include <unistd.h> 26 #include <unistd.h>
27 #include <sheap-adjust.h> 27 #include <sheap-adjust.h>
28 28
29 #define STATIC_HEAP_BASE 0x800000 29 #define STATIC_HEAP_BASE 0x800000
30 #define STATIC_HEAP_SLOP 0x40000 30 #define STATIC_HEAP_SLOP 0x80000
31 #define STATIC_HEAP_SIZE \ 31 #define STATIC_HEAP_SIZE \
32 (STATIC_HEAP_BASE + SHEAP_ADJUSTMENT + STATIC_HEAP_SLOP) 32 (STATIC_HEAP_BASE + SHEAP_ADJUSTMENT + STATIC_HEAP_SLOP)
33 #define BLOCKSIZE (1<<12) 33 #define BLOCKSIZE (1<<12)
34 #define ALLOC_UNIT (BLOCKSIZE-1) 34 #define ALLOC_UNIT (BLOCKSIZE-1)
35 #define ALLOC_MASK ~((unsigned long)(ALLOC_UNIT)) 35 #define ALLOC_MASK ~((unsigned long)(ALLOC_UNIT))
82 { 82 {
83 if (static_heap_ptr + size >= static_heap_base + static_heap_size) 83 if (static_heap_ptr + size >= static_heap_base + static_heap_size)
84 { 84 {
85 printf ( 85 printf (
86 "\nRequested %d bytes, static heap exhausted! base is %p, current ptr\n" 86 "\nRequested %d bytes, static heap exhausted! base is %p, current ptr\n"
87 "is %p. You have exhausted the static heap. \n" 87 "is %p, static heap size is %ld. You have exhausted the static heap. \n"
88 "\n" 88 "\n"
89 "If you are simply trying to compile, remove sheap-adjust.h\n" 89 "If you are simply trying to compile, remove sheap-adjust.h\n"
90 "and recompile from the top level. If this doesn't\n" 90 "and recompile from the top level. If this doesn't\n"
91 "work then STATIC_HEAP_SLOP (defined in this file) is too small.\n" 91 "work then STATIC_HEAP_SLOP (defined in this file) is too small.\n"
92 "\n" 92 "\n"
93 "If you want to run temacs, change SHEAP_ADJUSTMENT in sheap-adjust.h\n" 93 "If you want to run temacs, change SHEAP_ADJUSTMENT in sheap-adjust.h\n"
94 "to 0 or a +ve number. Generally you should *not* try to run temacs\n" 94 "to 0 or a +ve number. Generally you should *not* try to run temacs\n"
95 "with a static heap, you should dump first.\n", 95 "with a static heap, you should dump first.\n",
96 size, static_heap_base, static_heap_ptr); 96 size, static_heap_base, static_heap_ptr, static_heap_size);
97 97
98 exit(-1); 98 exit(-1);
99 return 0; 99 return 0;
100 } 100 }
101 } 101 }
109 { 109 {
110 FILE *stream = retry_fopen ("sheap-adjust.h", "w"); 110 FILE *stream = retry_fopen ("sheap-adjust.h", "w");
111 111
112 if (stream == NULL) 112 if (stream == NULL)
113 report_file_error ("Opening sheap adjustment file", 113 report_file_error ("Opening sheap adjustment file",
114 build_string ("sheap-adjust.h")); 114 build_ascstring ("sheap-adjust.h"));
115 115
116 fprintf (stream, 116 fprintf (stream,
117 "/*\tDo not edit this file!\n" 117 "/*\tDo not edit this file!\n"
118 "\tAutomatically generated by XEmacs */\n" 118 "\tAutomatically generated by XEmacs */\n"
119 "# define SHEAP_ADJUSTMENT (%ld)\n", adjust); 119 "# define SHEAP_ADJUSTMENT (%ld)\n", adjust);