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

Operations on 8-bit and 12-bit operands shuffle args into range

* module/language/cps/slot-allocation.scm (allocate-slots): Avoid
  allocating locals in the range [253,255].

* module/system/vm/assembler.scm: List exports explicitly.  For
  operations with limited-range operands, export wrapper assemblers that
  handle shuffling their operands into and out of their range.
  (define-assembler): Get rid of enclosing begin.
  (shuffling-assembler, define-shuffling-assembler): New helpers to
  define shuffling wrapper assemblers.
  (emit-mov*, emit-receive*): New functions.
  (shuffle-up-args): New helper.
  (standard-prelude, opt-prelude, kw-prelude): Call shuffle-up-args
  after finishing.

* test-suite/tests/compiler.test ("limits"): Add test cases.
This commit is contained in:
Andy Wingo 2014-04-21 19:28:06 +02:00
parent 28e12ea0c4
commit d4b3a36d42
3 changed files with 342 additions and 12 deletions

View file

@ -262,9 +262,15 @@ are comparable with eqv?. A tmp slot may be used."
(logand live-slots (lognot (ash 1 slot))))
(define (compute-slot live-slots hint)
(if (and hint (not (logbit? hint live-slots)))
;; Slots 253-255 are reserved for shuffling; see comments in
;; assembler.scm.
(if (and hint (not (logbit? hint live-slots))
(or (< hint 253) (> hint 255)))
hint
(find-first-zero live-slots)))
(let ((slot (find-first-zero live-slots)))
(if (or (< slot 253) (> slot 255))
slot
(+ 256 (find-first-zero (ash live-slots -256)))))))
(define (compute-call-proc-slot live-slots)
(+ 2 (find-first-trailing-zero live-slots)))
@ -307,6 +313,12 @@ are comparable with eqv?. A tmp slot may be used."
;; or to function return values -- it could be that they are out of
;; the computed live set. In that case they need to be adjoined to
;; the live set, used when choosing a temporary slot.
;;
;; Note that although we reserve slots 253-255 for shuffling
;; operands that address less than the full 24-bit range of locals,
;; that reservation doesn't apply here, because this temporary
;; itself is used while doing parallel assignment via "mov", and
;; "mov" does not need shuffling.
(define (compute-tmp-slot live stack-slots)
(find-first-zero (fold add-live-slot live stack-slots)))