diff options
| author | Paul Eggert | 2018-06-07 19:12:29 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-06-14 17:13:40 -0700 |
| commit | 4139c98eb5f9003fefe62187e6a60644e38389e9 (patch) | |
| tree | 44e4c501b2f1d9dbf6da0a4bca086bd9d315cf29 /src/alloc.c | |
| parent | f8ad6b311bf142defe4c203b64713c5a5051c4a7 (diff) | |
| download | emacs-4139c98eb5f9003fefe62187e6a60644e38389e9.tar.gz emacs-4139c98eb5f9003fefe62187e6a60644e38389e9.zip | |
Remove Lisp_Misc_Save_Value
This type and its associated routines are no longer used.
* src/alloc.c (voidfuncptr): Move here from src/lisp.h.
(free_misc, make_save_int_int_int)
(make_save_obj_obj_obj_obj, make_save_ptr)
(make_save_ptr_int, make_save_ptr_ptr)
(make_save_funcptr_ptr_obj, make_save_memory)
(free_save_value, mark_save_value):
Remove.
(mark_object): Remove mention of Lisp_Misc_Save_Value.
* src/lisp.h (Lisp_Misc_Save_Value, SAVE_SLOT_BITS)
(SAVE_VALUE_SLOTS, SAVE_TYPE_BITS, enum Lisp_Save_Type)
(struct Lisp_Save_Value, SAVE_VALUEP, XSAVE_VALUE)
(save_type, XSAVE_POINTER, set_save_pointer)
(XSAVE_FUNCPOINTER, XSAVE_INTEGER, set_save_integer)
(XSAVE_OBJECT): Remove.
(union Lisp_Misc): Remove u_save_value.
(voidfuncptr): Move from here to src/alloc.c.
* src/print.c (print_object):
Remove support for printing Lisp_Misc_Save_Value.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 153 |
1 files changed, 3 insertions, 150 deletions
diff --git a/src/alloc.c b/src/alloc.c index 6b57c83cc2e..7b2140501ec 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -172,6 +172,7 @@ malloc_initialize_hook (void) | |||
| 172 | 172 | ||
| 173 | /* Declare the malloc initialization hook, which runs before 'main' starts. | 173 | /* Declare the malloc initialization hook, which runs before 'main' starts. |
| 174 | EXTERNALLY_VISIBLE works around Bug#22522. */ | 174 | EXTERNALLY_VISIBLE works around Bug#22522. */ |
| 175 | typedef void (*voidfuncptr) (void); | ||
| 175 | # ifndef __MALLOC_HOOK_VOLATILE | 176 | # ifndef __MALLOC_HOOK_VOLATILE |
| 176 | # define __MALLOC_HOOK_VOLATILE | 177 | # define __MALLOC_HOOK_VOLATILE |
| 177 | # endif | 178 | # endif |
| @@ -3710,123 +3711,6 @@ allocate_misc (enum Lisp_Misc_Type type) | |||
| 3710 | return val; | 3711 | return val; |
| 3711 | } | 3712 | } |
| 3712 | 3713 | ||
| 3713 | /* Free a Lisp_Misc object. */ | ||
| 3714 | |||
| 3715 | void | ||
| 3716 | free_misc (Lisp_Object misc) | ||
| 3717 | { | ||
| 3718 | XMISCANY (misc)->type = Lisp_Misc_Free; | ||
| 3719 | XMISC (misc)->u_free.chain = misc_free_list; | ||
| 3720 | misc_free_list = XMISC (misc); | ||
| 3721 | consing_since_gc -= sizeof (union Lisp_Misc); | ||
| 3722 | total_free_markers++; | ||
| 3723 | } | ||
| 3724 | |||
| 3725 | /* Verify properties of Lisp_Save_Value's representation | ||
| 3726 | that are assumed here and elsewhere. */ | ||
| 3727 | |||
| 3728 | verify (SAVE_UNUSED == 0); | ||
| 3729 | verify (((SAVE_INTEGER | SAVE_POINTER | SAVE_FUNCPOINTER | SAVE_OBJECT) | ||
| 3730 | >> SAVE_SLOT_BITS) | ||
| 3731 | == 0); | ||
| 3732 | |||
| 3733 | /* Return Lisp_Save_Value objects for the various combinations | ||
| 3734 | that callers need. */ | ||
| 3735 | |||
| 3736 | Lisp_Object | ||
| 3737 | make_save_int_int_int (ptrdiff_t a, ptrdiff_t b, ptrdiff_t c) | ||
| 3738 | { | ||
| 3739 | Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); | ||
| 3740 | struct Lisp_Save_Value *p = XSAVE_VALUE (val); | ||
| 3741 | p->save_type = SAVE_TYPE_INT_INT_INT; | ||
| 3742 | p->data[0].integer = a; | ||
| 3743 | p->data[1].integer = b; | ||
| 3744 | p->data[2].integer = c; | ||
| 3745 | return val; | ||
| 3746 | } | ||
| 3747 | |||
| 3748 | Lisp_Object | ||
| 3749 | make_save_obj_obj_obj_obj (Lisp_Object a, Lisp_Object b, Lisp_Object c, | ||
| 3750 | Lisp_Object d) | ||
| 3751 | { | ||
| 3752 | Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); | ||
| 3753 | struct Lisp_Save_Value *p = XSAVE_VALUE (val); | ||
| 3754 | p->save_type = SAVE_TYPE_OBJ_OBJ_OBJ_OBJ; | ||
| 3755 | p->data[0].object = a; | ||
| 3756 | p->data[1].object = b; | ||
| 3757 | p->data[2].object = c; | ||
| 3758 | p->data[3].object = d; | ||
| 3759 | return val; | ||
| 3760 | } | ||
| 3761 | |||
| 3762 | Lisp_Object | ||
| 3763 | make_save_ptr (void *a) | ||
| 3764 | { | ||
| 3765 | Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); | ||
| 3766 | struct Lisp_Save_Value *p = XSAVE_VALUE (val); | ||
| 3767 | p->save_type = SAVE_POINTER; | ||
| 3768 | p->data[0].pointer = a; | ||
| 3769 | return val; | ||
| 3770 | } | ||
| 3771 | |||
| 3772 | Lisp_Object | ||
| 3773 | make_save_ptr_int (void *a, ptrdiff_t b) | ||
| 3774 | { | ||
| 3775 | Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); | ||
| 3776 | struct Lisp_Save_Value *p = XSAVE_VALUE (val); | ||
| 3777 | p->save_type = SAVE_TYPE_PTR_INT; | ||
| 3778 | p->data[0].pointer = a; | ||
| 3779 | p->data[1].integer = b; | ||
| 3780 | return val; | ||
| 3781 | } | ||
| 3782 | |||
| 3783 | Lisp_Object | ||
| 3784 | make_save_ptr_ptr (void *a, void *b) | ||
| 3785 | { | ||
| 3786 | Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); | ||
| 3787 | struct Lisp_Save_Value *p = XSAVE_VALUE (val); | ||
| 3788 | p->save_type = SAVE_TYPE_PTR_PTR; | ||
| 3789 | p->data[0].pointer = a; | ||
| 3790 | p->data[1].pointer = b; | ||
| 3791 | return val; | ||
| 3792 | } | ||
| 3793 | |||
| 3794 | Lisp_Object | ||
| 3795 | make_save_funcptr_ptr_obj (void (*a) (void), void *b, Lisp_Object c) | ||
| 3796 | { | ||
| 3797 | Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); | ||
| 3798 | struct Lisp_Save_Value *p = XSAVE_VALUE (val); | ||
| 3799 | p->save_type = SAVE_TYPE_FUNCPTR_PTR_OBJ; | ||
| 3800 | p->data[0].funcpointer = a; | ||
| 3801 | p->data[1].pointer = b; | ||
| 3802 | p->data[2].object = c; | ||
| 3803 | return val; | ||
| 3804 | } | ||
| 3805 | |||
| 3806 | /* Return a Lisp_Save_Value object that represents an array A | ||
| 3807 | of N Lisp objects. */ | ||
| 3808 | |||
| 3809 | Lisp_Object | ||
| 3810 | make_save_memory (Lisp_Object *a, ptrdiff_t n) | ||
| 3811 | { | ||
| 3812 | Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); | ||
| 3813 | struct Lisp_Save_Value *p = XSAVE_VALUE (val); | ||
| 3814 | p->save_type = SAVE_TYPE_MEMORY; | ||
| 3815 | p->data[0].pointer = a; | ||
| 3816 | p->data[1].integer = n; | ||
| 3817 | return val; | ||
| 3818 | } | ||
| 3819 | |||
| 3820 | /* Free a Lisp_Save_Value object. Do not use this function | ||
| 3821 | if SAVE contains pointer other than returned by xmalloc. */ | ||
| 3822 | |||
| 3823 | void | ||
| 3824 | free_save_value (Lisp_Object save) | ||
| 3825 | { | ||
| 3826 | xfree (XSAVE_POINTER (save, 0)); | ||
| 3827 | free_misc (save); | ||
| 3828 | } | ||
| 3829 | |||
| 3830 | Lisp_Object | 3714 | Lisp_Object |
| 3831 | make_misc_ptr (void *a) | 3715 | make_misc_ptr (void *a) |
| 3832 | { | 3716 | { |
| @@ -5281,10 +5165,8 @@ valid_pointer_p (void *p) | |||
| 5281 | 5165 | ||
| 5282 | /* Return 2 if OBJ is a killed or special buffer object, 1 if OBJ is a | 5166 | /* Return 2 if OBJ is a killed or special buffer object, 1 if OBJ is a |
| 5283 | valid lisp object, 0 if OBJ is NOT a valid lisp object, or -1 if we | 5167 | valid lisp object, 0 if OBJ is NOT a valid lisp object, or -1 if we |
| 5284 | cannot validate OBJ. This function can be quite slow, so its primary | 5168 | cannot validate OBJ. This function can be quite slow, and is used |
| 5285 | use is the manual debugging. The only exception is print_object, where | 5169 | only in debugging. */ |
| 5286 | we use it to check whether the memory referenced by the pointer of | ||
| 5287 | Lisp_Save_Value object contains valid objects. */ | ||
| 5288 | 5170 | ||
| 5289 | int | 5171 | int |
| 5290 | valid_lisp_object_p (Lisp_Object obj) | 5172 | valid_lisp_object_p (Lisp_Object obj) |
| @@ -6363,30 +6245,6 @@ mark_localized_symbol (struct Lisp_Symbol *ptr) | |||
| 6363 | mark_object (blv->defcell); | 6245 | mark_object (blv->defcell); |
| 6364 | } | 6246 | } |
| 6365 | 6247 | ||
| 6366 | NO_INLINE /* To reduce stack depth in mark_object. */ | ||
| 6367 | static void | ||
| 6368 | mark_save_value (struct Lisp_Save_Value *ptr) | ||
| 6369 | { | ||
| 6370 | /* If `save_type' is zero, `data[0].pointer' is the address | ||
| 6371 | of a memory area containing `data[1].integer' potential | ||
| 6372 | Lisp_Objects. */ | ||
| 6373 | if (ptr->save_type == SAVE_TYPE_MEMORY) | ||
| 6374 | { | ||
| 6375 | Lisp_Object *p = ptr->data[0].pointer; | ||
| 6376 | ptrdiff_t nelt; | ||
| 6377 | for (nelt = ptr->data[1].integer; nelt > 0; nelt--, p++) | ||
| 6378 | mark_maybe_object (*p); | ||
| 6379 | } | ||
| 6380 | else | ||
| 6381 | { | ||
| 6382 | /* Find Lisp_Objects in `data[N]' slots and mark them. */ | ||
| 6383 | int i; | ||
| 6384 | for (i = 0; i < SAVE_VALUE_SLOTS; i++) | ||
| 6385 | if (save_type (ptr, i) == SAVE_OBJECT) | ||
| 6386 | mark_object (ptr->data[i].object); | ||
| 6387 | } | ||
| 6388 | } | ||
| 6389 | |||
| 6390 | /* Remove killed buffers or items whose car is a killed buffer from | 6248 | /* Remove killed buffers or items whose car is a killed buffer from |
| 6391 | LIST, and mark other items. Return changed LIST, which is marked. */ | 6249 | LIST, and mark other items. Return changed LIST, which is marked. */ |
| 6392 | 6250 | ||
| @@ -6695,11 +6553,6 @@ mark_object (Lisp_Object arg) | |||
| 6695 | XMISCANY (obj)->gcmarkbit = 1; | 6553 | XMISCANY (obj)->gcmarkbit = 1; |
| 6696 | break; | 6554 | break; |
| 6697 | 6555 | ||
| 6698 | case Lisp_Misc_Save_Value: | ||
| 6699 | XMISCANY (obj)->gcmarkbit = 1; | ||
| 6700 | mark_save_value (XSAVE_VALUE (obj)); | ||
| 6701 | break; | ||
| 6702 | |||
| 6703 | case Lisp_Misc_Ptr: | 6556 | case Lisp_Misc_Ptr: |
| 6704 | XMISCANY (obj)->gcmarkbit = true; | 6557 | XMISCANY (obj)->gcmarkbit = true; |
| 6705 | break; | 6558 | break; |