[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/07: Add internal function mapping subr index to funct
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/07: Add internal function mapping subr index to function |
Date: |
Mon, 20 Aug 2018 06:08:27 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit cf0270cb4c5b098773a98e2a688906944ab9661e
Author: Andy Wingo <address@hidden>
Date: Sun Aug 19 17:38:11 2018 +0200
Add internal function mapping subr index to function
* libguile/gsubr.h:
* libguile/gsubr.c (scm_subr_function_by_index): New internal function.
(scm_subr_function): Use new function.
---
libguile/gsubr.c | 10 ++++++++--
libguile/gsubr.h | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/libguile/gsubr.c b/libguile/gsubr.c
index 2384776..b99cc67 100644
--- a/libguile/gsubr.c
+++ b/libguile/gsubr.c
@@ -441,12 +441,18 @@ scm_i_primitive_name (const uint32_t *code)
}
scm_t_subr
-scm_subr_function (SCM subr)
+scm_subr_function_by_index (uint32_t idx)
{
- uint32_t idx = primitive_subr_idx (SCM_PROGRAM_CODE (subr));
if (idx == NOT_A_SUBR_CALL)
abort ();
return subrs[idx];
+}
+
+scm_t_subr
+scm_subr_function (SCM subr)
+{
+ uint32_t idx = primitive_subr_idx (SCM_PROGRAM_CODE (subr));
+ return scm_subr_function_by_index (idx);
}
SCM
diff --git a/libguile/gsubr.h b/libguile/gsubr.h
index 63c2a76..91a1104 100644
--- a/libguile/gsubr.h
+++ b/libguile/gsubr.h
@@ -57,6 +57,7 @@ SCM_INTERNAL uintptr_t scm_i_primitive_call_ip (SCM subr);
SCM_INTERNAL SCM scm_i_primitive_name (const uint32_t *code);
SCM_API scm_t_subr scm_subr_function (SCM subr);
+SCM_INTERNAL scm_t_subr scm_subr_function_by_index (uint32_t subr_idx);
SCM_API SCM scm_subr_name (SCM subr);
SCM_INTERNAL SCM scm_apply_subr (union scm_vm_stack_element *sp,
- [Guile-commits] branch lightning updated (3827769 -> d001503), Andy Wingo, 2018/08/20
- [Guile-commits] 06/07: Fix bounds on compiler-emitted JIT metadata, Andy Wingo, 2018/08/20
- [Guile-commits] 01/07: Add internal function mapping subr index to function,
Andy Wingo <=
- [Guile-commits] 05/07: Fix default code allocator in Lightning, Andy Wingo, 2018/08/20
- [Guile-commits] 02/07: Expose scm_vm_builtin_ref internally, Andy Wingo, 2018/08/20
- [Guile-commits] 04/07: Manual JIT interface via %jit-compile, Andy Wingo, 2018/08/20
- [Guile-commits] 07/07: JIT compilation tweaks, Andy Wingo, 2018/08/20
- [Guile-commits] 03/07: First implementation of a template JIT, Andy Wingo, 2018/08/20