[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/15: Slim heap-allocated flonums
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/15: Slim heap-allocated flonums |
Date: |
Fri, 13 Apr 2018 04:41:11 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit 41689edfc31dd7e0438d776754d550311a878ce5
Author: Andy Wingo <address@hidden>
Date: Tue Apr 10 19:54:58 2018 +0200
Slim heap-allocated flonums
* libguile/numbers.h (struct scm_t_double, struct scm_t_complex): Avoid
adding an extra padding word on systems with 8-byte pointers.
* module/system/base/types.scm (cell->object): Update to compute correct
offset of embedded double.
---
libguile/numbers.h | 6 +++++-
module/system/base/types.scm | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 83bcc9e..c07082e 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -4,7 +4,7 @@
#define SCM_NUMBERS_H
/* Copyright (C) 1995, 1996, 1998, 2000-2006, 2008-2011, 2013, 2014,
- * 2016, 2017 Free Software Foundation, Inc.
+ * 2016-2018 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -172,14 +172,18 @@ typedef long scm_t_inum;
typedef struct scm_t_double
{
SCM type;
+#if SCM_SIZEOF_UINTPTR_T != 8
SCM pad;
+#endif
double real;
} scm_t_double;
typedef struct scm_t_complex
{
SCM type;
+#if SCM_SIZEOF_UINTPTR_T != 8
SCM pad;
+#endif
double real;
double imag;
} scm_t_complex;
diff --git a/module/system/base/types.scm b/module/system/base/types.scm
index c6aaed2..834fa5f 100644
--- a/module/system/base/types.scm
+++ b/module/system/base/types.scm
@@ -1,5 +1,5 @@
;;; 'SCM' type tag decoding.
-;;; Copyright (C) 2014, 2015, 2017 Free Software Foundation, Inc.
+;;; Copyright (C) 2014, 2015, 2017, 2018 Free Software Foundation, Inc.
;;;
;;; This library is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU Lesser General Public License as published by
@@ -419,7 +419,7 @@ using BACKEND."
(((_ & #xffff = %tc16-bignum))
(inferior-object 'bignum address))
(((_ & #xffff = %tc16-flonum) pad)
- (let* ((address (+ address (* 2 %word-size)))
+ (let* ((address (+ address (match %word-size (4 8) (8 8))))
(port (memory-port backend address (sizeof double)))
(words (get-bytevector-n port (sizeof double))))
(bytevector-ieee-double-ref words 0 (native-endianness))))
- [Guile-commits] branch master updated (59f1f5a -> 79ba396), Andy Wingo, 2018/04/13
- [Guile-commits] 05/15: Disable f64->scm instruction, Andy Wingo, 2018/04/13
- [Guile-commits] 06/15: Remove scm->f64, f64->scm implementations, Andy Wingo, 2018/04/13
- [Guile-commits] 04/15: Instruction explosion for f64->scm, Andy Wingo, 2018/04/13
- [Guile-commits] 03/15: Add reifier for fadd/immediate., Andy Wingo, 2018/04/13
- [Guile-commits] 02/15: Slim heap-allocated flonums,
Andy Wingo <=
- [Guile-commits] 01/15: Add scm->f64 intrinsic, Andy Wingo, 2018/04/13
- [Guile-commits] 11/15: logsub is intrinsic, Andy Wingo, 2018/04/13
- [Guile-commits] 09/15: u64->scm, s64->scm intrinsics, Andy Wingo, 2018/04/13
- [Guile-commits] 08/15: Remove scm->u64, etc implementations, Andy Wingo, 2018/04/13
- [Guile-commits] 10/15: Remove implementations of obsolete s64->scm, u64->scm insts, Andy Wingo, 2018/04/13
- [Guile-commits] 12/15: Remove implementation of logsub VM op, Andy Wingo, 2018/04/13
- [Guile-commits] 07/15: scm->u64, scm->s64, scm->u64/truncate intrinsics, Andy Wingo, 2018/04/13
- [Guile-commits] 14/15: Remove implementation of atomic box ops, Andy Wingo, 2018/04/13
- [Guile-commits] 13/15: Explode atomic box ops to new atomic instructions, Andy Wingo, 2018/04/13
- [Guile-commits] 15/15: Remove unused macros in vm-engine, Andy Wingo, 2018/04/13