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.
15 ;;; FIXUP -- A fixup of some kind.
17 (:constructor make-fixup (name flavor &optional offset)))
18 ;; The name and flavor of the fixup. The assembler makes no assumptions
19 ;; about the contents of these fields; their semantics are imposed by the
23 ;; OFFSET is an optional offset from whatever external label this fixup
24 ;; refers to. Or in the case of the :CODE-OBJECT flavor of fixups on the :X86
25 ;; architecture, NAME is always NIL, so this fixup doesn't refer to an
26 ;; external label, and OFFSET is an offset from the beginning of the
27 ;; current code block.
30 ;;; were done with another flavor
32 (def!method print-object ((fixup fixup) stream)
33 (print-unreadable-object (fixup stream :type t)
35 ":FLAVOR ~S :NAME ~S :OFFSET ~S"
38 (fixup-offset fixup))))
40 ;;; KLUDGE: Despite its name, this is not a list of FIXUP objects, but rather a
41 ;;; list of `(,KIND ,FIXUP ,POSN). Perhaps this non-mnemonicity could be
42 ;;; reduced by naming what's currently a FIXUP structure a FIXUP-REQUEST, and
43 ;;; then renaming *FIXUPS* to *NOTED-FIXUPS*.-- WHN 19990905
46 ;;; Setting this variable lets you see what's going on as items are
47 ;;; being pushed onto *FIXUPS*.
48 #!+sb-show (defvar *show-fixups-being-pushed-p* nil)
50 ;;; This function is called by assembler instruction emitters when
51 ;;; they find themselves trying to deal with a fixup.
52 (defun note-fixup (segment kind fixup)
53 (sb!assem:emit-back-patch segment
55 (lambda (segment posn)
56 (declare (ignore segment))
57 ;; Why use EMIT-BACK-PATCH to cause this PUSH to
58 ;; be done later, instead of just doing it now?
59 ;; I'm not sure. Perhaps there's some concern
60 ;; that POSN isn't known accurately now? Perhaps
61 ;; there's a desire for all fixing up to go
62 ;; through EMIT-BACK-PATCH whether it needs to or
63 ;; not? -- WHN 19990905
64 (push (list kind fixup posn) *fixups*)))