mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
add new rtl vm
* libguile/vm-engine.c (rtl_vm_engine): Add new VM. (vm_engine): Add support for calling RTL programs. * libguile/tags.h (scm_tc7_rtl_program): New type for procedures that run on the new VM. * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (scm_class_of): * libguile/print.c (iprin1): * libguile/procprop.c (scm_i_procedure_arity): * libguile/procs.c (scm_procedure_p): Add hooks for the new tc7. * libguile/programs.h: * libguile/programs.c (scm_make_rtl_program, scm_i_rtl_program_print) (scm_rtl_program_p, scm_rtl_program_code): * module/system/vm/program.scm: Add constructors and accessors for the new "RTL programs". * libguile/vm.c (rtl_boot_continuation): Define a boot program. (rtl_apply, rtl_values): New static RTL programs. * libguile/frames.c (scm_frame_num_locals): Adapt for frames of RTL programs. * libguile/frames.h: Add description of RTL frames. * libguile/Makefile.am: Add rules to generate vm-operations.h. * .gitignore: Ignore vm-operations.h. * module/system/vm/instruction.scm: * libguile/instructions.c: * libguile/instructions.h: Use vm-operations.h to define enumerated values for the new RTL opcodes. Define some helper macros to pack and unpack 32-bit instruction words. (rtl-instruction-list): New function, exported by (system vm instruction). * libguile/objcodes.c: Wire up the bits needed to detect the new RTL bytecode and load it, as appropriate.
This commit is contained in:
parent
1701a68920
commit
510ca12687
19 changed files with 3626 additions and 29 deletions
|
@ -594,6 +594,30 @@ vm_error_bad_wide_string_length (size_t len)
|
|||
|
||||
static SCM boot_continuation;
|
||||
|
||||
static SCM rtl_boot_continuation;
|
||||
static SCM rtl_apply;
|
||||
static SCM rtl_values;
|
||||
|
||||
static const scm_t_uint32 rtl_boot_continuation_code[] = {
|
||||
SCM_PACK_RTL_24 (scm_rtl_op_halt_values, 0), /* empty stack frame in r0-r2, results from r3 */
|
||||
SCM_PACK_RTL_24 (scm_rtl_op_halt, 0) /* result in r0 */
|
||||
};
|
||||
|
||||
static scm_t_uint32* rtl_boot_multiple_value_continuation_code =
|
||||
(scm_t_uint32 *) rtl_boot_continuation_code;
|
||||
|
||||
static scm_t_uint32* rtl_boot_single_value_continuation_code =
|
||||
(scm_t_uint32 *) rtl_boot_continuation_code + 1;
|
||||
|
||||
static const scm_t_uint32 rtl_apply_code[] = {
|
||||
SCM_PACK_RTL_24 (scm_rtl_op_apply, 0) /* proc in r0, args from r1, nargs set */
|
||||
};
|
||||
|
||||
static const scm_t_uint32 rtl_values_code[] = {
|
||||
SCM_PACK_RTL_24 (scm_rtl_op_values, 0) /* vals from r0 */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* VM
|
||||
|
@ -637,18 +661,22 @@ initialize_default_stack_size (void)
|
|||
}
|
||||
|
||||
#define VM_NAME vm_regular_engine
|
||||
#define RTL_VM_NAME rtl_vm_regular_engine
|
||||
#define FUNC_NAME "vm-regular-engine"
|
||||
#define VM_ENGINE SCM_VM_REGULAR_ENGINE
|
||||
#include "vm-engine.c"
|
||||
#undef VM_NAME
|
||||
#undef RTL_VM_NAME
|
||||
#undef FUNC_NAME
|
||||
#undef VM_ENGINE
|
||||
|
||||
#define VM_NAME vm_debug_engine
|
||||
#define RTL_VM_NAME rtl_vm_debug_engine
|
||||
#define FUNC_NAME "vm-debug-engine"
|
||||
#define VM_ENGINE SCM_VM_DEBUG_ENGINE
|
||||
#include "vm-engine.c"
|
||||
#undef VM_NAME
|
||||
#undef RTL_VM_NAME
|
||||
#undef FUNC_NAME
|
||||
#undef VM_ENGINE
|
||||
|
||||
|
@ -1110,6 +1138,10 @@ scm_init_vm (void)
|
|||
#ifndef SCM_MAGIC_SNARFER
|
||||
#include "libguile/vm.x"
|
||||
#endif
|
||||
|
||||
rtl_boot_continuation = scm_i_make_rtl_program (rtl_boot_continuation_code);
|
||||
rtl_apply = scm_i_make_rtl_program (rtl_apply_code);
|
||||
rtl_values = scm_i_make_rtl_program (rtl_values_code);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue