1 ;;;; fixups, extracted from codegen.lisp by WHN 19990227 in order
2 ;;;; to help with cross-compiling bootstrapping
4 ;;;; This software is part of the SBCL system. See the README file for
7 ;;;; This software is derived from the CMU CL system, which was
8 ;;;; written at Carnegie Mellon University and released into the
9 ;;;; public domain. The software is in the public domain and is
10 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
11 ;;;; files for more information.
18 ;;; FIXUP -- A fixup of some kind.
20 (:constructor make-fixup (name flavor &optional offset)))
21 ;; The name and flavor of the fixup. The assembler makes no assumptions
22 ;; about the contents of these fields; their semantics are imposed by the
26 ;; OFFSET is an optional offset from whatever external label this fixup
27 ;; refers to. Or in the case of the :CODE-OBJECT flavor of fixups on the :X86
28 ;; architecture, NAME is always NIL, so this fixup doesn't refer to an
29 ;; external label, and OFFSET is an offset from the beginning of the
30 ;; current code block.
33 ;;; were done with another flavor
35 (def!method print-object ((fixup fixup) stream)
36 (print-unreadable-object (fixup stream :type t)
38 ":FLAVOR ~S :NAME ~S :OFFSET ~S"
41 (fixup-offset fixup))))
43 ;;; KLUDGE: Despite its name, this is not a list of FIXUP objects, but rather a
44 ;;; list of `(,KIND ,FIXUP ,POSN). Perhaps this non-mnemonicity could be
45 ;;; reduced by naming what's currently a FIXUP structure a FIXUP-REQUEST, and
46 ;;; then renaming *FIXUPS* to *NOTED-FIXUPS*.-- WHN 19990905
49 ;;; Setting this variable lets you see what's going on as items are
50 ;;; being pushed onto *FIXUPS*.
51 #!+sb-show (defvar *show-fixups-being-pushed-p* nil)
53 ;;; This function is called by assembler instruction emitters when
54 ;;; they find themselves trying to deal with a fixup.
55 (defun note-fixup (segment kind fixup)
56 (sb!assem:emit-back-patch segment
58 (lambda (segment posn)
59 (declare (ignore segment))
60 ;; Why use EMIT-BACK-PATCH to cause this PUSH to
61 ;; be done later, instead of just doing it now?
62 ;; I'm not sure. Perhaps there's some concern
63 ;; that POSN isn't known accurately now? Perhaps
64 ;; there's a desire for all fixing up to go
65 ;; through EMIT-BACK-PATCH whether it needs to or
66 ;; not? -- WHN 19990905
67 (push (list kind fixup posn) *fixups*)))