[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 03/03: Alloc foreign procedures using primitive mechanis
From: |
Andy Wingo |
Subject: |
[Guile-commits] 03/03: Alloc foreign procedures using primitive mechanism |
Date: |
Mon, 6 Aug 2018 07:38:25 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 14539d3986620c9f763a58ed7a4da9ecc3ebff9e
Author: Andy Wingo <address@hidden>
Date: Mon Aug 6 13:35:41 2018 +0200
Alloc foreign procedures using primitive mechanism
* libguile/foreign.c (get_foreign_stub_code): Use
scm_i_alloc_primitive_code_with_instrumentation. This will allow FFI
procedures to be JITted, and allow us to move the apply hook to
instrument-entry.
---
libguile/foreign.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/libguile/foreign.c b/libguile/foreign.c
index b64900f..7a6f44e 100644
--- a/libguile/foreign.c
+++ b/libguile/foreign.c
@@ -830,15 +830,14 @@ get_foreign_stub_code (unsigned int nargs, int with_errno)
{
size_t i;
size_t code_len = with_errno ? 4 : 5;
- uint32_t *code;
-
- code = scm_gc_malloc_pointerless (code_len * sizeof (uint32_t),
- "foreign code");
+ uint32_t *ret, *code;
if (nargs >= (1 << 24) + 1)
scm_misc_error ("make-foreign-function", "too many arguments: ~a",
scm_list_1 (scm_from_uint (nargs)));
+ ret = scm_i_alloc_primitive_code_with_instrumentation (code_len, &code);
+
i = 0;
code[i++] = SCM_PACK_OP_24 (assert_nargs_ee, nargs + 1);
code[i++] = SCM_PACK_OP_12_12 (foreign_call, 0, 1);
@@ -847,7 +846,7 @@ get_foreign_stub_code (unsigned int nargs, int with_errno)
code[i++] = SCM_PACK_OP_24 (reset_frame, 1);
code[i++] = SCM_PACK_OP_24 (return_values, 0);
- return code;
+ return ret;
}
static SCM