diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 159 |
1 files changed, 103 insertions, 56 deletions
diff --git a/src/alloc.c b/src/alloc.c index 029f205ea32..8671a702779 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -274,7 +274,7 @@ buffer_memory_full () | |||
| 274 | Fsignal (Qerror, memory_signal_data); | 274 | Fsignal (Qerror, memory_signal_data); |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | /* like malloc routines but check for no memory and block interrupt input. */ | 277 | /* Like malloc routines but check for no memory and block interrupt input. */ |
| 278 | 278 | ||
| 279 | long * | 279 | long * |
| 280 | xmalloc (size) | 280 | xmalloc (size) |
| @@ -319,6 +319,34 @@ xfree (block) | |||
| 319 | UNBLOCK_INPUT; | 319 | UNBLOCK_INPUT; |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | /* Like malloc but used for allocating Lisp data. */ | ||
| 323 | |||
| 324 | long * | ||
| 325 | lisp_malloc (size) | ||
| 326 | int size; | ||
| 327 | { | ||
| 328 | register long *val; | ||
| 329 | |||
| 330 | BLOCK_INPUT; | ||
| 331 | allocating_for_lisp++; | ||
| 332 | val = (long *) malloc (size); | ||
| 333 | allocating_for_lisp--; | ||
| 334 | UNBLOCK_INPUT; | ||
| 335 | |||
| 336 | if (!val && size) memory_full (); | ||
| 337 | return val; | ||
| 338 | } | ||
| 339 | |||
| 340 | void | ||
| 341 | lisp_free (block) | ||
| 342 | long *block; | ||
| 343 | { | ||
| 344 | BLOCK_INPUT; | ||
| 345 | allocating_for_lisp++; | ||
| 346 | free (block); | ||
| 347 | allocating_for_lisp--; | ||
| 348 | UNBLOCK_INPUT; | ||
| 349 | } | ||
| 322 | 350 | ||
| 323 | /* Arranging to disable input signals while we're in malloc. | 351 | /* Arranging to disable input signals while we're in malloc. |
| 324 | 352 | ||
| @@ -417,13 +445,16 @@ emacs_blocked_realloc (ptr, size) | |||
| 417 | void | 445 | void |
| 418 | uninterrupt_malloc () | 446 | uninterrupt_malloc () |
| 419 | { | 447 | { |
| 420 | old_free_hook = __free_hook; | 448 | if (__free_hook != emacs_blocked_free) |
| 449 | old_free_hook = __free_hook; | ||
| 421 | __free_hook = emacs_blocked_free; | 450 | __free_hook = emacs_blocked_free; |
| 422 | 451 | ||
| 423 | old_malloc_hook = __malloc_hook; | 452 | if (__malloc_hook != emacs_blocked_malloc) |
| 453 | old_malloc_hook = __malloc_hook; | ||
| 424 | __malloc_hook = emacs_blocked_malloc; | 454 | __malloc_hook = emacs_blocked_malloc; |
| 425 | 455 | ||
| 426 | old_realloc_hook = __realloc_hook; | 456 | if (__realloc_hook != emacs_blocked_realloc) |
| 457 | old_realloc_hook = __realloc_hook; | ||
| 427 | __realloc_hook = emacs_blocked_realloc; | 458 | __realloc_hook = emacs_blocked_realloc; |
| 428 | } | 459 | } |
| 429 | #endif | 460 | #endif |
| @@ -445,17 +476,19 @@ static int interval_block_index; | |||
| 445 | 476 | ||
| 446 | INTERVAL interval_free_list; | 477 | INTERVAL interval_free_list; |
| 447 | 478 | ||
| 479 | /* Total number of interval blocks now in use. */ | ||
| 480 | int n_interval_blocks; | ||
| 481 | |||
| 448 | static void | 482 | static void |
| 449 | init_intervals () | 483 | init_intervals () |
| 450 | { | 484 | { |
| 451 | allocating_for_lisp = 1; | ||
| 452 | interval_block | 485 | interval_block |
| 453 | = (struct interval_block *) malloc (sizeof (struct interval_block)); | 486 | = (struct interval_block *) lisp_malloc (sizeof (struct interval_block)); |
| 454 | allocating_for_lisp = 0; | ||
| 455 | interval_block->next = 0; | 487 | interval_block->next = 0; |
| 456 | bzero ((char *) interval_block->intervals, sizeof interval_block->intervals); | 488 | bzero ((char *) interval_block->intervals, sizeof interval_block->intervals); |
| 457 | interval_block_index = 0; | 489 | interval_block_index = 0; |
| 458 | interval_free_list = 0; | 490 | interval_free_list = 0; |
| 491 | n_interval_blocks = 1; | ||
| 459 | } | 492 | } |
| 460 | 493 | ||
| 461 | #define INIT_INTERVALS init_intervals () | 494 | #define INIT_INTERVALS init_intervals () |
| @@ -476,14 +509,13 @@ make_interval () | |||
| 476 | { | 509 | { |
| 477 | register struct interval_block *newi; | 510 | register struct interval_block *newi; |
| 478 | 511 | ||
| 479 | allocating_for_lisp = 1; | 512 | newi = (struct interval_block *) lisp_malloc (sizeof (struct interval_block)); |
| 480 | newi = (struct interval_block *) xmalloc (sizeof (struct interval_block)); | ||
| 481 | 513 | ||
| 482 | allocating_for_lisp = 0; | ||
| 483 | VALIDATE_LISP_STORAGE (newi, sizeof *newi); | 514 | VALIDATE_LISP_STORAGE (newi, sizeof *newi); |
| 484 | newi->next = interval_block; | 515 | newi->next = interval_block; |
| 485 | interval_block = newi; | 516 | interval_block = newi; |
| 486 | interval_block_index = 0; | 517 | interval_block_index = 0; |
| 518 | n_interval_blocks++; | ||
| 487 | } | 519 | } |
| 488 | val = &interval_block->intervals[interval_block_index++]; | 520 | val = &interval_block->intervals[interval_block_index++]; |
| 489 | } | 521 | } |
| @@ -576,18 +608,20 @@ struct float_block | |||
| 576 | struct float_block *float_block; | 608 | struct float_block *float_block; |
| 577 | int float_block_index; | 609 | int float_block_index; |
| 578 | 610 | ||
| 611 | /* Total number of float blocks now in use. */ | ||
| 612 | int n_float_blocks; | ||
| 613 | |||
| 579 | struct Lisp_Float *float_free_list; | 614 | struct Lisp_Float *float_free_list; |
| 580 | 615 | ||
| 581 | void | 616 | void |
| 582 | init_float () | 617 | init_float () |
| 583 | { | 618 | { |
| 584 | allocating_for_lisp = 1; | 619 | float_block = (struct float_block *) lisp_malloc (sizeof (struct float_block)); |
| 585 | float_block = (struct float_block *) malloc (sizeof (struct float_block)); | ||
| 586 | allocating_for_lisp = 0; | ||
| 587 | float_block->next = 0; | 620 | float_block->next = 0; |
| 588 | bzero ((char *) float_block->floats, sizeof float_block->floats); | 621 | bzero ((char *) float_block->floats, sizeof float_block->floats); |
| 589 | float_block_index = 0; | 622 | float_block_index = 0; |
| 590 | float_free_list = 0; | 623 | float_free_list = 0; |
| 624 | n_float_blocks = 1; | ||
| 591 | } | 625 | } |
| 592 | 626 | ||
| 593 | /* Explicitly free a float cell. */ | 627 | /* Explicitly free a float cell. */ |
| @@ -618,13 +652,12 @@ make_float (float_value) | |||
| 618 | { | 652 | { |
| 619 | register struct float_block *new; | 653 | register struct float_block *new; |
| 620 | 654 | ||
| 621 | allocating_for_lisp = 1; | 655 | new = (struct float_block *) lisp_malloc (sizeof (struct float_block)); |
| 622 | new = (struct float_block *) xmalloc (sizeof (struct float_block)); | ||
| 623 | allocating_for_lisp = 0; | ||
| 624 | VALIDATE_LISP_STORAGE (new, sizeof *new); | 656 | VALIDATE_LISP_STORAGE (new, sizeof *new); |
| 625 | new->next = float_block; | 657 | new->next = float_block; |
| 626 | float_block = new; | 658 | float_block = new; |
| 627 | float_block_index = 0; | 659 | float_block_index = 0; |
| 660 | n_float_blocks++; | ||
| 628 | } | 661 | } |
| 629 | XSETFLOAT (val, &float_block->floats[float_block_index++]); | 662 | XSETFLOAT (val, &float_block->floats[float_block_index++]); |
| 630 | } | 663 | } |
| @@ -661,16 +694,18 @@ int cons_block_index; | |||
| 661 | 694 | ||
| 662 | struct Lisp_Cons *cons_free_list; | 695 | struct Lisp_Cons *cons_free_list; |
| 663 | 696 | ||
| 697 | /* Total number of cons blocks now in use. */ | ||
| 698 | int n_cons_blocks; | ||
| 699 | |||
| 664 | void | 700 | void |
| 665 | init_cons () | 701 | init_cons () |
| 666 | { | 702 | { |
| 667 | allocating_for_lisp = 1; | 703 | cons_block = (struct cons_block *) lisp_malloc (sizeof (struct cons_block)); |
| 668 | cons_block = (struct cons_block *) malloc (sizeof (struct cons_block)); | ||
| 669 | allocating_for_lisp = 0; | ||
| 670 | cons_block->next = 0; | 704 | cons_block->next = 0; |
| 671 | bzero ((char *) cons_block->conses, sizeof cons_block->conses); | 705 | bzero ((char *) cons_block->conses, sizeof cons_block->conses); |
| 672 | cons_block_index = 0; | 706 | cons_block_index = 0; |
| 673 | cons_free_list = 0; | 707 | cons_free_list = 0; |
| 708 | n_cons_blocks = 1; | ||
| 674 | } | 709 | } |
| 675 | 710 | ||
| 676 | /* Explicitly free a cons cell. */ | 711 | /* Explicitly free a cons cell. */ |
| @@ -702,13 +737,12 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 702 | if (cons_block_index == CONS_BLOCK_SIZE) | 737 | if (cons_block_index == CONS_BLOCK_SIZE) |
| 703 | { | 738 | { |
| 704 | register struct cons_block *new; | 739 | register struct cons_block *new; |
| 705 | allocating_for_lisp = 1; | 740 | new = (struct cons_block *) lisp_malloc (sizeof (struct cons_block)); |
| 706 | new = (struct cons_block *) xmalloc (sizeof (struct cons_block)); | ||
| 707 | allocating_for_lisp = 0; | ||
| 708 | VALIDATE_LISP_STORAGE (new, sizeof *new); | 741 | VALIDATE_LISP_STORAGE (new, sizeof *new); |
| 709 | new->next = cons_block; | 742 | new->next = cons_block; |
| 710 | cons_block = new; | 743 | cons_block = new; |
| 711 | cons_block_index = 0; | 744 | cons_block_index = 0; |
| 745 | n_cons_blocks++; | ||
| 712 | } | 746 | } |
| 713 | XSETCONS (val, &cons_block->conses[cons_block_index++]); | 747 | XSETCONS (val, &cons_block->conses[cons_block_index++]); |
| 714 | } | 748 | } |
| @@ -789,28 +823,30 @@ DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0, | |||
| 789 | 823 | ||
| 790 | struct Lisp_Vector *all_vectors; | 824 | struct Lisp_Vector *all_vectors; |
| 791 | 825 | ||
| 826 | /* Total number of vectorlike objects now in use. */ | ||
| 827 | int n_vectors; | ||
| 828 | |||
| 792 | struct Lisp_Vector * | 829 | struct Lisp_Vector * |
| 793 | allocate_vectorlike (len) | 830 | allocate_vectorlike (len) |
| 794 | EMACS_INT len; | 831 | EMACS_INT len; |
| 795 | { | 832 | { |
| 796 | struct Lisp_Vector *p; | 833 | struct Lisp_Vector *p; |
| 797 | 834 | ||
| 798 | allocating_for_lisp = 1; | ||
| 799 | #ifdef DOUG_LEA_MALLOC | 835 | #ifdef DOUG_LEA_MALLOC |
| 800 | /* Prevent mmap'ing the chunk (which is potentially very large). */ | 836 | /* Prevent mmap'ing the chunk (which is potentially very large). */ |
| 801 | mallopt (M_MMAP_MAX, 0); | 837 | mallopt (M_MMAP_MAX, 0); |
| 802 | #endif | 838 | #endif |
| 803 | p = (struct Lisp_Vector *)xmalloc (sizeof (struct Lisp_Vector) | 839 | p = (struct Lisp_Vector *)lisp_malloc (sizeof (struct Lisp_Vector) |
| 804 | + (len - 1) * sizeof (Lisp_Object)); | 840 | + (len - 1) * sizeof (Lisp_Object)); |
| 805 | #ifdef DOUG_LEA_MALLOC | 841 | #ifdef DOUG_LEA_MALLOC |
| 806 | /* Back to a reasonable maximum of mmap'ed areas. */ | 842 | /* Back to a reasonable maximum of mmap'ed areas. */ |
| 807 | mallopt (M_MMAP_MAX, 64); | 843 | mallopt (M_MMAP_MAX, 64); |
| 808 | #endif | 844 | #endif |
| 809 | allocating_for_lisp = 0; | ||
| 810 | VALIDATE_LISP_STORAGE (p, 0); | 845 | VALIDATE_LISP_STORAGE (p, 0); |
| 811 | consing_since_gc += (sizeof (struct Lisp_Vector) | 846 | consing_since_gc += (sizeof (struct Lisp_Vector) |
| 812 | + (len - 1) * sizeof (Lisp_Object)); | 847 | + (len - 1) * sizeof (Lisp_Object)); |
| 813 | vector_cells_consed += len; | 848 | vector_cells_consed += len; |
| 849 | n_vectors; | ||
| 814 | 850 | ||
| 815 | p->next = all_vectors; | 851 | p->next = all_vectors; |
| 816 | all_vectors = p; | 852 | all_vectors = p; |
| @@ -951,16 +987,18 @@ int symbol_block_index; | |||
| 951 | 987 | ||
| 952 | struct Lisp_Symbol *symbol_free_list; | 988 | struct Lisp_Symbol *symbol_free_list; |
| 953 | 989 | ||
| 990 | /* Total number of symbol blocks now in use. */ | ||
| 991 | int n_symbol_blocks; | ||
| 992 | |||
| 954 | void | 993 | void |
| 955 | init_symbol () | 994 | init_symbol () |
| 956 | { | 995 | { |
| 957 | allocating_for_lisp = 1; | 996 | symbol_block = (struct symbol_block *) lisp_malloc (sizeof (struct symbol_block)); |
| 958 | symbol_block = (struct symbol_block *) malloc (sizeof (struct symbol_block)); | ||
| 959 | allocating_for_lisp = 0; | ||
| 960 | symbol_block->next = 0; | 997 | symbol_block->next = 0; |
| 961 | bzero ((char *) symbol_block->symbols, sizeof symbol_block->symbols); | 998 | bzero ((char *) symbol_block->symbols, sizeof symbol_block->symbols); |
| 962 | symbol_block_index = 0; | 999 | symbol_block_index = 0; |
| 963 | symbol_free_list = 0; | 1000 | symbol_free_list = 0; |
| 1001 | n_symbol_blocks = 1; | ||
| 964 | } | 1002 | } |
| 965 | 1003 | ||
| 966 | DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, | 1004 | DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, |
| @@ -984,13 +1022,12 @@ Its value and function definition are void, and its property list is nil.") | |||
| 984 | if (symbol_block_index == SYMBOL_BLOCK_SIZE) | 1022 | if (symbol_block_index == SYMBOL_BLOCK_SIZE) |
| 985 | { | 1023 | { |
| 986 | struct symbol_block *new; | 1024 | struct symbol_block *new; |
| 987 | allocating_for_lisp = 1; | 1025 | new = (struct symbol_block *) lisp_malloc (sizeof (struct symbol_block)); |
| 988 | new = (struct symbol_block *) xmalloc (sizeof (struct symbol_block)); | ||
| 989 | allocating_for_lisp = 0; | ||
| 990 | VALIDATE_LISP_STORAGE (new, sizeof *new); | 1026 | VALIDATE_LISP_STORAGE (new, sizeof *new); |
| 991 | new->next = symbol_block; | 1027 | new->next = symbol_block; |
| 992 | symbol_block = new; | 1028 | symbol_block = new; |
| 993 | symbol_block_index = 0; | 1029 | symbol_block_index = 0; |
| 1030 | n_symbol_blocks++; | ||
| 994 | } | 1031 | } |
| 995 | XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index++]); | 1032 | XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index++]); |
| 996 | } | 1033 | } |
| @@ -1013,7 +1050,7 @@ Its value and function definition are void, and its property list is nil.") | |||
| 1013 | ((1020 - sizeof (struct marker_block *)) / sizeof (union Lisp_Misc)) | 1050 | ((1020 - sizeof (struct marker_block *)) / sizeof (union Lisp_Misc)) |
| 1014 | 1051 | ||
| 1015 | struct marker_block | 1052 | struct marker_block |
| 1016 | { | 1053 | { |
| 1017 | struct marker_block *next; | 1054 | struct marker_block *next; |
| 1018 | union Lisp_Misc markers[MARKER_BLOCK_SIZE]; | 1055 | union Lisp_Misc markers[MARKER_BLOCK_SIZE]; |
| 1019 | }; | 1056 | }; |
| @@ -1023,16 +1060,18 @@ int marker_block_index; | |||
| 1023 | 1060 | ||
| 1024 | union Lisp_Misc *marker_free_list; | 1061 | union Lisp_Misc *marker_free_list; |
| 1025 | 1062 | ||
| 1063 | /* Total number of marker blocks now in use. */ | ||
| 1064 | int n_marker_blocks; | ||
| 1065 | |||
| 1026 | void | 1066 | void |
| 1027 | init_marker () | 1067 | init_marker () |
| 1028 | { | 1068 | { |
| 1029 | allocating_for_lisp = 1; | 1069 | marker_block = (struct marker_block *) lisp_malloc (sizeof (struct marker_block)); |
| 1030 | marker_block = (struct marker_block *) malloc (sizeof (struct marker_block)); | ||
| 1031 | allocating_for_lisp = 0; | ||
| 1032 | marker_block->next = 0; | 1070 | marker_block->next = 0; |
| 1033 | bzero ((char *) marker_block->markers, sizeof marker_block->markers); | 1071 | bzero ((char *) marker_block->markers, sizeof marker_block->markers); |
| 1034 | marker_block_index = 0; | 1072 | marker_block_index = 0; |
| 1035 | marker_free_list = 0; | 1073 | marker_free_list = 0; |
| 1074 | n_marker_blocks = 1; | ||
| 1036 | } | 1075 | } |
| 1037 | 1076 | ||
| 1038 | /* Return a newly allocated Lisp_Misc object, with no substructure. */ | 1077 | /* Return a newly allocated Lisp_Misc object, with no substructure. */ |
| @@ -1051,13 +1090,12 @@ allocate_misc () | |||
| 1051 | if (marker_block_index == MARKER_BLOCK_SIZE) | 1090 | if (marker_block_index == MARKER_BLOCK_SIZE) |
| 1052 | { | 1091 | { |
| 1053 | struct marker_block *new; | 1092 | struct marker_block *new; |
| 1054 | allocating_for_lisp = 1; | 1093 | new = (struct marker_block *) lisp_malloc (sizeof (struct marker_block)); |
| 1055 | new = (struct marker_block *) xmalloc (sizeof (struct marker_block)); | ||
| 1056 | allocating_for_lisp = 0; | ||
| 1057 | VALIDATE_LISP_STORAGE (new, sizeof *new); | 1094 | VALIDATE_LISP_STORAGE (new, sizeof *new); |
| 1058 | new->next = marker_block; | 1095 | new->next = marker_block; |
| 1059 | marker_block = new; | 1096 | marker_block = new; |
| 1060 | marker_block_index = 0; | 1097 | marker_block_index = 0; |
| 1098 | n_marker_blocks++; | ||
| 1061 | } | 1099 | } |
| 1062 | XSETMISC (val, &marker_block->markers[marker_block_index++]); | 1100 | XSETMISC (val, &marker_block->markers[marker_block_index++]); |
| 1063 | } | 1101 | } |
| @@ -1165,18 +1203,20 @@ struct string_block *large_string_blocks; | |||
| 1165 | (((SIZE) + 2 * sizeof (EMACS_INT)) & ~(sizeof (EMACS_INT) - 1)) | 1203 | (((SIZE) + 2 * sizeof (EMACS_INT)) & ~(sizeof (EMACS_INT) - 1)) |
| 1166 | #endif | 1204 | #endif |
| 1167 | 1205 | ||
| 1206 | /* Total number of string blocks now in use. */ | ||
| 1207 | int n_string_blocks; | ||
| 1208 | |||
| 1168 | void | 1209 | void |
| 1169 | init_strings () | 1210 | init_strings () |
| 1170 | { | 1211 | { |
| 1171 | allocating_for_lisp = 1; | 1212 | current_string_block = (struct string_block *) lisp_malloc (sizeof (struct string_block)); |
| 1172 | current_string_block = (struct string_block *) malloc (sizeof (struct string_block)); | ||
| 1173 | allocating_for_lisp = 0; | ||
| 1174 | first_string_block = current_string_block; | 1213 | first_string_block = current_string_block; |
| 1175 | consing_since_gc += sizeof (struct string_block); | 1214 | consing_since_gc += sizeof (struct string_block); |
| 1176 | current_string_block->next = 0; | 1215 | current_string_block->next = 0; |
| 1177 | current_string_block->prev = 0; | 1216 | current_string_block->prev = 0; |
| 1178 | current_string_block->pos = 0; | 1217 | current_string_block->pos = 0; |
| 1179 | large_string_blocks = 0; | 1218 | large_string_blocks = 0; |
| 1219 | n_string_blocks = 1; | ||
| 1180 | } | 1220 | } |
| 1181 | 1221 | ||
| 1182 | DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, | 1222 | DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, |
| @@ -1380,17 +1420,16 @@ make_uninit_multibyte_string (length, length_byte) | |||
| 1380 | /* This string gets its own string block */ | 1420 | /* This string gets its own string block */ |
| 1381 | { | 1421 | { |
| 1382 | register struct string_block *new; | 1422 | register struct string_block *new; |
| 1383 | allocating_for_lisp = 1; | ||
| 1384 | #ifdef DOUG_LEA_MALLOC | 1423 | #ifdef DOUG_LEA_MALLOC |
| 1385 | /* Prevent mmap'ing the chunk (which is potentially very large). */ | 1424 | /* Prevent mmap'ing the chunk (which is potentially very large). */ |
| 1386 | mallopt (M_MMAP_MAX, 0); | 1425 | mallopt (M_MMAP_MAX, 0); |
| 1387 | #endif | 1426 | #endif |
| 1388 | new = (struct string_block *) xmalloc (sizeof (struct string_block_head) + fullsize); | 1427 | new = (struct string_block *) lisp_malloc (sizeof (struct string_block_head) + fullsize); |
| 1389 | #ifdef DOUG_LEA_MALLOC | 1428 | #ifdef DOUG_LEA_MALLOC |
| 1390 | /* Back to a reasonable maximum of mmap'ed areas. */ | 1429 | /* Back to a reasonable maximum of mmap'ed areas. */ |
| 1391 | mallopt (M_MMAP_MAX, 64); | 1430 | mallopt (M_MMAP_MAX, 64); |
| 1392 | #endif | 1431 | #endif |
| 1393 | allocating_for_lisp = 0; | 1432 | n_string_blocks++; |
| 1394 | VALIDATE_LISP_STORAGE (new, 0); | 1433 | VALIDATE_LISP_STORAGE (new, 0); |
| 1395 | consing_since_gc += sizeof (struct string_block_head) + fullsize; | 1434 | consing_since_gc += sizeof (struct string_block_head) + fullsize; |
| 1396 | new->pos = fullsize; | 1435 | new->pos = fullsize; |
| @@ -1404,9 +1443,8 @@ make_uninit_multibyte_string (length, length_byte) | |||
| 1404 | /* Make a new current string block and start it off with this string */ | 1443 | /* Make a new current string block and start it off with this string */ |
| 1405 | { | 1444 | { |
| 1406 | register struct string_block *new; | 1445 | register struct string_block *new; |
| 1407 | allocating_for_lisp = 1; | 1446 | new = (struct string_block *) lisp_malloc (sizeof (struct string_block)); |
| 1408 | new = (struct string_block *) xmalloc (sizeof (struct string_block)); | 1447 | n_string_blocks++; |
| 1409 | allocating_for_lisp = 0; | ||
| 1410 | VALIDATE_LISP_STORAGE (new, sizeof *new); | 1448 | VALIDATE_LISP_STORAGE (new, sizeof *new); |
| 1411 | consing_since_gc += sizeof (struct string_block); | 1449 | consing_since_gc += sizeof (struct string_block); |
| 1412 | current_string_block->next = new; | 1450 | current_string_block->next = new; |
| @@ -2402,7 +2440,8 @@ gc_sweep () | |||
| 2402 | *cprev = cblk->next; | 2440 | *cprev = cblk->next; |
| 2403 | /* Unhook from the free list. */ | 2441 | /* Unhook from the free list. */ |
| 2404 | cons_free_list = *(struct Lisp_Cons **) &cblk->conses[0].cdr; | 2442 | cons_free_list = *(struct Lisp_Cons **) &cblk->conses[0].cdr; |
| 2405 | xfree (cblk); | 2443 | lisp_free (cblk); |
| 2444 | n_cons_blocks--; | ||
| 2406 | } | 2445 | } |
| 2407 | else | 2446 | else |
| 2408 | { | 2447 | { |
| @@ -2449,7 +2488,8 @@ gc_sweep () | |||
| 2449 | *fprev = fblk->next; | 2488 | *fprev = fblk->next; |
| 2450 | /* Unhook from the free list. */ | 2489 | /* Unhook from the free list. */ |
| 2451 | float_free_list = *(struct Lisp_Float **) &fblk->floats[0].data; | 2490 | float_free_list = *(struct Lisp_Float **) &fblk->floats[0].data; |
| 2452 | xfree (fblk); | 2491 | lisp_free (fblk); |
| 2492 | n_float_blocks--; | ||
| 2453 | } | 2493 | } |
| 2454 | else | 2494 | else |
| 2455 | { | 2495 | { |
| @@ -2500,7 +2540,8 @@ gc_sweep () | |||
| 2500 | *iprev = iblk->next; | 2540 | *iprev = iblk->next; |
| 2501 | /* Unhook from the free list. */ | 2541 | /* Unhook from the free list. */ |
| 2502 | interval_free_list = iblk->intervals[0].parent; | 2542 | interval_free_list = iblk->intervals[0].parent; |
| 2503 | xfree (iblk); | 2543 | lisp_free (iblk); |
| 2544 | n_interval_blocks--; | ||
| 2504 | } | 2545 | } |
| 2505 | else | 2546 | else |
| 2506 | { | 2547 | { |
| @@ -2549,7 +2590,8 @@ gc_sweep () | |||
| 2549 | *sprev = sblk->next; | 2590 | *sprev = sblk->next; |
| 2550 | /* Unhook from the free list. */ | 2591 | /* Unhook from the free list. */ |
| 2551 | symbol_free_list = *(struct Lisp_Symbol **)&sblk->symbols[0].value; | 2592 | symbol_free_list = *(struct Lisp_Symbol **)&sblk->symbols[0].value; |
| 2552 | xfree (sblk); | 2593 | lisp_free (sblk); |
| 2594 | n_symbol_blocks--; | ||
| 2553 | } | 2595 | } |
| 2554 | else | 2596 | else |
| 2555 | { | 2597 | { |
| @@ -2636,7 +2678,8 @@ gc_sweep () | |||
| 2636 | *mprev = mblk->next; | 2678 | *mprev = mblk->next; |
| 2637 | /* Unhook from the free list. */ | 2679 | /* Unhook from the free list. */ |
| 2638 | marker_free_list = mblk->markers[0].u_free.chain; | 2680 | marker_free_list = mblk->markers[0].u_free.chain; |
| 2639 | xfree (mblk); | 2681 | lisp_free (mblk); |
| 2682 | n_marker_blocks--; | ||
| 2640 | } | 2683 | } |
| 2641 | else | 2684 | else |
| 2642 | { | 2685 | { |
| @@ -2702,7 +2745,8 @@ gc_sweep () | |||
| 2702 | else | 2745 | else |
| 2703 | all_vectors = vector->next; | 2746 | all_vectors = vector->next; |
| 2704 | next = vector->next; | 2747 | next = vector->next; |
| 2705 | xfree (vector); | 2748 | lisp_free (vector); |
| 2749 | n_vectors--; | ||
| 2706 | vector = next; | 2750 | vector = next; |
| 2707 | } | 2751 | } |
| 2708 | else | 2752 | else |
| @@ -2739,8 +2783,9 @@ gc_sweep () | |||
| 2739 | else | 2783 | else |
| 2740 | large_string_blocks = sb->next; | 2784 | large_string_blocks = sb->next; |
| 2741 | next = sb->next; | 2785 | next = sb->next; |
| 2742 | xfree (sb); | 2786 | lisp_free (sb); |
| 2743 | sb = next; | 2787 | sb = next; |
| 2788 | n_string_blocks--; | ||
| 2744 | } | 2789 | } |
| 2745 | } | 2790 | } |
| 2746 | } | 2791 | } |
| @@ -2867,7 +2912,8 @@ compact_strings () | |||
| 2867 | while (from_sb) | 2912 | while (from_sb) |
| 2868 | { | 2913 | { |
| 2869 | to_sb = from_sb->next; | 2914 | to_sb = from_sb->next; |
| 2870 | xfree (from_sb); | 2915 | lisp_free (from_sb); |
| 2916 | n_string_blocks--; | ||
| 2871 | from_sb = to_sb; | 2917 | from_sb = to_sb; |
| 2872 | } | 2918 | } |
| 2873 | 2919 | ||
| @@ -2882,7 +2928,8 @@ compact_strings () | |||
| 2882 | { | 2928 | { |
| 2883 | if (from_sb->next = to_sb->next) | 2929 | if (from_sb->next = to_sb->next) |
| 2884 | from_sb->next->prev = from_sb; | 2930 | from_sb->next->prev = from_sb; |
| 2885 | xfree (to_sb); | 2931 | lisp_free (to_sb); |
| 2932 | n_string_blocks--; | ||
| 2886 | } | 2933 | } |
| 2887 | else | 2934 | else |
| 2888 | from_sb = to_sb; | 2935 | from_sb = to_sb; |