aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-11-19 19:19:22 -0800
committerPaul Eggert2011-11-19 19:19:22 -0800
commit17e845af732cf7bd0ada49375f014e10deb3d06a (patch)
treedc030088b9f8b008e269028267737d6ba62dcc99
parente1dbe924b53c541fdf238a5a722b7177d5c8760b (diff)
parent615a3b8d0d2c88cd664f1e0beb5a32b5b8e08f90 (diff)
downloademacs-17e845af732cf7bd0ada49375f014e10deb3d06a.tar.gz
emacs-17e845af732cf7bd0ada49375f014e10deb3d06a.zip
Standardize on VIRT_ADDR_VARIES behavior.
Otherwise, valgrind does not work on some platforms. Problem reported by Andreas Schwab in <http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00081.html>. * puresize.h (pure, PURE_P): Always behave as if VIRT_ADDR_VARIES is set, removing the need for VIRT_ADDRESS_VARIES. (PURE_P): Use a more-efficient implementation that needs just one comparison, not two: on x86-64 with GCC 4.6.2, this cut down the number of instructions from 6 (xorl, cmpq, jge, xorl, cmpq, setge) to 4 (xorl, subq, cmpq, setbe). * alloc.c (pure): Always extern now, since that's the VIRT_ADDR_VARIES behavior. (PURE_POINTER_P): Use a single comparison, not two, for consistency with the new puresize.h. * lisp.h (PNTR_COMPARISON_TYPE): Remove; no longer needed. * m/ibms390.h, m/intel386.h, m/template.h, s/cygwin.h, s/hpux10-20.h: Remove VIRT_ADDR_VARIES no longer needed. Fixes: debbugs:10042
-rw-r--r--src/ChangeLog20
-rw-r--r--src/alloc.c8
-rw-r--r--src/lisp.h3
-rw-r--r--src/m/ibms390.h11
-rw-r--r--src/m/intel386.h2
-rw-r--r--src/m/template.h8
-rw-r--r--src/puresize.h16
-rw-r--r--src/s/cygwin.h3
-rw-r--r--src/s/hpux10-20.h8
9 files changed, 25 insertions, 54 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2973ecc4b57..7accd0d5eea 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,23 @@
12011-11-20 Paul Eggert <eggert@cs.ucla.edu>
2
3 Standardize on VIRT_ADDR_VARIES behavior (Bug#10042).
4 Otherwise, valgrind does not work on some platforms.
5 Problem reported by Andreas Schwab in
6 <http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00081.html>.
7 * puresize.h (pure, PURE_P): Always behave as if VIRT_ADDR_VARIES
8 is set, removing the need for VIRT_ADDRESS_VARIES.
9 (PURE_P): Use a more-efficient implementation that needs just one
10 comparison, not two: on x86-64 with GCC 4.6.2, this cut down the
11 number of instructions from 6 (xorl, cmpq, jge, xorl, cmpq, setge)
12 to 4 (xorl, subq, cmpq, setbe).
13 * alloc.c (pure): Always extern now, since that's the
14 VIRT_ADDR_VARIES behavior.
15 (PURE_POINTER_P): Use a single comparison, not two, for
16 consistency with the new puresize.h.
17 * lisp.h (PNTR_COMPARISON_TYPE): Remove; no longer needed.
18 * m/ibms390.h, m/intel386.h, m/template.h, s/cygwin.h, s/hpux10-20.h:
19 Remove VIRT_ADDR_VARIES no longer needed.
20
12011-11-19 Eli Zaretskii <eliz@gnu.org> 212011-11-19 Eli Zaretskii <eliz@gnu.org>
2 22
3 * xdisp.c (x_write_glyphs, draw_phys_cursor_glyph) 23 * xdisp.c (x_write_glyphs, draw_phys_cursor_glyph)
diff --git a/src/alloc.c b/src/alloc.c
index 5d04bd77872..96d63f53cf9 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -203,9 +203,6 @@ static int malloc_hysteresis;
203 remapping on more recent systems because this is less important 203 remapping on more recent systems because this is less important
204 nowadays than in the days of small memories and timesharing. */ 204 nowadays than in the days of small memories and timesharing. */
205 205
206#ifndef VIRT_ADDR_VARIES
207static
208#endif
209EMACS_INT pure[(PURESIZE + sizeof (EMACS_INT) - 1) / sizeof (EMACS_INT)] = {1,}; 206EMACS_INT pure[(PURESIZE + sizeof (EMACS_INT) - 1) / sizeof (EMACS_INT)] = {1,};
210#define PUREBEG (char *) pure 207#define PUREBEG (char *) pure
211 208
@@ -222,10 +219,7 @@ static ptrdiff_t pure_bytes_used_before_overflow;
222/* Value is non-zero if P points into pure space. */ 219/* Value is non-zero if P points into pure space. */
223 220
224#define PURE_POINTER_P(P) \ 221#define PURE_POINTER_P(P) \
225 (((PNTR_COMPARISON_TYPE) (P) \ 222 ((uintptr_t) (P) - (uintptr_t) purebeg <= pure_size)
226 < (PNTR_COMPARISON_TYPE) ((char *) purebeg + pure_size)) \
227 && ((PNTR_COMPARISON_TYPE) (P) \
228 >= (PNTR_COMPARISON_TYPE) purebeg))
229 223
230/* Index in pure at which next pure Lisp object will be allocated.. */ 224/* Index in pure at which next pure Lisp object will be allocated.. */
231 225
diff --git a/src/lisp.h b/src/lisp.h
index 695141321c9..dcd1167e0a2 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1877,9 +1877,6 @@ typedef struct {
1877 CHECK_NATNUM (tmp); \ 1877 CHECK_NATNUM (tmp); \
1878 XSETCDR ((x), tmp); \ 1878 XSETCDR ((x), tmp); \
1879 } while (0) 1879 } while (0)
1880
1881/* Cast pointers to this type to compare them. */
1882#define PNTR_COMPARISON_TYPE uintptr_t
1883 1880
1884/* Define a built-in function for calling from Lisp. 1881/* Define a built-in function for calling from Lisp.
1885 `lname' should be the name to give the function in Lisp, 1882 `lname' should be the name to give the function in Lisp,
diff --git a/src/m/ibms390.h b/src/m/ibms390.h
index c309035dc5c..7269d416a48 100644
--- a/src/m/ibms390.h
+++ b/src/m/ibms390.h
@@ -17,11 +17,6 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20 20/* This file is a placeholder -- it does not contain any definitions.
21/* Define VIRT_ADDR_VARIES if the virtual addresses of 21 At some point we should probably fix this by removing the file
22 pure and impure space as loaded can vary, and even their 22 and removing all uses of it. */
23 relative order cannot be relied on.
24
25 Otherwise Emacs assumes that text space precedes data space,
26 numerically. */
27#define VIRT_ADDR_VARIES
diff --git a/src/m/intel386.h b/src/m/intel386.h
index 16f0645715c..114b7fef963 100644
--- a/src/m/intel386.h
+++ b/src/m/intel386.h
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20 20
21#ifdef WINDOWSNT 21#ifdef WINDOWSNT
22#define VIRT_ADDR_VARIES
23#define DATA_START get_data_start () 22#define DATA_START get_data_start ()
24#endif 23#endif
25 24
@@ -28,4 +27,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28/* we cannot get the maximum address for brk */ 27/* we cannot get the maximum address for brk */
29#define ULIMIT_BREAK_VALUE (32*1024*1024) 28#define ULIMIT_BREAK_VALUE (32*1024*1024)
30#endif 29#endif
31
diff --git a/src/m/template.h b/src/m/template.h
index 54fb0da9521..38649e8ac6d 100644
--- a/src/m/template.h
+++ b/src/m/template.h
@@ -21,14 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 does not define it automatically. 21 does not define it automatically.
22 Ones defined so far include m68k and many others */ 22 Ones defined so far include m68k and many others */
23 23
24/* Define VIRT_ADDR_VARIES if the virtual addresses of
25 pure and impure space as loaded can vary, and even their
26 relative order cannot be relied on.
27
28 Otherwise Emacs assumes that text space precedes data space,
29 numerically. */
30#define VIRT_ADDR_VARIES
31
32/* After adding support for a new machine, modify the large case 24/* After adding support for a new machine, modify the large case
33 statement in configure.in to recognize reasonable 25 statement in configure.in to recognize reasonable
34 configuration names, and add a description of the system to 26 configuration names, and add a description of the system to
diff --git a/src/puresize.h b/src/puresize.h
index c26c496a757..4290c30c68d 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -75,21 +75,7 @@ extern void pure_write_error (void) NO_RETURN;
75 75
76/* Define PURE_P. */ 76/* Define PURE_P. */
77 77
78#ifdef VIRT_ADDR_VARIES
79/* For machines where text and data can go anywhere
80 in virtual memory. */
81
82extern EMACS_INT pure[]; 78extern EMACS_INT pure[];
83 79
84#define PURE_P(obj) \ 80#define PURE_P(obj) \
85 ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) ((char *) pure + PURESIZE) \ 81 ((uintptr_t) XPNTR (obj) - (uintptr_t) pure <= PURESIZE)
86 && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure)
87
88#else /* not VIRT_ADDR_VARIES */
89
90extern char my_edata[];
91
92#define PURE_P(obj) \
93 ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) my_edata)
94
95#endif /* VIRT_ADDRESS_VARIES */
diff --git a/src/s/cygwin.h b/src/s/cygwin.h
index af5308ff7bb..8f5a0ab1fc7 100644
--- a/src/s/cygwin.h
+++ b/src/s/cygwin.h
@@ -91,9 +91,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
91 why it needed to be changed. */ 91 why it needed to be changed. */
92#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 92#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
93 93
94/* Virtual addresses of pure and impure space can vary, as on Windows. */
95#define VIRT_ADDR_VARIES
96
97/* Emacs supplies its own malloc, but glib (part of Gtk+) calls 94/* Emacs supplies its own malloc, but glib (part of Gtk+) calls
98 memalign and on Cygwin, that becomes the Cygwin-supplied memalign. 95 memalign and on Cygwin, that becomes the Cygwin-supplied memalign.
99 As malloc is not the Cygwin malloc, the Cygwin memalign always 96 As malloc is not the Cygwin malloc, the Cygwin memalign always
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index 37199bcc29b..be457498add 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -100,14 +100,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
100 header sections which lose when `static' is defined away, as it is 100 header sections which lose when `static' is defined away, as it is
101 on HP-UX. (You get duplicate symbol errors on linking). */ 101 on HP-UX. (You get duplicate symbol errors on linking). */
102#undef _FILE_OFFSET_BITS 102#undef _FILE_OFFSET_BITS
103
104/* Define VIRT_ADDR_VARIES if the virtual addresses of
105 pure and impure space as loaded can vary, and even their
106 relative order cannot be relied on.
107
108 Otherwise Emacs assumes that text space precedes data space,
109 numerically. */
110#define VIRT_ADDR_VARIES
111 103
112/* The data segment on this machine always starts at address 0x40000000. */ 104/* The data segment on this machine always starts at address 0x40000000. */
113#define DATA_SEG_BITS 0x40000000 105#define DATA_SEG_BITS 0x40000000