Changeset 7245


Ignore:
Timestamp:
Sep 17, 2007, 9:58:47 PM (12 years ago)
Author:
rme
Message:

Straighten out how the immediate word count in IA-32 functions
is created and used by the compiler/assembler/disassembler.

Get rid of some calls to format used for debugging.

Location:
branches/ia32/compiler/X86
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ia32/compiler/X86/x86-asm.lisp

    r7212 r7245  
    42874287
    42884288(defun insert-self (instruction operand)
    4289   (format t "~&insert-self: instruction = ~a operand = ~a"
    4290           instruction operand)
    42914289  (setf (x86-immediate-operand-type operand)
    42924290        (encode-operand-type :self))
  • branches/ia32/compiler/X86/x86-disassemble.lisp

    r7244 r7245  
    27542754          (setq seq (funcall collect-function ds instruction seq)))))))
    27552755
    2756 ;;; A function object in the IA-32 port has a two-byte "immediate word
    2757 ;;; count" between the header and the start of the machine
    2758 ;;; instructions.  This is interpreted as the number of (32 bit) words
    2759 ;;; there are to the GC-able constants.
    2760 ;;;
    2761 ;;; Before the constants, there is a table of self-reference offsets.
    2762 ;;; This table is separated from the code by four zero bytes.  We scan
    2763 ;;; backwards to find this delimiter, which marks the end of the
    2764 ;;; machine instructions.
    2765 (defun nbytes-to-delimiter (imm-word-count code-vector)
    2766   (check-type code-vector (simple-array (unsigned-byte 8) (*)))
    2767   (do ((i (* 4 imm-word-count) (decf i 4)))
    2768       ((and (zerop (aref code-vector (+ i 0)))
    2769             (zerop (aref code-vector (+ i 1)))
    2770             (zerop (aref code-vector (+ i 2)))
    2771             (zerop (aref code-vector (+ i 3)))) i)))
    2772                                    
    27732756(defun x8632-disassemble-xfunction (xfunction &key (symbolic-names
    27742757                                                         x8632::*x8632-symbolic-register-names*) (collect-function #'x86-print-disassembled-instruction))
     
    27832766              :symbolic-names symbolic-names
    27842767              :pending-labels (list 2)))
    2785          (blocks (x86-ds-blocks ds))
    2786          (imm-word-count (x86-ds-next-u16 ds)))
    2787     (setf (x86-ds-code-limit ds)
    2788           (nbytes-to-delimiter imm-word-count (uvref xfunction 0)))
     2768         (blocks (x86-ds-blocks ds)))
     2769    (setf (x86-ds-code-limit ds) (ash (x86-ds-next-u16 ds) 2))
    27892770    (do* ()
    27902771         ((null (x86-ds-pending-labels ds)))
  • branches/ia32/compiler/X86/x86-lap.lisp

    r7218 r7245  
    423423                   designator (x86::reg-entry-reg-name r)))
    424424          (case designator
    425             (:%b (x86::x86-reg8 r))
     425            (:%b (if (x86-byte-reg-p (x86::reg-entry-reg-name r))
     426                   (x86::x86-reg8 r)
     427                   (error "Designator ~a can't be used with register ~a"
     428                          designator (x86::reg-entry-reg-name r))))
    426429            (:%w (x86::x86-reg16 r))
    427430            (:%l (x86::x86-reg32 r))
     
    717720                   ;; special case
    718721                   (when (eq val :self)
    719                      (setq type (x86::encode-operand-type :self))
    720                      (format t "~&self operand: type = ~s" type))
     722                     (setq type (x86::encode-operand-type :self)))
    721723                   (x86::make-x86-immediate-operand :type type
    722724                                             :value expr))))
     
    14941496    ;; count of 32-bit words between header and function boundary
    14951497    ;; marker, inclusive.
    1496     (x86-lap-directive frag-list :short `(ash (+ (:^ ,end-code-tag)
     1498    (x86-lap-directive frag-list :short `(ash (+ (- (:^ ,end-code-tag) 4)
    14971499                                                 *x86-lap-entry-offset*) -2))
    14981500    (emit-x86-lap-label frag-list entry-code-tag)
     
    15541556     #+x86-target       ; just shorthand for defun
    15551557     (%defun (nfunction ,name (lambda (&lap 0) (x86-lap-function ,name ,arglist ,@body))) ,doc)))
     1558
     1559(defmacro defx8632lapfunction (&environment env name arglist &body body
     1560                             &aux doc)
     1561  (if (not (endp body))
     1562      (and (stringp (car body))
     1563           (cdr body)
     1564           (setq doc (car body))
     1565           (setq body (cdr body))))
     1566  `(progn
     1567     (eval-when (:compile-toplevel)
     1568       (note-function-info ',name t ,env))
     1569     (progn
     1570       (eval-when (:load-toplevel)
     1571         (%defun (nfunction ,name (lambda (&lap 0) (x86-lap-function ,name ,arglist ,@body))) ,doc))
     1572       (eval-when (:execute)
     1573         (%define-x8632-lap-function ',name '((let ,arglist ,@body)))))
     1574     ))
  • branches/ia32/compiler/X86/x862.lisp

    r7244 r7245  
    575575                        (end-code-tag (gensym))
    576576                        (srt-tag (gensym))
    577                         (*x86-lap-self-reference-offsets* nil)
    578577                        debug-info)
    579578                   (make-x86-lap-label end-code-tag)
     
    587586                    (:x8632
    588587                     (make-x86-lap-label srt-tag)
    589                      ;; count of 32-bit words between header and
    590                      ;; function boundary marker, inclusive.
    591                      (x86-lap-directive frag-list :short `(ash (+ (:^ ,end-code-tag)
     588                     (x86-lap-directive frag-list :short `(ash (+ (- (:^ ,end-code-tag) 4)
    592589                                                                  *x86-lap-entry-offset*) -2))))
    593590                   (x862-expand-vinsns vinsns frag-list instruction)
Note: See TracChangeset for help on using the changeset viewer.