1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 00:30:21 +02:00

Uncomment run-time objcode alignment check.

This should now work thanks to the changes in
28b119ee3d ("make sure all programs are
8-byte aligned").  This commit is a follow-up to
ec99fe8ecb ("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.
This commit is contained in:
Ludovic Courtès 2009-08-13 23:59:51 +02:00
parent b3ce13b667
commit e3c9c676ae
2 changed files with 7 additions and 7 deletions

View file

@ -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->len),
scm_from_uint32 (parent_data->metalen))); scm_from_uint32 (parent_data->metalen)));
#if 0 #ifdef __GNUC__ /* we need `__alignof__' */
/* FIXME: We currently generate bytecode where the objcode-meta isn't /* Make sure bytecode for the objcode-meta is suitable aligned. Failing to
suitable aligned, which is an issue on some arches (e.g., SPARC). */ do so leads to SIGBUS/SIGSEGV on some arches (e.g., SPARC). */
assert ((((uintptr_t) ptr) & (__alignof__ (struct scm_objcode) - 1UL)) == 0); assert ((((scm_t_bits) ptr) & (__alignof__ (struct scm_objcode) - 1UL)) == 0);
#endif #endif
data = (struct scm_objcode*)ptr; data = (struct scm_objcode*)ptr;

View file

@ -130,9 +130,9 @@
(set! i (1+ i)) (set! i (1+ i))
(if (> i 0) (write-byte x)))) (if (> i 0) (write-byte x))))
(get-addr (lambda () i))) (get-addr (lambda () i)))
;; FIXME: We should add padding here so that META's bytecode ;; META's bytecode meets the alignment requirements of
;; meets the alignment requirements of `scm_objcode'. See ;; `scm_objcode', thanks to the alignment computed in
;; `scm_c_make_objcode_slice ()'. ;; `(language assembly)'.
(write-bytecode meta write get-addr '())))) (write-bytecode meta write get-addr '()))))
((make-char32 ,x) (write-uint32-be x)) ((make-char32 ,x) (write-uint32-be x))
((load-number ,str) (write-loader str)) ((load-number ,str) (write-loader str))