diff options
author | Andy Wingo <wingo@pobox.com> | 2011-05-05 10:09:48 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-05-05 11:43:12 +0200 |
commit | 81f529091b4741aea6060194d83d24c17460d652 (patch) | |
tree | d05907862c7ef9c41b8124ee2cff8e4299a4e948 | |
parent | 2d239a78d49a435ffe879c6e4a32a57d486b231b (diff) | |
download | guile-81f529091b4741aea6060194d83d24c17460d652.tar.gz |
silly "optimization" in (language assembly)
* module/language/assembly.scm (byte-length): Silly, minor tweak: put
the fixed-length instruction case first. Seems to shave some 10% off
the time compiling psyntax.scm (when the whole rest of the system is
compiled, of course).
-rw-r--r-- | module/language/assembly.scm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/module/language/assembly.scm b/module/language/assembly.scm index e119628da..ad8dead65 100644 --- a/module/language/assembly.scm +++ b/module/language/assembly.scm @@ -1,6 +1,6 @@ ;;; Guile Virtual Machine Assembly -;; Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2009, 2010, 2011 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 @@ -37,8 +37,8 @@ (define (byte-length assembly) (pmatch assembly - (,label (guard (not (pair? label))) - 0) + ((,inst . _) (guard (>= (instruction-length inst) 0)) + (+ 1 (instruction-length inst))) ((load-number ,str) (+ 1 *len-len* (string-length str))) ((load-string ,str) @@ -51,8 +51,8 @@ (+ 1 *len-len* (bytevector-length bv))) ((load-program ,labels ,len ,meta . ,code) (+ 1 *program-header-len* len (if meta (1- (byte-length meta)) 0))) - ((,inst . _) (guard (>= (instruction-length inst) 0)) - (+ 1 (instruction-length inst))) + (,label (guard (not (pair? label))) + 0) (else (error "unknown instruction" assembly)))) |