summaryrefslogtreecommitdiff
path: root/libguile/vm-engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/vm-engine.c')
-rw-r--r--libguile/vm-engine.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 2d28bbf35..1976f7107 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -34,29 +34,27 @@
static SCM
-VM_NAME (struct scm_vm *vp, SCM program, SCM *argv, int nargs)
+VM_NAME (SCM vm, SCM program, SCM *argv, int nargs)
{
/* VM registers */
register scm_t_uint8 *ip IP_REG; /* instruction pointer */
register SCM *sp SP_REG; /* stack pointer */
register SCM *fp FP_REG; /* frame pointer */
+ struct scm_vm *vp = SCM_VM_DATA (vm);
/* Cache variables */
struct scm_objcode *bp = NULL; /* program base pointer */
- SCM *free_vars = NULL; /* free variables */
- size_t free_vars_count = 0; /* length of FREE_VARS */
SCM *objects = NULL; /* constant objects */
size_t object_count = 0; /* length of OBJECTS */
SCM *stack_limit = vp->stack_limit; /* stack limit address */
+ SCM dynstate = SCM_I_CURRENT_THREAD->dynamic_state;
+ scm_t_int64 vm_cookie = vp->cookie++;
+
/* Internal variables */
int nvalues = 0;
SCM finish_args; /* used both for returns: both in error
and normal situations */
-#if VM_USE_HOOKS
- SCM hook_args = SCM_EOL;
-#endif
-
#ifdef HAVE_LABELS_AS_VALUES
static void **jump_table = NULL;
#endif
@@ -133,6 +131,8 @@ VM_NAME (struct scm_vm *vp, SCM program, SCM *argv, int nargs)
{
SCM err_msg;
+ /* FIXME: need to sync regs before allocating anything, in each case. */
+
vm_error_bad_instruction:
err_msg = scm_from_locale_string ("VM: Bad instruction: ~s");
finish_args = scm_list_1 (scm_from_uchar (ip[-1]));
@@ -148,19 +148,24 @@ VM_NAME (struct scm_vm *vp, SCM program, SCM *argv, int nargs)
goto vm_error;
vm_error_kwargs_length_not_even:
- err_msg = scm_from_locale_string ("Bad keyword argument list: odd length");
- finish_args = SCM_EOL;
- goto vm_error;
+ SYNC_ALL ();
+ err_msg = scm_from_locale_string ("Odd length of keyword argument list");
+ scm_error_scm (sym_keyword_argument_error, program, err_msg,
+ SCM_EOL, SCM_BOOL_F);
vm_error_kwargs_invalid_keyword:
- err_msg = scm_from_locale_string ("Bad keyword argument list: expected keyword");
- finish_args = SCM_EOL;
- goto vm_error;
+ /* FIXME say which one it was */
+ SYNC_ALL ();
+ err_msg = scm_from_locale_string ("Invalid keyword");
+ scm_error_scm (sym_keyword_argument_error, program, err_msg,
+ SCM_EOL, SCM_BOOL_F);
vm_error_kwargs_unrecognized_keyword:
- err_msg = scm_from_locale_string ("Bad keyword argument list: unrecognized keyword");
- finish_args = SCM_EOL;
- goto vm_error;
+ /* FIXME say which one it was */
+ SYNC_ALL ();
+ err_msg = scm_from_locale_string ("Unrecognized keyword");
+ scm_error_scm (sym_keyword_argument_error, program, err_msg,
+ SCM_EOL, SCM_BOOL_F);
vm_error_too_many_args:
err_msg = scm_from_locale_string ("VM: Too many arguments");
@@ -212,6 +217,12 @@ VM_NAME (struct scm_vm *vp, SCM program, SCM *argv, int nargs)
/* shouldn't get here */
goto vm_error;
+ vm_error_not_a_thunk:
+ SYNC_ALL ();
+ scm_wrong_type_arg_msg (FUNC_NAME, 1, finish_args, "thunk");
+ /* shouldn't get here */
+ goto vm_error;
+
vm_error_no_values:
err_msg = scm_from_locale_string ("Zero values returned to single-valued continuation");
finish_args = SCM_EOL;
@@ -222,6 +233,11 @@ VM_NAME (struct scm_vm *vp, SCM program, SCM *argv, int nargs)
finish_args = SCM_EOL;
goto vm_error;
+ vm_error_continuation_not_rewindable:
+ err_msg = scm_from_locale_string ("Unrewindable partial continuation");
+ finish_args = scm_cons (finish_args, SCM_EOL);
+ goto vm_error;
+
vm_error_bad_wide_string_length:
err_msg = scm_from_locale_string ("VM: Bad wide string length: ~S");
goto vm_error;