comparison src/alloc.c @ 27727:9400865ec7cf

Remove `LISP_FLOAT_TYPE' and `standalone'.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 17 Feb 2000 09:45:46 +0000
parents 46cf02cace2d
children 581c76c41ca4
comparison
equal deleted inserted replaced
27726:9627810a3fed 27727:9400865ec7cf
149 int undo_limit; 149 int undo_limit;
150 int undo_strong_limit; 150 int undo_strong_limit;
151 151
152 int total_conses, total_markers, total_symbols, total_vector_size; 152 int total_conses, total_markers, total_symbols, total_vector_size;
153 int total_free_conses, total_free_markers, total_free_symbols; 153 int total_free_conses, total_free_markers, total_free_symbols;
154 #ifdef LISP_FLOAT_TYPE
155 int total_free_floats, total_floats; 154 int total_free_floats, total_floats;
156 #endif /* LISP_FLOAT_TYPE */
157 155
158 /* Points to memory space allocated as "spare", to be freed if we run 156 /* Points to memory space allocated as "spare", to be freed if we run
159 out of memory. */ 157 out of memory. */
160 158
161 static char *spare_memory; 159 static char *spare_memory;
1343 1341
1344 /*********************************************************************** 1342 /***********************************************************************
1345 Float Allocation 1343 Float Allocation
1346 ***********************************************************************/ 1344 ***********************************************************************/
1347 1345
1348 #ifdef LISP_FLOAT_TYPE
1349
1350 /* We store float cells inside of float_blocks, allocating a new 1346 /* We store float cells inside of float_blocks, allocating a new
1351 float_block with malloc whenever necessary. Float cells reclaimed 1347 float_block with malloc whenever necessary. Float cells reclaimed
1352 by GC are put on a free list to be reallocated before allocating 1348 by GC are put on a free list to be reallocated before allocating
1353 any new float cells from the latest float_block. 1349 any new float cells from the latest float_block.
1354 1350
1428 XSETFASTINT (XFLOAT (val)->type, 0); /* bug chasing -wsr */ 1424 XSETFASTINT (XFLOAT (val)->type, 0); /* bug chasing -wsr */
1429 consing_since_gc += sizeof (struct Lisp_Float); 1425 consing_since_gc += sizeof (struct Lisp_Float);
1430 floats_consed++; 1426 floats_consed++;
1431 return val; 1427 return val;
1432 } 1428 }
1433
1434 #endif /* LISP_FLOAT_TYPE */
1435 1429
1436 1430
1437 1431
1438 /*********************************************************************** 1432 /***********************************************************************
1439 Cons Allocation 1433 Cons Allocation
2029 XCAR (new) = Fpurecopy (car); 2023 XCAR (new) = Fpurecopy (car);
2030 XCDR (new) = Fpurecopy (cdr); 2024 XCDR (new) = Fpurecopy (cdr);
2031 return new; 2025 return new;
2032 } 2026 }
2033 2027
2034 #ifdef LISP_FLOAT_TYPE
2035 2028
2036 Lisp_Object 2029 Lisp_Object
2037 make_pure_float (num) 2030 make_pure_float (num)
2038 double num; 2031 double num;
2039 { 2032 {
2067 XFLOAT_DATA (new) = num; 2060 XFLOAT_DATA (new) = num;
2068 XSETFASTINT (XFLOAT (new)->type, 0); /* bug chasing -wsr */ 2061 XSETFASTINT (XFLOAT (new)->type, 0); /* bug chasing -wsr */
2069 return new; 2062 return new;
2070 } 2063 }
2071 2064
2072 #endif /* LISP_FLOAT_TYPE */
2073
2074 Lisp_Object 2065 Lisp_Object
2075 make_pure_vector (len) 2066 make_pure_vector (len)
2076 EMACS_INT len; 2067 EMACS_INT len;
2077 { 2068 {
2078 register Lisp_Object new; 2069 register Lisp_Object new;
2101 && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure) 2092 && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure)
2102 return obj; 2093 return obj;
2103 2094
2104 if (CONSP (obj)) 2095 if (CONSP (obj))
2105 return pure_cons (XCAR (obj), XCDR (obj)); 2096 return pure_cons (XCAR (obj), XCDR (obj));
2106 #ifdef LISP_FLOAT_TYPE
2107 else if (FLOATP (obj)) 2097 else if (FLOATP (obj))
2108 return make_pure_float (XFLOAT_DATA (obj)); 2098 return make_pure_float (XFLOAT_DATA (obj));
2109 #endif /* LISP_FLOAT_TYPE */
2110 else if (STRINGP (obj)) 2099 else if (STRINGP (obj))
2111 return make_pure_string (XSTRING (obj)->data, XSTRING (obj)->size, 2100 return make_pure_string (XSTRING (obj)->data, XSTRING (obj)->size,
2112 STRING_BYTES (XSTRING (obj)), 2101 STRING_BYTES (XSTRING (obj)),
2113 STRING_MULTIBYTE (obj)); 2102 STRING_MULTIBYTE (obj));
2114 else if (COMPILEDP (obj) || VECTORP (obj)) 2103 else if (COMPILEDP (obj) || VECTORP (obj))
2415 make_number (total_free_symbols)); 2404 make_number (total_free_symbols));
2416 total[2] = Fcons (make_number (total_markers), 2405 total[2] = Fcons (make_number (total_markers),
2417 make_number (total_free_markers)); 2406 make_number (total_free_markers));
2418 total[3] = Fcons (make_number (total_string_size), 2407 total[3] = Fcons (make_number (total_string_size),
2419 make_number (total_vector_size)); 2408 make_number (total_vector_size));
2420 #ifdef LISP_FLOAT_TYPE
2421 total[4] = Fcons (make_number (total_floats), 2409 total[4] = Fcons (make_number (total_floats),
2422 make_number (total_free_floats)); 2410 make_number (total_free_floats));
2423 #else
2424 total[4] = Fcons (make_number (0), make_number (0));
2425 #endif
2426 total[5] = Fcons (make_number (total_intervals), 2411 total[5] = Fcons (make_number (total_intervals),
2427 make_number (total_free_intervals)); 2412 make_number (total_free_intervals));
2428 total[6] = Fcons (make_number (total_strings), 2413 total[6] = Fcons (make_number (total_strings),
2429 make_number (total_free_strings)); 2414 make_number (total_free_strings));
2430 2415
2883 /* See comment above under Lisp_Vector for why not use ptr here. */ 2868 /* See comment above under Lisp_Vector for why not use ptr here. */
2884 objptr = &XCDR (obj); 2869 objptr = &XCDR (obj);
2885 goto loop; 2870 goto loop;
2886 } 2871 }
2887 2872
2888 #ifdef LISP_FLOAT_TYPE
2889 case Lisp_Float: 2873 case Lisp_Float:
2890 XMARK (XFLOAT (obj)->type); 2874 XMARK (XFLOAT (obj)->type);
2891 break; 2875 break;
2892 #endif /* LISP_FLOAT_TYPE */
2893 2876
2894 case Lisp_Int: 2877 case Lisp_Int:
2895 break; 2878 break;
2896 2879
2897 default: 2880 default:
3055 3038
3056 case Lisp_Cons: 3039 case Lisp_Cons:
3057 survives_p = XMARKBIT (XCAR (obj)); 3040 survives_p = XMARKBIT (XCAR (obj));
3058 break; 3041 break;
3059 3042
3060 #ifdef LISP_FLOAT_TYPE
3061 case Lisp_Float: 3043 case Lisp_Float:
3062 survives_p = XMARKBIT (XFLOAT (obj)->type); 3044 survives_p = XMARKBIT (XFLOAT (obj)->type);
3063 break; 3045 break;
3064 #endif /* LISP_FLOAT_TYPE */
3065 3046
3066 default: 3047 default:
3067 abort (); 3048 abort ();
3068 } 3049 }
3069 3050
3128 } 3109 }
3129 total_conses = num_used; 3110 total_conses = num_used;
3130 total_free_conses = num_free; 3111 total_free_conses = num_free;
3131 } 3112 }
3132 3113
3133 #ifdef LISP_FLOAT_TYPE
3134 /* Put all unmarked floats on free list */ 3114 /* Put all unmarked floats on free list */
3135 { 3115 {
3136 register struct float_block *fblk; 3116 register struct float_block *fblk;
3137 struct float_block **fprev = &float_block; 3117 struct float_block **fprev = &float_block;
3138 register int lim = float_block_index; 3118 register int lim = float_block_index;
3175 } 3155 }
3176 } 3156 }
3177 total_floats = num_used; 3157 total_floats = num_used;
3178 total_free_floats = num_free; 3158 total_free_floats = num_free;
3179 } 3159 }
3180 #endif /* LISP_FLOAT_TYPE */
3181 3160
3182 /* Put all unmarked intervals on free list */ 3161 /* Put all unmarked intervals on free list */
3183 { 3162 {
3184 register struct interval_block *iblk; 3163 register struct interval_block *iblk;
3185 struct interval_block **iprev = &interval_block; 3164 struct interval_block **iprev = &interval_block;
3497 #endif 3476 #endif
3498 init_strings (); 3477 init_strings ();
3499 init_cons (); 3478 init_cons ();
3500 init_symbol (); 3479 init_symbol ();
3501 init_marker (); 3480 init_marker ();
3502 #ifdef LISP_FLOAT_TYPE
3503 init_float (); 3481 init_float ();
3504 #endif /* LISP_FLOAT_TYPE */
3505 INIT_INTERVALS; 3482 INIT_INTERVALS;
3506 3483
3507 #ifdef REL_ALLOC 3484 #ifdef REL_ALLOC
3508 malloc_hysteresis = 32; 3485 malloc_hysteresis = 32;
3509 #else 3486 #else