1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

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).
This commit is contained in:
Andy Wingo 2011-05-05 10:09:48 +02:00
parent 2d239a78d4
commit 81f529091b

View file

@ -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))))