summaryrefslogtreecommitdiff
path: root/libguile/vm-engine.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2019-08-26 10:19:24 +0200
committerAndy Wingo <wingo@pobox.com>2019-08-26 10:19:24 +0200
commitb02d1b08d7d7f0eaafdd9dcfc3de3a139b25492e (patch)
treeaa592b5ff98f92d9159a52cc662a4ed25c7f9f93 /libguile/vm-engine.c
parentb959708114ad88c90cd77a08a9b9dcf6e0d4f446 (diff)
downloadguile-b02d1b08d7d7f0eaafdd9dcfc3de3a139b25492e.tar.gz
Compiler allocates boxed flonums in unmarked space
This fixes a bug whereby the compiler would sometimes allocate floats in marked space. * libguile/gc-inline.h (scm_inline_gc_malloc_pointerless_words): New internal helper. * libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): * libguile/intrinsics.c (allocate_pointerless_words): (allocate_pointerless_words_with_freelist): New intrinsics. * libguile/jit.c (compile_allocate_pointerless_words): (compile_allocate_pointerless_words_immediate): New compilers. * libguile/vm-engine.c (allocate_pointerless_words) (allocate_pointerless_words_immediate): New opcodes. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm (param): * module/language/cps/reify-primitives.scm (reify-primitives): * module/language/cps/specialize-primcalls.scm (specialize-primcalls): * module/language/cps/types.scm (allocate-words): (allocate-words/immediate): * module/system/vm/assembler.scm (system): Add support for the new opcodes.
Diffstat (limited to 'libguile/vm-engine.c')
-rw-r--r--libguile/vm-engine.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 0c2c8e7bf..6b1e20d47 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -3280,8 +3280,40 @@ VM_NAME (scm_thread *thread)
NEXT (2);
}
- VM_DEFINE_OP (157, unused_157, NULL, NOP)
- VM_DEFINE_OP (158, unused_158, NULL, NOP)
+ /* allocate-pointerless-words dst:12 count:12
+ *
+ * Allocate a fresh object consisting of COUNT words and store it into
+ * DST. The result will not be traced by GC. COUNT is a u64 local.
+ */
+ VM_DEFINE_OP (157, allocate_pointerless_words, "allocate-pointerless-words", DOP1 (X8_S12_S12))
+ {
+ uint16_t dst, size;
+
+ UNPACK_12_12 (op, dst, size);
+
+ SYNC_IP ();
+ SP_SET (dst, CALL_INTRINSIC (allocate_pointerless_words,
+ (thread, SP_REF_U64 (size))));
+ NEXT (1);
+ }
+
+ /* allocate-words/immediate dst:12 count:12
+ *
+ * Allocate a fresh object consisting of COUNT words and store it into
+ * DST. The result will not be traced by GC. COUNT is an immediate.
+ */
+ VM_DEFINE_OP (158, allocate_pointerless_words_immediate, "allocate-pointerless-words/immediate", DOP1 (X8_S12_C12))
+ {
+ uint16_t dst, size;
+
+ UNPACK_12_12 (op, dst, size);
+
+ SYNC_IP ();
+ SP_SET (dst, CALL_INTRINSIC (allocate_pointerless_words, (thread, size)));
+
+ NEXT (1);
+ }
+
VM_DEFINE_OP (159, unused_159, NULL, NOP)
VM_DEFINE_OP (160, unused_160, NULL, NOP)
VM_DEFINE_OP (161, unused_161, NULL, NOP)