From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: further hacking on guile-vm Date: Mon, 12 May 2008 23:49:31 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210629046 8658 80.91.229.12 (12 May 2008 21:50:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 May 2008 21:50:46 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon May 12 23:51:21 2008 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JvfvL-0008Kx-HH for guile-devel@m.gmane.org; Mon, 12 May 2008 23:51:11 +0200 Original-Received: from localhost ([127.0.0.1]:34361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jvfuc-0007q9-Pi for guile-devel@m.gmane.org; Mon, 12 May 2008 17:50:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JvfuX-0007p7-CN for guile-devel@gnu.org; Mon, 12 May 2008 17:50:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JvfuV-0007nF-Su for guile-devel@gnu.org; Mon, 12 May 2008 17:50:20 -0400 Original-Received: from [199.232.76.173] (port=54261 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JvfuV-0007n3-I1 for guile-devel@gnu.org; Mon, 12 May 2008 17:50:19 -0400 Original-Received: from a-sasl-fastnet.sasl.smtp.pobox.com ([207.106.133.19]:57630 helo=sasl.smtp.pobox.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JvfuV-0008Aq-EW for guile-devel@gnu.org; Mon, 12 May 2008 17:50:19 -0400 Original-Received: from localhost.localdomain (localhost [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 18C6B38CF for ; Mon, 12 May 2008 17:50:18 -0400 (EDT) Original-Received: from unquote (251.Red-81-39-162.dynamicIP.rima-tde.net [81.39.162.251]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 5D4E038CD for ; Mon, 12 May 2008 17:50:17 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-Pobox-Relay-ID: 6948E13C-206D-11DD-BB41-80001473D85F-02397024!a-sasl-fastnet.pobox.com X-detected-kernel: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:7242 Archived-At: Greetings! So, I have been poking more at guile-vm. The focus of this patchset is on repl usability. Download guile-vm, ./autogen.sh && ./configure && make, then run: $ ./env guile guile> (use-modules (system repl repl)) guile> (start-repl 'scheme) Guile Scheme interpreter 0.5 on Guile 1.8.4 Copyright (C) 2001-2008 Free Software Foundation, Inc. Enter `,help' for help. scheme@(guile-user)> 3 $1 = 3 scheme@(guile-user)> ,compile (lambda (x) (* x x)) Disassembly of #: nlocs = 0 nexts = 0 0 (make-int8 64) ;; 64 2 (link "*") 5 (vector 0 1) ;; 1 element 8 (make-int8 0) ;; 0 10 (load-symbol "x") ;; x 13 (make-false) ;; #f 14 (make-int8 0) ;; 0 16 (list 0 3) ;; 3 elements 19 (list 0 2) ;; 2 elements 22 (list 0 1) ;; 1 element 25 (make-int8 9) ;; 9 27 (make-int8 0) ;; 0 29 (make-int8 21) ;; 21 31 (cons) 32 (cons) 33 (list 0 2) ;; 2 elements 36 (load-program ##{89}#) 47 (return) Bytecode ##{89}#: 0 (object-ref 0) 2 (variable-ref) 3 (local-ref 0) 5 (local-ref 0) 7 (tail-call 2) It's rather neat! There's a bit of preamble in the first bit, but basically it compiles a "program" that has a prelude that loads up constants and external linkages, and the actual lambda is in ##{89}##. Of course, guile-vm can deal with much more complex code as well. It can't deal with all guile code, but it's getting there. Anyway, other than that, in this patchset there is something to make `define' compile differently than `set'. I ended up making a new instruction for `define', that's not `link'. Ludovic, or anyone else, if you have any insights as to the wisdom or folly of this addition, they are appreciated. The following changes since commit f540e3271b55bd9e61165557c72d6ff8f9619e54: Andy Wingo (1): Replace ice-9 match's structures with guile's records are available in the git repository at: http://wingolog.org/git/guile-vm.git master Andy Wingo (14): multiple-values help for the repl; exports cleanups more exports cleanups readline integration for guile-vm ice-9 history integration fix to meta-reader's optional port argument pmatchify a cond for prettiness ? -> foo?; some exports cleanups explicitly list exports instead of using define-public remove define-private only allow `define' at toplevel fixes so that typing asdfadfasff in the repl doesn't error replace cenv with things in and fluids; remove the `use' meta-command catch errors in the repl, with poor backtraces add env script env | 4 + module/language/scheme/translate.scm | 25 ++++---- module/system/base/compile.scm | 22 ++++---- module/system/base/syntax.scm | 38 ++----------- module/system/il/compile.scm | 2 +- module/system/il/ghil.scm | 102 ++++++++++++++++++---------------- module/system/il/glil.scm | 42 ++++++++------ module/system/repl/command.scm | 69 +++++++---------------- module/system/repl/common.scm | 69 +++++++++++------------ module/system/repl/describe.scm | 8 +- module/system/repl/repl.scm | 95 ++++++++++++++++++++++++++----- module/system/vm/assemble.scm | 18 +++++- module/system/vm/core.scm | 59 +++++++++++-------- module/system/vm/frame.scm | 17 +++-- module/system/vm/trace.scm | 9 ++- src/vm_loader.c | 31 +++++----- 16 files changed, 331 insertions(+), 279 deletions(-) create mode 100755 env Andy -- http://wingolog.org/