guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile-vm 0.3


From: Keisuke Nishida
Subject: guile-vm 0.3
Date: Sun, 01 Apr 2001 01:16:46 -0500
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 checked in the current snapshot of my Guile VM to the CVS.
If anyone is interested, please check it out and try it.

Install
-------

  % cd guile/guile-vm
  % ./autogen.sh; configure && make install
  % ln -s module/{language,system} /usr/local/share/guile/site/

Setup
-----

Add the following lines to your ~/.guile:

  (if (string=? (car (command-line)) "guile-vm")
      (begin
        (use-modules (system repl repl))
        (start-repl 'ghil)
        (quit)))

Example
-------

  % gulie-vm
  Guile High Intermediate Language (GHIL) 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 0x80ff863>:

  args = 0  rest = 0  locals = 0

  Bytecode:

     0    make-int8:1             ;; 1
     1    make-int8 2             ;; 2
     3    add
     4    return

  address@hidden> (@define fib
               (@lambda (n)
                 (@if (@< n 2) 1 (@+ (fib (@- n 1)) (fib (@- n 2))))))
  address@hidden> ,trace (fib 3)
  (#<program 0x80f607c> 3)
  | (#<program 0x80f607c> 2)
  | | (#<program 0x80f607c> 1)
  | | 1
  | | (#<program 0x80f607c> 0)
  | | 1
  | 2
  | (#<program 0x80f607c> 1)
  | 1
  3
  address@hidden> ,trace -a (fib 1)
  0xbfffef68  (call 0)            #()   (#<program 0x80f6813>)
  0x80f6813  (make-int8:1)       #()    ()
  0x80f6814  (load-module)       #()    (1)
  0x80f681a  (load-symbol)       #()    (#<env 40345e00> 1)
  0x80f681f  (link)              #()    (fib #<env 40345e00> 1)
  0x80f6820  (variable-ref)      #()    ((fib . #<program 0x80f607c>) 1)
  0x80f6821  (tail-call 1)       #()    (#<program 0x80f607c> 1)
  (#<program 0x80f607c> 1)
  0x80f607c  (local-ref:0)       #(1)   ()
  0x80f607d  (make-int8 2)       #(1)   (1)
  0x80f607f  (lt?)               #(1)   (2 1)
  0x80f6080  (br-if-not 2)       #(1)   (#t)
  0x80f6082  (make-int8:1)       #(1)   ()
  0x80f6083  (return)            #(1)   (1)
  1
  0xbfffef6a  (halt)              #()   (1)
  address@hidden> ,time (fib 30)
  $2 = 1346269
  clock utime stime cutime cstime gctime
   3.42  3.40  0.00   0.00   0.00   0.00
  address@hidden> 

Status
------

Currently, the Scheme interpreter (r5rs) is not working.
I have tested the VM only by the fib function above.
Please don't expect too much for now.

I'll hopefully get the VM usable during this summer.

Kei



reply via email to

[Prev in Thread] Current Thread [Next in Thread]