From 60d0ebeed221365a0dbb023ef940d524b57858a9 Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Wed, 25 Jan 2017 20:37:27 -0500 Subject: [PATCH] Remove unnecessary complexity: cross-sap does almost nothing. --- build-order.lisp-expr | 1 - src/code/cross-misc.lisp | 5 ++++ src/code/cross-sap.lisp | 61 ---------------------------------------------- src/compiler/disassem.lisp | 4 +-- 4 files changed, 7 insertions(+), 64 deletions(-) delete mode 100644 src/code/cross-sap.lisp diff --git a/build-order.lisp-expr b/build-order.lisp-expr index 62298ae2c..c2d01a6ce 100644 --- a/build-order.lisp-expr +++ b/build-order.lisp-expr @@ -86,7 +86,6 @@ ("src/code/cross-char" :not-target) ("src/code/cross-float" :not-target) ("src/code/cross-io" :not-target) - ("src/code/cross-sap" :not-target) ("src/code/cross-thread" :not-target) ("src/code/cross-condition" :not-target) diff --git a/src/code/cross-misc.lisp b/src/code/cross-misc.lisp index ca6d055a8..60d69ce36 100644 --- a/src/code/cross-misc.lisp +++ b/src/code/cross-misc.lisp @@ -203,3 +203,8 @@ ;;; hosts. It doesn't really matter what this function does: we don't ;;; have FDEFN objects on the host anyway. (defun fdefn-p (x) (declare (ignore x)) nil) + +;;; Needed for constant-folding +(defun sb!sys:system-area-pointer-p (x) x nil) ; nothing is a SAP +;;; Needed for DEFINE-MOVE-FUN LOAD-SYSTEM-AREA-POINTER +(defun sb!sys:sap-int (x) (error "can't take SAP-INT ~S" x)) diff --git a/src/code/cross-sap.lisp b/src/code/cross-sap.lisp deleted file mode 100644 index c61332806..000000000 --- a/src/code/cross-sap.lisp +++ /dev/null @@ -1,61 +0,0 @@ -;;;; support and placeholders for System Area Pointers (SAPs) in the host -;;;; Common Lisp at cross-compile time - -;;;; This software is part of the SBCL system. See the README file for -;;;; more information. -;;;; -;;;; This software is derived from the CMU CL system, which was -;;;; written at Carnegie Mellon University and released into the -;;;; public domain. The software is in the public domain and is -;;;; provided with absolutely no warranty. See the COPYING and CREDITS -;;;; files for more information. - -(in-package "SB!SYS") - -;;; SYSTEM-AREA-POINTER is not a primitive type in ANSI Common Lisp, -;;; so we need a compound type to represent it in the host Common Lisp -;;; at cross-compile time: -(defstruct (system-area-pointer (:constructor int-sap (int)) - (:conc-name "SAP-")) - ;; the integer representation of the address - (int nil :type unsigned-byte :read-only t)) - -;;; cross-compilation-host analogues of target-CMU CL primitive SAP operations -#.`(progn - ,@(mapcar (lambda (info) - (destructuring-bind (sap-fun int-fun) info - `(defun ,sap-fun (x y) - (,int-fun (sap-int x) (sap-int y))))) - '((sap< <) (sap<= <=) (sap= =) (sap>= >=) (sap> >) (sap- -)))) - -;;; dummies, defined so that we can declare they never return and -;;; thereby eliminate a thundering herd of optimization notes along -;;; the lines of "can't optimize this expression because we don't know -;;; the return type of SAP-REF-8" -(defun sap-ref-stub (name) - (error "~S doesn't make sense on cross-compilation host." name)) -#.`(progn - ,@(mapcan (lambda (name) - `((declaim (ftype (function (system-area-pointer fixnum) nil) - ,name)) - (defun ,name (sap offset) - (declare (ignore sap offset)) - (sap-ref-stub ',name)) - ,@(let ((setter-stub (gensym "SETTER-STUB-"))) - `((defun ,setter-stub (foo sap offset) - (declare (ignore foo sap offset)) - (sap-ref-stub '(setf ,name))) - (defsetf ,name ,setter-stub))))) - '(sap-ref-8 - sap-ref-16 - sap-ref-32 - sap-ref-64 - sap-ref-sap - sap-ref-word - sap-ref-single - sap-ref-double - signed-sap-ref-8 - signed-sap-ref-16 - signed-sap-ref-32 - signed-sap-ref-64 - signed-sap-ref-word))) diff --git a/src/compiler/disassem.lisp b/src/compiler/disassem.lisp index 0408aa3e8..420005faf 100644 --- a/src/compiler/disassem.lisp +++ b/src/compiler/disassem.lisp @@ -1013,7 +1013,7 @@ (:constructor %make-segment) (:copier nil)) (sap-maker (missing-arg) - :type (function () system-area-pointer)) + :type (function () #-sb-xc-host system-area-pointer)) ;; Length in bytes of the range of memory covered by this segment. (length 0 :type disassem-length) (virtual-location 0 :type address) @@ -1034,7 +1034,7 @@ ;; offset of next position (next-offs 0 :type offset) ;; a sap pointing to our segment - (segment-sap nil :type (or null system-area-pointer)) + (segment-sap nil :type (or null #-sb-xc-host system-area-pointer)) ;; the current segment (segment nil :type (or null segment)) ;; to avoid buffer overrun at segment end, we might need to copy bytes -- 2.11.4.GIT