1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-08 13:10:19 +02:00

Make programs.h private

This header file turns out to only have internal details.  Users that
need introspection can use Scheme.

* libguile/programs.h (SCM_PROGRAM_P, SCM_PROGRAM_CODE)
(SCM_PROGRAM_FREE_VARIABLES, SCM_PROGRAM_FREE_VARIABLE_REF)
(SCM_PROGRAM_FREE_VARIABLE_SET, SCM_PROGRAM_NUM_FREE_VARIABLES)
(SCM_VALIDATE_PROGRAM, SCM_F_PROGRAM_IS_BOOT, SCM_F_PROGRAM_IS_PRIMITIVE)
(SCM_F_PROGRAM_IS_PRIMITIVE_GENERIC, SCM_F_PROGRAM_IS_CONTINUATION)
(SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION, SCM_F_PROGRAM_IS_FOREIGN)
(SCM_PROGRAM_IS_BOOT, SCM_PROGRAM_IS_PRIMITIVE)
(SCM_PROGRAM_IS_PRIMITIVE_GENERIC, SCM_PROGRAM_IS_CONTINUATION)
(SCM_PROGRAM_IS_PARTIAL_CONTINUATION, SCM_PROGRAM_IS_FOREIGN): Remove
these macros, as we are making this whole API private.
(struct scm_program, scm_is_program, scm_to_program, scm_from_program)
(scm_program_flags, scm_program_is_boot, scm_program_is_primitive)
(scm_program_is_primitive_generic, scm_program_is_continuation)
(scm_program_is_partial_continuation, scm_program_is_foreign)
(scm_program_code, scm_program_free_variable_count)
(scm_program_free_variable_ref, scm_program_free_variable_set_x)
(scm_i_make_program): New inline functions.
* libguile/Makefile.am (noinst_HEADERS): Add programs.h; no longer
installed.  It was never directly included from libguile.h.
* libguile/continuations.c:
* libguile/continuations.h:
* libguile/control.c:
* libguile/foreign.c:
* libguile/frames.c:
* libguile/frames.h:
* libguile/goops.c:
* libguile/gsubr.c:
* libguile/gsubr.h:
* libguile/intrinsics.h:
* libguile/procprop.c:
* libguile/procs.c:
* libguile/programs.c:
* libguile/stacks.c:
* libguile/vm-engine.c:
* libguile/vm.c:
* libguile/vm.h: Adapt all users.
This commit is contained in:
Andy Wingo 2025-05-30 12:40:52 +02:00
parent 93e5a2454a
commit 464ec999de
19 changed files with 290 additions and 144 deletions

View file

@ -454,7 +454,8 @@ VM_NAME (scm_thread *thread)
VP->fp = new_fp;
RESET_FRAME (nlocals);
ip = CALL_INTRINSIC (get_callee_vcode, (thread));
/* FIXME: Don't strip const qualifier. */
ip = (uint32_t *) CALL_INTRINSIC (get_callee_vcode, (thread));
CACHE_SP ();
NEXT (0);
@ -502,7 +503,8 @@ VM_NAME (scm_thread *thread)
*/
VM_DEFINE_OP (5, tail_call, "tail-call", OP1 (X32))
{
ip = CALL_INTRINSIC (get_callee_vcode, (thread));
/* FIXME: Don't strip const qualifier. */
ip = (uint32_t *) CALL_INTRINSIC (get_callee_vcode, (thread));
CACHE_SP ();
NEXT (0);
}
@ -996,13 +998,14 @@ VM_NAME (scm_thread *thread)
VM_DEFINE_OP (29, foreign_call, "foreign-call", OP1 (X8_C12_C12))
{
uint16_t cif_idx, ptr_idx;
SCM closure, cif, pointer;
struct scm_program *closure;
SCM cif, pointer;
UNPACK_12_12 (op, cif_idx, ptr_idx);
closure = FP_REF (0);
cif = SCM_PROGRAM_FREE_VARIABLE_REF (closure, cif_idx);
pointer = SCM_PROGRAM_FREE_VARIABLE_REF (closure, ptr_idx);
closure = scm_to_program (FP_REF (0));
cif = scm_program_free_variable_ref (closure, cif_idx);
pointer = scm_program_free_variable_ref (closure, ptr_idx);
SYNC_IP ();
CALL_INTRINSIC (foreign_call, (thread, cif, pointer));
@ -1026,8 +1029,8 @@ VM_NAME (scm_thread *thread)
UNPACK_24 (op, contregs_idx);
contregs =
SCM_PROGRAM_FREE_VARIABLE_REF (FP_REF (0), contregs_idx);
struct scm_program *closure = scm_to_program (FP_REF (0));
contregs = scm_program_free_variable_ref (closure, contregs_idx);
SYNC_IP ();
CALL_INTRINSIC (reinstate_continuation_x, (thread, contregs));
@ -1051,7 +1054,8 @@ VM_NAME (scm_thread *thread)
uint8_t *mcode;
UNPACK_24 (op, cont_idx);
vmcont = SCM_PROGRAM_FREE_VARIABLE_REF (FP_REF (0), cont_idx);
struct scm_program *closure = scm_to_program (FP_REF (0));
vmcont = scm_program_free_variable_ref (closure, cont_idx);
SYNC_IP ();
mcode = CALL_INTRINSIC (compose_continuation, (thread, vmcont));