1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

Inline definition of SIZEOF_SCM_T_BITS

* libguile/_scm.h (SIZEOF_SCM_T_BITS): Remove definition.
* libguile/conv-integer.i.c (SCM_TO_TYPE_PROTO, SCM_FROM_TYPE_PROTO):
* libguile/conv-uinteger.i.c (SCM_FROM_TYPE_PROTO):
* libguile/gc.c (DEFAULT_INITIAL_HEAP_SIZE):
* libguile/hashtab.c:
* libguile/loader.c:
* libguile/socket.c:
* libguile/vm-engine.c (VM_NAME): Use SIZEOF_UINTPTR_T instead of
  SIZEOF_SCM_T_BITS.
This commit is contained in:
Andy Wingo 2018-06-17 19:21:42 +02:00
parent ea3c5cf909
commit 7b4ab0895b
8 changed files with 10 additions and 13 deletions

View file

@ -36,9 +36,6 @@
# include <config.h> # include <config.h>
#endif #endif
/* The size of `scm_t_bits'. */
#define SIZEOF_SCM_T_BITS SIZEOF_VOID_P
#include <errno.h> #include <errno.h>
#include <verify.h> #include <verify.h>
#include <alignof.h> #include <alignof.h>

View file

@ -29,7 +29,7 @@ SCM_TO_TYPE_PROTO (SCM val)
if (SCM_I_INUMP (val)) if (SCM_I_INUMP (val))
{ {
scm_t_signed_bits n = SCM_I_INUM (val); scm_t_signed_bits n = SCM_I_INUM (val);
#if SIZEOF_TYPE != 0 && SIZEOF_TYPE > SIZEOF_SCM_T_BITS #if SIZEOF_TYPE != 0 && SIZEOF_TYPE > SIZEOF_UINTPTR_T
return n; return n;
#else #else
if (n >= TYPE_MIN && n <= TYPE_MAX) if (n >= TYPE_MIN && n <= TYPE_MAX)
@ -113,7 +113,7 @@ SCM_TO_TYPE_PROTO (SCM val)
SCM SCM
SCM_FROM_TYPE_PROTO (TYPE val) SCM_FROM_TYPE_PROTO (TYPE val)
{ {
#if SIZEOF_TYPE != 0 && SIZEOF_TYPE < SIZEOF_SCM_T_BITS #if SIZEOF_TYPE != 0 && SIZEOF_TYPE < SIZEOF_UINTPTR_T
return SCM_I_MAKINUM (val); return SCM_I_MAKINUM (val);
#else #else
if (SCM_FIXABLE (val)) if (SCM_FIXABLE (val))

View file

@ -95,7 +95,7 @@ SCM_TO_TYPE_PROTO (SCM val)
SCM SCM
SCM_FROM_TYPE_PROTO (TYPE val) SCM_FROM_TYPE_PROTO (TYPE val)
{ {
#if SIZEOF_TYPE != 0 && SIZEOF_TYPE < SIZEOF_SCM_T_BITS #if SIZEOF_TYPE != 0 && SIZEOF_TYPE < SIZEOF_UINTPTR_T
return SCM_I_MAKINUM (val); return SCM_I_MAKINUM (val);
#else #else
if (SCM_POSFIXABLE (val)) if (SCM_POSFIXABLE (val))

View file

@ -66,7 +66,7 @@
result of 'guile -c "(display (assq-ref (gc-stats) result of 'guile -c "(display (assq-ref (gc-stats)
'heap-total-allocated))"'. */ 'heap-total-allocated))"'. */
#define DEFAULT_INITIAL_HEAP_SIZE (128 * 1024 * SIZEOF_SCM_T_BITS) #define DEFAULT_INITIAL_HEAP_SIZE (128 * 1024 * SIZEOF_UINTPTR_T)
/* Set this to != 0 if every cell that is accessed shall be checked: /* Set this to != 0 if every cell that is accessed shall be checked:
*/ */

View file

@ -62,7 +62,7 @@
static unsigned long hashtable_size[] = { static unsigned long hashtable_size[] = {
31, 61, 113, 223, 443, 883, 1759, 3517, 7027, 14051, 28099, 56197, 112363, 31, 61, 113, 223, 443, 883, 1759, 3517, 7027, 14051, 28099, 56197, 112363,
224717, 449419, 898823, 1797641, 3595271, 7190537, 14381041 224717, 449419, 898823, 1797641, 3595271, 7190537, 14381041
#if SIZEOF_SCM_T_BITS > 4 #if SIZEOF_UINTPTR_T > 4
/* vector lengths are stored in the first word of vectors, shifted by /* vector lengths are stored in the first word of vectors, shifted by
8 bits for the tc8, so for 32-bit we only get 2^24-1 = 16777215 8 bits for the tc8, so for 32-bit we only get 2^24-1 = 16777215
elements. But we allow a few more sizes for 64-bit. */ elements. But we allow a few more sizes for 64-bit. */

View file

@ -48,14 +48,14 @@
/* This file contains the loader for Guile's on-disk format: ELF with /* This file contains the loader for Guile's on-disk format: ELF with
some custom tags in the dynamic segment. */ some custom tags in the dynamic segment. */
#if SIZEOF_SCM_T_BITS == 4 #if SIZEOF_UINTPTR_T == 4
#define Elf_Half Elf32_Half #define Elf_Half Elf32_Half
#define Elf_Word Elf32_Word #define Elf_Word Elf32_Word
#define Elf_Ehdr Elf32_Ehdr #define Elf_Ehdr Elf32_Ehdr
#define ELFCLASS ELFCLASS32 #define ELFCLASS ELFCLASS32
#define Elf_Phdr Elf32_Phdr #define Elf_Phdr Elf32_Phdr
#define Elf_Dyn Elf32_Dyn #define Elf_Dyn Elf32_Dyn
#elif SIZEOF_SCM_T_BITS == 8 #elif SIZEOF_UINTPTR_T == 8
#define Elf_Half Elf64_Half #define Elf_Half Elf64_Half
#define Elf_Word Elf64_Word #define Elf_Word Elf64_Word
#define Elf_Ehdr Elf64_Ehdr #define Elf_Ehdr Elf64_Ehdr

View file

@ -181,8 +181,8 @@ SCM_DEFINE (scm_inet_makeaddr, "inet-makeaddr", 2, 0, 0,
#endif #endif
#if (SIZEOF_SCM_T_BITS * SCM_CHAR_BIT) > 128 #if (SIZEOF_UINTPTR_T * SCM_CHAR_BIT) > 128
#error "Assumption that scm_t_bits <= 128 bits has been violated." #error "Assumption that uintptr_t <= 128 bits has been violated."
#endif #endif
#if (SIZEOF_UNSIGNED_LONG * SCM_CHAR_BIT) > 128 #if (SIZEOF_UNSIGNED_LONG * SCM_CHAR_BIT) > 128

View file

@ -1589,7 +1589,7 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
scm_t_bits val; scm_t_bits val;
UNPACK_24 (op, dst); UNPACK_24 (op, dst);
#if SIZEOF_SCM_T_BITS > 4 #if SIZEOF_UINTPTR_T > 4
val = ip[1]; val = ip[1];
val <<= 32; val <<= 32;
val |= ip[2]; val |= ip[2];