aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2020-08-04 11:09:55 -0700
committerPaul Eggert2020-08-04 11:15:16 -0700
commitfe2649528b0b7637e6b6851c41e696a1016d8d53 (patch)
treeca715aed4e63097fecb6de8f4f6d2b8fc32c1840 /src/alloc.c
parent1308587c25cc28248c3d38748f76bb9e6324b929 (diff)
downloademacs-fe2649528b0b7637e6b6851c41e696a1016d8d53.tar.gz
emacs-fe2649528b0b7637e6b6851c41e696a1016d8d53.zip
Drop support for -fcheck-pointer-bounds
GCC has removed the -fcheck-pointer bounds option, and the Linux kernel has also removed support for Intel MPX, so there’s no point to keeping this debugging option within Emacs. * src/bytecode.c (BYTE_CODE_THREADED): * src/lisp.h (DEFINE_LISP_SYMBOL, XSYMBOL, make_lisp_symbol): Assume __CHKP__ is not defined. * src/ptr-bounds.h: Remove. All uses of ptr_bounds_clip, ptr_bounds_copy, ptr_bounds_init, ptr_bounds_set removed.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 3a02ef3f8c4..b16b2f8b93e 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -34,7 +34,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
34#include "bignum.h" 34#include "bignum.h"
35#include "dispextern.h" 35#include "dispextern.h"
36#include "intervals.h" 36#include "intervals.h"
37#include "ptr-bounds.h"
38#include "puresize.h" 37#include "puresize.h"
39#include "sheap.h" 38#include "sheap.h"
40#include "sysstdio.h" 39#include "sysstdio.h"
@@ -1624,8 +1623,7 @@ static struct Lisp_String *string_free_list;
1624 a pointer to the `u.data' member of its sdata structure; the 1623 a pointer to the `u.data' member of its sdata structure; the
1625 structure starts at a constant offset in front of that. */ 1624 structure starts at a constant offset in front of that. */
1626 1625
1627#define SDATA_OF_STRING(S) ((sdata *) ptr_bounds_init ((S)->u.s.data \ 1626#define SDATA_OF_STRING(S) ((sdata *) ((S)->u.s.data - SDATA_DATA_OFFSET))
1628 - SDATA_DATA_OFFSET))
1629 1627
1630 1628
1631#ifdef GC_CHECK_STRING_OVERRUN 1629#ifdef GC_CHECK_STRING_OVERRUN
@@ -1799,7 +1797,7 @@ allocate_string (void)
1799 /* Every string on a free list should have NULL data pointer. */ 1797 /* Every string on a free list should have NULL data pointer. */
1800 s->u.s.data = NULL; 1798 s->u.s.data = NULL;
1801 NEXT_FREE_LISP_STRING (s) = string_free_list; 1799 NEXT_FREE_LISP_STRING (s) = string_free_list;
1802 string_free_list = ptr_bounds_clip (s, sizeof *s); 1800 string_free_list = s;
1803 } 1801 }
1804 } 1802 }
1805 1803
@@ -1908,7 +1906,7 @@ allocate_string_data (struct Lisp_String *s,
1908 1906
1909 MALLOC_UNBLOCK_INPUT; 1907 MALLOC_UNBLOCK_INPUT;
1910 1908
1911 s->u.s.data = ptr_bounds_clip (SDATA_DATA (data), nbytes + 1); 1909 s->u.s.data = SDATA_DATA (data);
1912#ifdef GC_CHECK_STRING_BYTES 1910#ifdef GC_CHECK_STRING_BYTES
1913 SDATA_NBYTES (data) = nbytes; 1911 SDATA_NBYTES (data) = nbytes;
1914#endif 1912#endif
@@ -2036,7 +2034,7 @@ sweep_strings (void)
2036 2034
2037 /* Put the string on the free-list. */ 2035 /* Put the string on the free-list. */
2038 NEXT_FREE_LISP_STRING (s) = string_free_list; 2036 NEXT_FREE_LISP_STRING (s) = string_free_list;
2039 string_free_list = ptr_bounds_clip (s, sizeof *s); 2037 string_free_list = s;
2040 ++nfree; 2038 ++nfree;
2041 } 2039 }
2042 } 2040 }
@@ -2044,7 +2042,7 @@ sweep_strings (void)
2044 { 2042 {
2045 /* S was on the free-list before. Put it there again. */ 2043 /* S was on the free-list before. Put it there again. */
2046 NEXT_FREE_LISP_STRING (s) = string_free_list; 2044 NEXT_FREE_LISP_STRING (s) = string_free_list;
2047 string_free_list = ptr_bounds_clip (s, sizeof *s); 2045 string_free_list = s;
2048 ++nfree; 2046 ++nfree;
2049 } 2047 }
2050 } 2048 }
@@ -2171,8 +2169,7 @@ compact_small_strings (void)
2171 { 2169 {
2172 eassert (tb != b || to < from); 2170 eassert (tb != b || to < from);
2173 memmove (to, from, size + GC_STRING_EXTRA); 2171 memmove (to, from, size + GC_STRING_EXTRA);
2174 to->string->u.s.data 2172 to->string->u.s.data = SDATA_DATA (to);
2175 = ptr_bounds_clip (SDATA_DATA (to), nbytes + 1);
2176 } 2173 }
2177 2174
2178 /* Advance past the sdata we copied to. */ 2175 /* Advance past the sdata we copied to. */
@@ -2959,7 +2956,6 @@ Lisp_Object zero_vector;
2959static void 2956static void
2960setup_on_free_list (struct Lisp_Vector *v, ptrdiff_t nbytes) 2957setup_on_free_list (struct Lisp_Vector *v, ptrdiff_t nbytes)
2961{ 2958{
2962 v = ptr_bounds_clip (v, nbytes);
2963 eassume (header_size <= nbytes); 2959 eassume (header_size <= nbytes);
2964 ptrdiff_t nwords = (nbytes - header_size) / word_size; 2960 ptrdiff_t nwords = (nbytes - header_size) / word_size;
2965 XSETPVECTYPESIZE (v, PVEC_FREE, 0, nwords); 2961 XSETPVECTYPESIZE (v, PVEC_FREE, 0, nwords);
@@ -3307,7 +3303,7 @@ allocate_vectorlike (ptrdiff_t len, bool clearit)
3307 3303
3308 MALLOC_UNBLOCK_INPUT; 3304 MALLOC_UNBLOCK_INPUT;
3309 3305
3310 return ptr_bounds_clip (p, nbytes); 3306 return p;
3311} 3307}
3312 3308
3313 3309
@@ -4461,7 +4457,6 @@ live_string_holding (struct mem_node *m, void *p)
4461 must not be on the free-list. */ 4457 must not be on the free-list. */
4462 if (0 <= offset && offset < sizeof b->strings) 4458 if (0 <= offset && offset < sizeof b->strings)
4463 { 4459 {
4464 cp = ptr_bounds_copy (cp, b);
4465 struct Lisp_String *s = p = cp -= offset % sizeof b->strings[0]; 4460 struct Lisp_String *s = p = cp -= offset % sizeof b->strings[0];
4466 if (s->u.s.data) 4461 if (s->u.s.data)
4467 return s; 4462 return s;
@@ -4494,7 +4489,6 @@ live_cons_holding (struct mem_node *m, void *p)
4494 && (b != cons_block 4489 && (b != cons_block
4495 || offset / sizeof b->conses[0] < cons_block_index)) 4490 || offset / sizeof b->conses[0] < cons_block_index))
4496 { 4491 {
4497 cp = ptr_bounds_copy (cp, b);
4498 struct Lisp_Cons *s = p = cp -= offset % sizeof b->conses[0]; 4492 struct Lisp_Cons *s = p = cp -= offset % sizeof b->conses[0];
4499 if (!deadp (s->u.s.car)) 4493 if (!deadp (s->u.s.car))
4500 return s; 4494 return s;
@@ -4528,7 +4522,6 @@ live_symbol_holding (struct mem_node *m, void *p)
4528 && (b != symbol_block 4522 && (b != symbol_block
4529 || offset / sizeof b->symbols[0] < symbol_block_index)) 4523 || offset / sizeof b->symbols[0] < symbol_block_index))
4530 { 4524 {
4531 cp = ptr_bounds_copy (cp, b);
4532 struct Lisp_Symbol *s = p = cp -= offset % sizeof b->symbols[0]; 4525 struct Lisp_Symbol *s = p = cp -= offset % sizeof b->symbols[0];
4533 if (!deadp (s->u.s.function)) 4526 if (!deadp (s->u.s.function))
4534 return s; 4527 return s;
@@ -5234,7 +5227,7 @@ pure_alloc (size_t size, int type)
5234 pure_bytes_used = pure_bytes_used_lisp + pure_bytes_used_non_lisp; 5227 pure_bytes_used = pure_bytes_used_lisp + pure_bytes_used_non_lisp;
5235 5228
5236 if (pure_bytes_used <= pure_size) 5229 if (pure_bytes_used <= pure_size)
5237 return ptr_bounds_clip (result, size); 5230 return result;
5238 5231
5239 /* Don't allocate a large amount here, 5232 /* Don't allocate a large amount here,
5240 because it might get mmap'd and then its address 5233 because it might get mmap'd and then its address
@@ -5325,7 +5318,7 @@ find_string_data_in_pure (const char *data, ptrdiff_t nbytes)
5325 /* Check the remaining characters. */ 5318 /* Check the remaining characters. */
5326 if (memcmp (data, non_lisp_beg + start, nbytes) == 0) 5319 if (memcmp (data, non_lisp_beg + start, nbytes) == 0)
5327 /* Found. */ 5320 /* Found. */
5328 return ptr_bounds_clip (non_lisp_beg + start, nbytes + 1); 5321 return non_lisp_beg + start;
5329 5322
5330 start += last_char_skip; 5323 start += last_char_skip;
5331 } 5324 }
@@ -6049,7 +6042,6 @@ garbage_collect (void)
6049 stack_copy = xrealloc (stack_copy, stack_size); 6042 stack_copy = xrealloc (stack_copy, stack_size);
6050 stack_copy_size = stack_size; 6043 stack_copy_size = stack_size;
6051 } 6044 }
6052 stack = ptr_bounds_set (stack, stack_size);
6053 no_sanitize_memcpy (stack_copy, stack, stack_size); 6045 no_sanitize_memcpy (stack_copy, stack, stack_size);
6054 } 6046 }
6055 } 6047 }
@@ -6885,8 +6877,7 @@ sweep_conses (void)
6885 6877
6886 for (pos = start; pos < stop; pos++) 6878 for (pos = start; pos < stop; pos++)
6887 { 6879 {
6888 struct Lisp_Cons *acons 6880 struct Lisp_Cons *acons = &cblk->conses[pos];
6889 = ptr_bounds_copy (&cblk->conses[pos], cblk);
6890 if (!XCONS_MARKED_P (acons)) 6881 if (!XCONS_MARKED_P (acons))
6891 { 6882 {
6892 this_free++; 6883 this_free++;
@@ -6939,7 +6930,7 @@ sweep_floats (void)
6939 int this_free = 0; 6930 int this_free = 0;
6940 for (int i = 0; i < lim; i++) 6931 for (int i = 0; i < lim; i++)
6941 { 6932 {
6942 struct Lisp_Float *afloat = ptr_bounds_copy (&fblk->floats[i], fblk); 6933 struct Lisp_Float *afloat = &fblk->floats[i];
6943 if (!XFLOAT_MARKED_P (afloat)) 6934 if (!XFLOAT_MARKED_P (afloat))
6944 { 6935 {
6945 this_free++; 6936 this_free++;