From acae7a59dadc87832ac9982ff2d7b40cb37eefa5 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Wed, 29 Feb 2012 12:36:48 -0700 Subject: [PATCH] svm: Port to 64 bit words. --- src/compiler/machines/svm/disassembler.scm | 2 +- src/compiler/machines/svm/machine.scm | 25 ++++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/compiler/machines/svm/disassembler.scm b/src/compiler/machines/svm/disassembler.scm index 590fa64fc..124584b41 100644 --- a/src/compiler/machines/svm/disassembler.scm +++ b/src/compiler/machines/svm/disassembler.scm @@ -489,7 +489,7 @@ USA. ;; global variable used by runtime/udata.scm -- Moby yuck! -(set! compiled-code-block/bytes-per-object 4) +(set! compiled-code-block/bytes-per-object address-units-per-object) ;;;; i386/dasm3.scm diff --git a/src/compiler/machines/svm/machine.scm b/src/compiler/machines/svm/machine.scm index 6129638ec..146070529 100644 --- a/src/compiler/machines/svm/machine.scm +++ b/src/compiler/machines/svm/machine.scm @@ -36,10 +36,9 @@ USA. (define-integrable addressing-granularity 8) (define-integrable scheme-type-width 6) (define-integrable scheme-type-limit #x40) -(define-integrable scheme-object-width 32) ;could be 64 too +(define-integrable scheme-object-width (if (fix:fixnum? #x100000000) 64 32)) (define-integrable scheme-datum-width - ;; See "***" below. (- scheme-object-width scheme-type-width)) (define-integrable float-width 64) @@ -51,11 +50,12 @@ USA. (define-integrable address-units-per-object (quotient scheme-object-width addressing-granularity)) -(define-integrable signed-fixnum/upper-limit - ;; *** This is (expt 2 (-1+ scheme-datum-width)), manually constant-folded. - #x02000000) +;; No 64-bit constants in the instruction stream. +(define-integrable min-long-width 32) -(define-integrable signed-fixnum/lower-limit +(define signed-fixnum/upper-limit + (expt 2 (- min-long-width scheme-type-width 1))) +(define signed-fixnum/lower-limit (- signed-fixnum/upper-limit)) (define-integrable unsigned-fixnum/upper-limit @@ -115,7 +115,7 @@ USA. (define (load-immediate-operand? n) (or (and (exact-integer? n) - (<= #x-80000000 n) (<= n #x7FFFFFFF)) + (<= signed-fixnum/lower-limit n) (< n signed-fixnum/upper-limit)) (flo:flonum? n))) ;; TYPE and DATUM can be constants or registers; address is a register. @@ -207,10 +207,13 @@ USA. (define (ea:address label) (ea:pc-relative `(- ,label *PC*))) -(define (ea:uuo-entry-address label) - ;; LABEL is the uuo-link-label, but the PC to jump to is AFTER the u16 - ;; frame-size. - (ea:pc-relative `(- (+ ,label 2) *PC*))) +(define ea:uuo-entry-address + (let ((offset + ;; LABEL is the uuo-link-label, but the PC to jump to is two + ;; opcode bytes before the following word (the link address). + (- address-units-per-object 2))) + (named-lambda (ea:uuo-entry-address label) + (ea:pc-relative `(- (+ ,label ,offset) *PC*))))) (define (ea:stack-pop) (ea:post-increment rref:stack-pointer 'WORD)) -- 2.25.1