1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 16:50:21 +02:00

default to regular vm for noninteractive use

* libguile/script.c (scm_compile_shell_switches): Select the debugging
  VM in the cases that we previously would select deval -- when running
  interactively without --no-debug, or otherwise with --debug.

* libguile/vm.c: Default to the regular engine.
  (scm_c_set_vm_engine_x): Remove requirement for the VM to have no
  pending computations.
This commit is contained in:
Andy Wingo 2010-09-28 09:22:38 +02:00
parent f2ee6341ba
commit 97b18a6640
2 changed files with 5 additions and 13 deletions

View file

@ -40,6 +40,7 @@
#include "libguile/strports.h" #include "libguile/strports.h"
#include "libguile/validate.h" #include "libguile/validate.h"
#include "libguile/version.h" #include "libguile/version.h"
#include "libguile/vm.h"
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
@ -718,7 +719,10 @@ scm_compile_shell_switches (int argc, char **argv)
was not explicitly turned off, turn on debugging. */ was not explicitly turned off, turn on debugging. */
if (turn_on_debugging || (interactive && !dont_turn_on_debugging)) if (turn_on_debugging || (interactive && !dont_turn_on_debugging))
{ {
/* FIXME: backtraces and positions should always be on (?) */
tail = scm_cons (scm_cons (sym_turn_on_debugging, SCM_EOL), tail); tail = scm_cons (scm_cons (sym_turn_on_debugging, SCM_EOL), tail);
scm_c_set_default_vm_engine_x (SCM_VM_DEBUG_ENGINE);
scm_c_set_vm_engine_x (scm_the_vm (), SCM_VM_DEBUG_ENGINE);
} }
{ {

View file

@ -36,7 +36,7 @@
#include "programs.h" #include "programs.h"
#include "vm.h" #include "vm.h"
static int vm_default_engine = SCM_VM_DEBUG_ENGINE; static int vm_default_engine = SCM_VM_REGULAR_ENGINE;
/* Unfortunately we can't snarf these: snarfed things are only loaded up from /* Unfortunately we can't snarf these: snarfed things are only loaded up from
(system vm vm), which might not be loaded before an error happens. */ (system vm vm), which might not be loaded before an error happens. */
@ -745,13 +745,6 @@ vm_engine_to_symbol (int engine, const char *FUNC_NAME)
} }
} }
static int
vm_has_pending_computation (SCM vm)
{
struct scm_vm *vp = SCM_VM_DATA (vm);
return vp->sp >= vp->stack_base;
}
SCM_DEFINE (scm_vm_engine, "vm-engine", 1, 0, 0, SCM_DEFINE (scm_vm_engine, "vm-engine", 1, 0, 0,
(SCM vm), (SCM vm),
"") "")
@ -768,11 +761,6 @@ scm_c_set_vm_engine_x (SCM vm, int engine)
{ {
SCM_VALIDATE_VM (1, vm); SCM_VALIDATE_VM (1, vm);
if (vm_has_pending_computation (vm))
SCM_MISC_ERROR ("VM engine may only be changed while there are no "
"pending computations.",
SCM_EOL);
if (engine < 0 || engine >= SCM_VM_NUM_ENGINES) if (engine < 0 || engine >= SCM_VM_NUM_ENGINES)
SCM_MISC_ERROR ("Unknown VM engine: ~a", SCM_MISC_ERROR ("Unknown VM engine: ~a",
scm_list_1 (scm_from_int (engine))); scm_list_1 (scm_from_int (engine)));