GLIL and assembly support for prompt compilation
authorAndy Wingo <wingo@pobox.com>
Sat, 30 Jan 2010 14:09:41 +0000 (15:09 +0100)
committerAndy Wingo <wingo@pobox.com>
Sun, 31 Jan 2010 19:40:24 +0000 (20:40 +0100)
* module/language/glil/compile-assembly.scm (glil->assembly): Compile
  <glil-prompt> appropriately.

* module/language/assembly/disassemble.scm (code-annotation):
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
* module/language/assembly/compile-bytecode.scm (write-bytecode):
  Assemble and disassemble `prompt' appropriately.

module/language/assembly/compile-bytecode.scm
module/language/assembly/decompile-bytecode.scm
module/language/assembly/disassemble.scm
module/language/glil/compile-assembly.scm

index e6fc5bc..f045148 100644 (file)
@@ -1,6 +1,6 @@
 ;;; Guile VM assembler
 
-;; Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
 
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
         ((br-if-nargs-lt ,hi ,lo ,l) (write-byte hi) (write-byte lo) (write-break l))
         ((br-if-nargs-gt ,hi ,lo ,l) (write-byte hi) (write-byte lo) (write-break l))
         ((mv-call ,n ,l) (write-byte n) (write-break l))
+        ((prompt ,inline-handler? ,escape-only? ,l)
+         (write-byte inline-handler?) (write-byte escape-only?) (write-break l))
         (else
          (cond
           ((< (instruction-length inst) 0)
index 6d41da2..a021b57 100644 (file)
@@ -1,6 +1,6 @@
 ;;; Guile VM code converters
 
-;; Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
 
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -90,6 +90,8 @@
                   (lp (cons `(,br ,hi ,lo ,(ensure-label rel1 rel2 rel3)) out)))
                  ((mv-call ,n ,rel1 ,rel2 ,rel3)
                   (lp (cons `(mv-call ,n ,(ensure-label rel1 rel2 rel3)) out)))
+                 ((prompt ,n0 ,n1 ,rel1 ,rel2 ,rel3)
+                  (lp (cons `(prompt ,n0 ,n1 ,(ensure-label rel1 rel2 rel3)) out)))
                  (else 
                   (lp (cons exp out))))))))))
 
index d072d3b..e74be1b 100644 (file)
                   (list "`~s'" v)))))
       ((mv-call)
        (list "MV -> ~A" (assq-ref labels (cadr args))))
+      ((prompt)
+       ;; the H is for handler
+       (list "H -> ~A" (assq-ref labels (caddr args))))
       (else
        (and=> (assembly->object code)
               (lambda (obj) (list "~s" obj)))))))
index 53c423d..95804ec 100644 (file)
               (error "Wrong number of stack arguments to instruction:" inst nargs)))))
 
     ((<glil-mv-call> nargs ra)
-     (emit-code `((mv-call ,nargs ,ra))))))
+     (emit-code `((mv-call ,nargs ,ra))))
+
+    ((<glil-prompt> label inline? escape-only?)
+     (emit-code `((prompt ,(if inline? 1 0)
+                          ,(if escape-only? 1 0)
+                          ,label))))))
 
 (define (dump-object x addr)
   (define (too-long x)