summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-08-13 23:59:51 +0200
committerLudovic Courtès <ludo@gnu.org>2009-08-13 23:59:51 +0200
commite3c9c676ae8b45ab98296532ac9756566dc46631 (patch)
tree29ab568b991cdea1369d962af0664b6366cf681f
parentb3ce13b667634be30ab2d74b8ccb1de190d7aeeb (diff)
downloadguile-e3c9c676ae8b45ab98296532ac9756566dc46631.tar.gz
Uncomment run-time objcode alignment check.
This should now work thanks to the changes in 28b119ee3da0f4b14cb87e638794d22843778cda ("make sure all programs are 8-byte aligned"). This commit is a follow-up to ec99fe8ecb412e49e8e981246eb62ca46b32754b ("Add FIXMEs about misaligned objcode-metas."). * libguile/objcodes.c (scm_c_make_objcode_slice): Uncomment assertion that checks for proper alignment of PTR. * module/language/assembly/compile-bytecode.scm (write-bytecode): Update comment about META's alignment.
-rw-r--r--libguile/objcodes.c8
-rw-r--r--module/language/assembly/compile-bytecode.scm6
2 files changed, 7 insertions, 7 deletions
diff --git a/libguile/objcodes.c b/libguile/objcodes.c
index 19c2406b1..5466ecc2c 100644
--- a/libguile/objcodes.c
+++ b/libguile/objcodes.c
@@ -119,10 +119,10 @@ scm_c_make_objcode_slice (SCM parent, const scm_t_uint8 *ptr)
scm_from_uint32 (parent_data->len),
scm_from_uint32 (parent_data->metalen)));
-#if 0
- /* FIXME: We currently generate bytecode where the objcode-meta isn't
- suitable aligned, which is an issue on some arches (e.g., SPARC). */
- assert ((((uintptr_t) ptr) & (__alignof__ (struct scm_objcode) - 1UL)) == 0);
+#ifdef __GNUC__ /* we need `__alignof__' */
+ /* Make sure bytecode for the objcode-meta is suitable aligned. Failing to
+ do so leads to SIGBUS/SIGSEGV on some arches (e.g., SPARC). */
+ assert ((((scm_t_bits) ptr) & (__alignof__ (struct scm_objcode) - 1UL)) == 0);
#endif
data = (struct scm_objcode*)ptr;
diff --git a/module/language/assembly/compile-bytecode.scm b/module/language/assembly/compile-bytecode.scm
index c49c20081..4706cce64 100644
--- a/module/language/assembly/compile-bytecode.scm
+++ b/module/language/assembly/compile-bytecode.scm
@@ -130,9 +130,9 @@
(set! i (1+ i))
(if (> i 0) (write-byte x))))
(get-addr (lambda () i)))
- ;; FIXME: We should add padding here so that META's bytecode
- ;; meets the alignment requirements of `scm_objcode'. See
- ;; `scm_c_make_objcode_slice ()'.
+ ;; META's bytecode meets the alignment requirements of
+ ;; `scm_objcode', thanks to the alignment computed in
+ ;; `(language assembly)'.
(write-bytecode meta write get-addr '()))))
((make-char32 ,x) (write-uint32-be x))
((load-number ,str) (write-loader str))