mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
remove repl-vm; repl evaluation does not cause recursive vm invocation
* module/system/repl/common.scm (<repl>): Remove "vm" field and repl-vm accessor. I think the correct model is to just use the-vm. This change was prompted by the need to have the REPL itself not cause a recursive VM invocation, so that captured prompts at the REPL are rewindable. (make-repl): Remove treatment of #:vm. (repl-eval): Load a compiled expression as a simple thunk, avoiding a recursive VM call. * module/system/repl/command.scm (profile, trace): Remove repl-vm treatment. (backtrace, debugger, step): Remove, as they were not implemented.
This commit is contained in:
parent
32ce4058db
commit
01c0082fae
2 changed files with 17 additions and 33 deletions
|
@ -28,7 +28,6 @@
|
||||||
#:use-module (system vm program)
|
#:use-module (system vm program)
|
||||||
#:use-module (system vm vm)
|
#:use-module (system vm vm)
|
||||||
#:autoload (system base language) (lookup-language language-reader)
|
#:autoload (system base language) (lookup-language language-reader)
|
||||||
#:autoload (system vm debug) (vm-debugger vm-backtrace)
|
|
||||||
#:autoload (system vm trace) (vm-trace)
|
#:autoload (system vm trace) (vm-trace)
|
||||||
#:autoload (system vm profile) (vm-profile)
|
#:autoload (system vm profile) (vm-profile)
|
||||||
#:use-module (ice-9 format)
|
#:use-module (ice-9 format)
|
||||||
|
@ -51,7 +50,7 @@
|
||||||
(compile (compile c) (compile-file cc)
|
(compile (compile c) (compile-file cc)
|
||||||
(disassemble x) (disassemble-file xx))
|
(disassemble x) (disassemble-file xx))
|
||||||
(profile (time t) (profile pr))
|
(profile (time t) (profile pr))
|
||||||
(debug (backtrace bt) (debugger db) (trace tr) (step st))
|
(debug (trace tr))
|
||||||
(system (gc) (statistics stat))))
|
(system (gc) (statistics stat))))
|
||||||
|
|
||||||
(define (group-name g) (car g))
|
(define (group-name g) (car g))
|
||||||
|
@ -358,9 +357,9 @@ Time execution."
|
||||||
"profile FORM
|
"profile FORM
|
||||||
Profile execution."
|
Profile execution."
|
||||||
;; FIXME opts
|
;; FIXME opts
|
||||||
(let ((vm (repl-vm repl))
|
(apply statprof
|
||||||
(proc (make-program (repl-compile repl (repl-parse repl form)))))
|
(make-program (repl-compile repl (repl-parse repl form)))
|
||||||
(apply statprof (lambda () (vm-apply vm proc '())) opts)))
|
opts))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -368,29 +367,15 @@ Profile execution."
|
||||||
;;; Debug commands
|
;;; Debug commands
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define-meta-command (backtrace repl)
|
(define-meta-command (trace repl (form) . opts)
|
||||||
"backtrace
|
|
||||||
Display backtrace."
|
|
||||||
(vm-backtrace (repl-vm repl)))
|
|
||||||
|
|
||||||
(define-meta-command (debugger repl)
|
|
||||||
"debugger
|
|
||||||
Start debugger."
|
|
||||||
(vm-debugger (repl-vm repl)))
|
|
||||||
|
|
||||||
(define-meta-command (trace repl form . opts)
|
|
||||||
"trace FORM
|
"trace FORM
|
||||||
Trace execution."
|
Trace execution."
|
||||||
;; FIXME: doc options, or somehow deal with them better
|
;; FIXME: doc options, or somehow deal with them better
|
||||||
(apply vm-trace
|
(apply vm-trace
|
||||||
(repl-vm repl)
|
(the-vm)
|
||||||
(make-program (repl-compile repl (repl-parse repl form)))
|
(make-program (repl-compile repl (repl-parse repl form)))
|
||||||
opts))
|
opts))
|
||||||
|
|
||||||
(define-meta-command (step repl)
|
|
||||||
"step FORM
|
|
||||||
Step execution."
|
|
||||||
(display "Not implemented yet\n"))
|
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
#:use-module (system base syntax)
|
#:use-module (system base syntax)
|
||||||
#:use-module (system base compile)
|
#:use-module (system base compile)
|
||||||
#:use-module (system base language)
|
#:use-module (system base language)
|
||||||
#:use-module (system vm vm)
|
#:use-module (system vm program)
|
||||||
#:use-module (ice-9 control)
|
#:use-module (ice-9 control)
|
||||||
#:export (<repl> make-repl repl-vm repl-language repl-options
|
#:export (<repl> make-repl repl-language repl-options
|
||||||
repl-tm-stats repl-gc-stats
|
repl-tm-stats repl-gc-stats
|
||||||
repl-welcome repl-prompt repl-read repl-compile repl-eval
|
repl-welcome repl-prompt repl-read repl-compile repl-eval
|
||||||
repl-parse repl-print repl-option-ref repl-option-set!
|
repl-parse repl-print repl-option-ref repl-option-set!
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
;;; Repl type
|
;;; Repl type
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define-record/keywords <repl> vm language options tm-stats gc-stats)
|
(define-record/keywords <repl> language options tm-stats gc-stats)
|
||||||
|
|
||||||
(define repl-default-options
|
(define repl-default-options
|
||||||
'((trace . #f)
|
'((trace . #f)
|
||||||
|
@ -43,8 +43,7 @@
|
||||||
|
|
||||||
(define %make-repl make-repl)
|
(define %make-repl make-repl)
|
||||||
(define (make-repl lang)
|
(define (make-repl lang)
|
||||||
(%make-repl #:vm (the-vm)
|
(%make-repl #:language (lookup-language lang)
|
||||||
#:language (lookup-language lang)
|
|
||||||
#:options repl-default-options
|
#:options repl-default-options
|
||||||
#:tm-stats (times)
|
#:tm-stats (times)
|
||||||
#:gc-stats (gc-stats)))
|
#:gc-stats (gc-stats)))
|
||||||
|
@ -77,13 +76,13 @@
|
||||||
(if parser (parser form) form)))
|
(if parser (parser form) form)))
|
||||||
|
|
||||||
(define (repl-eval repl form)
|
(define (repl-eval repl form)
|
||||||
(let ((eval (language-evaluator (repl-language repl))))
|
(let* ((eval (language-evaluator (repl-language repl)))
|
||||||
(if (and eval
|
(thunk (if (and eval
|
||||||
(or (null? (language-compilers (repl-language repl)))
|
(or (null? (language-compilers (repl-language repl)))
|
||||||
(assq-ref (repl-options repl) 'interp)))
|
(assq-ref (repl-options repl) 'interp)))
|
||||||
(% (eval form (current-module)))
|
(lambda () (eval form (current-module)))
|
||||||
(let ((compiled (repl-compile repl form '())))
|
(make-program (repl-compile repl form '())))))
|
||||||
(% (vm-load (repl-vm repl) compiled))))))
|
(% (thunk))))
|
||||||
|
|
||||||
(define (repl-print repl val)
|
(define (repl-print repl val)
|
||||||
(if (not (eq? val *unspecified*))
|
(if (not (eq? val *unspecified*))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue