1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-02 23:50:47 +02:00
guile/libguile/gsubr-internal.h
Andy Wingo 710fa4c6f0 Add machinery to pass thread and/or closure when invoking subr
* libguile/gsubr.c: Arrange to store flags alongside array of subrs.
One flag indicates the thread should also be passed as the first
argument; another says that the closure should be passed.  Should remove
the need for arg shuffling in get_callee_vcode eventually.
(record_subr_name): Make the names be a vector; will integrate better
with precise tracing.
(create_subr): Add flags arg.  Adapt callers.
(scm_apply_subr): Allow for passing thread or closure.
* libguile/gsubr-internal.h: Add new interfaces to see whether to pass
closure or thread.  Pass thread to scm_apply_subr.
* libguile/jit.c (compile_subr_call): Allow for passing thread or
closure.
* libguile/vm-engine.c (subr_call): Pass thread.
2025-06-11 13:05:15 +02:00

63 lines
2.1 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef SCM_GSUBR_INTERNAL_H
#define SCM_GSUBR_INTERNAL_H
/* Copyright 1995-1996,1998,2000-2001,2006,2008,2009-2011,2013,2015,2018,2025
Free Software Foundation, Inc.
This file is part of Guile.
Guile is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Guile is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with Guile. If not, see
<https://www.gnu.org/licenses/>. */
#include "libguile/gsubr.h"
/* Max number of args to the C procedure backing a gsubr */
#define SCM_GSUBR_MAX 10
#define SCM_PRIMITIVE_P(x) (scm_is_primitive (x))
#define SCM_PRIMITIVE_GENERIC_P(x) (scm_is_primitive_generic (x))
struct scm_program;
struct scm_thread;
SCM_INTERNAL uint32_t *
scm_i_alloc_primitive_code_with_instrumentation (size_t uint32_count,
uint32_t **write_ptr);
SCM_INTERNAL int scm_i_primitive_code_p (const uint32_t *code);
SCM_INTERNAL uintptr_t scm_i_primitive_call_ip (struct scm_program *subr);
SCM_INTERNAL SCM scm_i_primitive_name (const uint32_t *code);
SCM_INTERNAL int scm_is_primitive (SCM x);
SCM_INTERNAL int scm_is_primitive_generic (SCM x);
SCM_INTERNAL scm_t_subr scm_subr_function_by_index (uint32_t subr_idx);
SCM_INTERNAL int scm_subr_has_closure_argument (uint32_t subr_idx);
SCM_INTERNAL int scm_subr_has_thread_argument (uint32_t subr_idx);
SCM_INTERNAL SCM* scm_subr_generic (SCM x);
SCM_INTERNAL void scm_set_subr_generic (SCM x, SCM g);
SCM_INTERNAL SCM scm_apply_subr (struct scm_thread *thread,
union scm_vm_stack_element *sp,
uint32_t subr_idx, ptrdiff_t nargs);
SCM_INTERNAL void scm_init_gsubr (void);
#endif /* SCM_GSUBR_INTERNAL_H */