1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 12:20:20 +02:00

Optimize check-urange in assembler.scm

* module/system/vm/assembler.scm (check-urange): Hoist exact-integer?
  check so that the side effect is entirely in this function and not in
  `logand'.  Allows devirtualize-integers to peel off a nice straight
  trace.
This commit is contained in:
Andy Wingo 2017-11-22 11:53:42 +01:00
parent 8d30643751
commit 7d71d9b945

View file

@ -305,10 +305,9 @@
;;; These helpers create one 32-bit unit from multiple components.
(define-inline (check-urange x mask)
(let ((x* (logand x mask)))
(unless (= x x*)
(error "out of range" x))
x*))
(unless (and (exact-integer? x) (= x (logand x mask)))
(error "out of range" x))
x)
(define-inline (check-srange x mask)
(let ((x* (logand x mask)))