diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/src/alloc.c b/src/alloc.c index f73edcd70e9..102bc637b58 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -552,7 +552,7 @@ xrealloc (block, size) | |||
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | 554 | ||
| 555 | /* Like free but block interrupt input. */ | 555 | /* Like free but block interrupt input.. */ |
| 556 | 556 | ||
| 557 | void | 557 | void |
| 558 | xfree (block) | 558 | xfree (block) |
| @@ -738,8 +738,7 @@ lisp_align_malloc (nbytes, type) | |||
| 738 | 738 | ||
| 739 | if (!free_ablock) | 739 | if (!free_ablock) |
| 740 | { | 740 | { |
| 741 | int i; | 741 | int i, aligned; |
| 742 | EMACS_INT aligned; /* int gets warning casting to 64-bit pointer. */ | ||
| 743 | 742 | ||
| 744 | #ifdef DOUG_LEA_MALLOC | 743 | #ifdef DOUG_LEA_MALLOC |
| 745 | /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed | 744 | /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed |
| @@ -767,23 +766,6 @@ lisp_align_malloc (nbytes, type) | |||
| 767 | mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); | 766 | mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); |
| 768 | #endif | 767 | #endif |
| 769 | 768 | ||
| 770 | /* If the memory just allocated cannot be addressed thru a Lisp | ||
| 771 | object's pointer, and it needs to be, that's equivalent to | ||
| 772 | running out of memory. */ | ||
| 773 | if (type != MEM_TYPE_NON_LISP) | ||
| 774 | { | ||
| 775 | Lisp_Object tem; | ||
| 776 | char *end = (char *) base + ABLOCKS_BYTES - 1; | ||
| 777 | XSETCONS (tem, end); | ||
| 778 | if ((char *) XCONS (tem) != end) | ||
| 779 | { | ||
| 780 | lisp_malloc_loser = base; | ||
| 781 | free (base); | ||
| 782 | UNBLOCK_INPUT; | ||
| 783 | memory_full (); | ||
| 784 | } | ||
| 785 | } | ||
| 786 | |||
| 787 | /* Initialize the blocks and put them on the free list. | 769 | /* Initialize the blocks and put them on the free list. |
| 788 | Is `base' was not properly aligned, we can't use the last block. */ | 770 | Is `base' was not properly aligned, we can't use the last block. */ |
| 789 | for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++) | 771 | for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++) |
| @@ -806,6 +788,21 @@ lisp_align_malloc (nbytes, type) | |||
| 806 | val = free_ablock; | 788 | val = free_ablock; |
| 807 | free_ablock = free_ablock->x.next_free; | 789 | free_ablock = free_ablock->x.next_free; |
| 808 | 790 | ||
| 791 | /* If the memory just allocated cannot be addressed thru a Lisp | ||
| 792 | object's pointer, and it needs to be, | ||
| 793 | that's equivalent to running out of memory. */ | ||
| 794 | if (val && type != MEM_TYPE_NON_LISP) | ||
| 795 | { | ||
| 796 | Lisp_Object tem; | ||
| 797 | XSETCONS (tem, (char *) val + nbytes - 1); | ||
| 798 | if ((char *) XCONS (tem) != (char *) val + nbytes - 1) | ||
| 799 | { | ||
| 800 | lisp_malloc_loser = val; | ||
| 801 | free (val); | ||
| 802 | val = 0; | ||
| 803 | } | ||
| 804 | } | ||
| 805 | |||
| 809 | #if GC_MARK_STACK && !defined GC_MALLOC_CHECK | 806 | #if GC_MARK_STACK && !defined GC_MALLOC_CHECK |
| 810 | if (val && type != MEM_TYPE_NON_LISP) | 807 | if (val && type != MEM_TYPE_NON_LISP) |
| 811 | mem_insert (val, (char *) val + nbytes, type); | 808 | mem_insert (val, (char *) val + nbytes, type); |
| @@ -5027,7 +5024,6 @@ mark_object (arg) | |||
| 5027 | since all markable slots in current buffer marked anyway. */ | 5024 | since all markable slots in current buffer marked anyway. */ |
| 5028 | /* Don't need to do Lisp_Objfwd, since the places they point | 5025 | /* Don't need to do Lisp_Objfwd, since the places they point |
| 5029 | are protected with staticpro. */ | 5026 | are protected with staticpro. */ |
| 5030 | case Lisp_Misc_Save_Value: | ||
| 5031 | break; | 5027 | break; |
| 5032 | 5028 | ||
| 5033 | case Lisp_Misc_Overlay: | 5029 | case Lisp_Misc_Overlay: |
| @@ -5789,6 +5785,3 @@ The time is in seconds as a floating point value. */); | |||
| 5789 | defsubr (&Sgc_status); | 5785 | defsubr (&Sgc_status); |
| 5790 | #endif | 5786 | #endif |
| 5791 | } | 5787 | } |
| 5792 | |||
| 5793 | /* arch-tag: 6695ca10-e3c5-4c2c-8bc3-ed26a7dda857 | ||
| 5794 | (do not change this comment) */ | ||