[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guile-vm 0.3
From: |
Keisuke Nishida |
Subject: |
Re: guile-vm 0.3 |
Date: |
Wed, 04 Apr 2001 16:41:24 -0400 |
User-agent: |
Wanderlust/2.4.0 (Rio) SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) Emacs/21.0.99 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) |
I have updated the guile-vm module in CVS, and now it does not depend
on my new module system at all (I hope). Could you try it again?
Installation
------------
% ./autogen.sh
% configure
% make
% su
# make install
# ln -s module/{system,language} /usr/local/share/guile/site/
Add the following lines to your ~/.guile:
(if (string=? (car (command-line)) "guile-vm")
(begin
(use-modules (system repl repl))
(start-repl 'r5rs)
(quit)))
Example Session
---------------
% guile-vm
Standard Scheme (R5RS + syntax-case) interpreter 0.3 on Guile 1.4.1
Copyright (C) 2001 Free Software Foundation, Inc.
Enter `,help' for help.
address@hidden> (+ 1 2)
$1 = 3
address@hidden> ,c -c (+ 1 2) ;; Compile into GLIL
(@asm (0 0 0 0)
(const 1)
(const 2)
(add)
(return))
address@hidden> ,c -l (+ 1 2) ;; Compile into loadable code
0 make-int8:0 ;; 0
1 load-program #0
8 return
Bytecode #0:
0 make-int8:1 ;; 1
1 make-int8 2 ;; 2
3 add
4 return
address@hidden> ,c (+ 1 2) ;; Compile and disassemble
Disassembly of #<program 0x810f75b>:
args = 0 rest = 0 locals = 0
Bytecode:
0 make-int8:1 ;; 1
1 make-int8 2 ;; 2
3 add
4 return
address@hidden> (define (add x y) (+ x y))
address@hidden> (add 1 2)
$2 = 3
address@hidden> ,x add ;; Disassemble
Disassembly of #<program 0x8125f70>:
args = 2 rest = 0 locals = 0
Bytecode:
0 local-ref 1
2 local-ref:0
3 add
4 return
address@hidden>
Write Modules
-------------
---- fib.scm ---------------------------
(define-module (fib)
:use-module (system vm load)
:export (fib))
(load/compile "fib.gsm")
----------------------------------------
---- fib.gsm ---------------------------
(define (fib n)
(if (< n 2)
1
(+ (fib (- n 1)) (fib (- n 2)))))
----------------------------------------
Now, expressions in fib.gsm are automatically compiled and
executed by the Guile VM:
% guile
guile> (use-modules (fib))
guile> (time (fib 30))
clock utime stime cutime cstime gctime
2.89 2.88 0.00 0.00 0.00 0.00
$1 = 1346269
guile> (define (fib n) (if (< n 2) 1 (+ (fib (- n 1)) (fib (- n 2)))))
guile> (time (fib 30))
clock utime stime cutime cstime gctime
26.05 25.01 0.17 0.00 0.00 14.33
$2 = 1346269
If you don't want to compile your code (e.g., for debugging purpose),
just change `load/compile' to `load'.
- Re: Question about your profiling patch..., (continued)
- Re: Question about your profiling patch..., Rob Browning, 2001/04/05
- Re: Question about your profiling patch..., Neil Jerram, 2001/04/06
- Re: Question about your profiling patch..., Neil Jerram, 2001/04/06
- Re: Question about your profiling patch..., Keisuke Nishida, 2001/04/06
- Re: Question about your profiling patch..., Neil Jerram, 2001/04/08
- Re: Question about your profiling patch..., Rob Browning, 2001/04/08
- Re: Question about your profiling patch..., Keisuke Nishida, 2001/04/09
- Re: Question about your profiling patch..., Neil Jerram, 2001/04/07
- Re: Question about your profiling patch..., Rob Browning, 2001/04/07
- Re: Question about your profiling patch..., Rob Browning, 2001/04/05
- Re: guile-vm 0.3,
Keisuke Nishida <=
- Re: guile-vm 0.3, Ariel Rios, 2001/04/03
- Re: guile-vm 0.3, Rob Browning, 2001/04/03
- Re: guile-vm 0.3, Evan Prodromou, 2001/04/04
- Re: guile-vm 0.3, Ariel Rios, 2001/04/05
- Re: guile-vm 0.3, Rob Browning, 2001/04/05
- Re: guile-vm 0.3, Marius Vollmer, 2001/04/05
- Re: guile-vm 0.3, Ariel Rios, 2001/04/05
- Re: guile-vm 0.3, Marius Vollmer, 2001/04/05
- Re: guile-vm 0.3, Miroslav Silovic, 2001/04/06
- Re: guile-vm 0.3, Rob Browning, 2001/04/09