emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/comp-static-data b5fc7dabb5 2/2: src/alloc.h: Add new header.


From: Vibhav Pant
Subject: scratch/comp-static-data b5fc7dabb5 2/2: src/alloc.h: Add new header.
Date: Sat, 19 Nov 2022 11:44:03 -0500 (EST)

branch: scratch/comp-static-data
commit b5fc7dabb5c153336bd9268c80d9316faa34753a
Author: Vibhav Pant <vibhavp@gmail.com>
Commit: Vibhav Pant <vibhavp@gmail.com>

    src/alloc.h: Add new header.
    
    Add alloc.h, a header containing allocation-related constants that are
    used by comp.c while emitting static data.
    * src/alloc.h: New file.
    * src/alloc.c: Set alloc.h variables only when native compilation is
      enabled.
---
 src/alloc.c |  6 ++++++
 src/alloc.h | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/src/alloc.c b/src/alloc.c
index 69c5dba18c..6e46d470cf 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1054,7 +1054,9 @@ lisp_free (void *block)
 #define BLOCK_ALIGN (1 << 10)
 verify (POWER_OF_2 (BLOCK_ALIGN));
 
+#ifdef HAVE_NATIVE_COMP
 const size_t block_align = BLOCK_ALIGN;
+#endif
 
 /* Use aligned_alloc if it or a simple substitute is available.
    Aligned allocation is incompatible with unexmacosx.c, so don't use
@@ -2547,9 +2549,11 @@ pin_string (Lisp_Object string)
      - (sizeof (struct Lisp_Float) - sizeof (bits_word))) * CHAR_BIT) \
    / (sizeof (struct Lisp_Float) * CHAR_BIT + 1))
 
+#ifdef HAVE_NATIVE_COMP
 const size_t float_block_floats_length = FLOAT_BLOCK_SIZE;
 const size_t float_block_gcmarkbits_length
   = 1 + FLOAT_BLOCK_SIZE / BITS_PER_BITS_WORD;
+#endif
 
 #define GETMARKBIT(block,n)                            \
   (((block)->gcmarkbits[(n) / BITS_PER_BITS_WORD]      \
@@ -2655,9 +2659,11 @@ make_float (double float_value)
      - (sizeof (struct Lisp_Cons) - sizeof (bits_word))) * CHAR_BIT)   \
    / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1))
 
+#ifdef HAVE_NATIVE_COMP
 const size_t cons_block_conses_length = CONS_BLOCK_SIZE;
 const size_t cons_block_gcmarkbits_length
   = 1 + CONS_BLOCK_SIZE / BITS_PER_BITS_WORD;
+#endif
 
 #define CONS_BLOCK(fptr) \
   (eassert (!pdumper_object_p (fptr)),                                  \
diff --git a/src/alloc.h b/src/alloc.h
new file mode 100644
index 0000000000..026d62c6a9
--- /dev/null
+++ b/src/alloc.h
@@ -0,0 +1,35 @@
+/* Allocation-related definitions, used by comp.c
+
+ Copyright (C) 2019-2022 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef ALLOC_H
+#define ALLOC_H
+
+#ifdef HAVE_NATIVE_COMP
+
+extern const size_t block_align;
+
+extern const size_t float_block_floats_length;
+extern const size_t float_block_gcmarkbits_length;
+
+extern const size_t cons_block_conses_length;
+extern const size_t cons_block_gcmarkbits_length;
+
+#endif /* #ifndef HAVE_NATIVE_COMP */
+
+#endif /* #ifndef ALLOC_H */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]