Changeset 7962

Dec 28, 2007, 12:31:01 AM (12 years ago)

Add save[0-3] fields to the TCR. These are a caller-saved spill area
for node registers. A function should clear out these fields when its
done with them so that they don't make the GC hang on to stuff that's
otherwise garbage.

As the comment says, the save0 word must be aligned on an 16 byte boundary.
This is so we can use (movapd (% fpzero) (@ (% :rcontext) tcr.save0)) to
clear the entire area quickly.

One possible wrinkle: although malloc/calloc will return suitably
aligned tcr structs, on systems with TLS, a mechanism like
attribute ((aligned (16))) or something might be needed. (Or we
could just use movupd.)

Define next-method-context and a couple of storage layouts. Define
constants used when looking for (movl ($ imm32) (% fn)) at tagged
return addresses.

1 edited


  • branches/ia32/compiler/X86/X8632/x8632-arch.lisp

    r7878 r7962  
    170170(defx86reg xfn temp1)
     172(defx86reg next-method-context temp0)
    172174;;; This follows the ppc32 scheme pretty closely.
    489491(define-fixedsized-object value-cell
    490492  value)
     494(define-storage-layout lisp-frame 0
     495  backptr
     496  return-address
     497  xtra)
     499(define-storage-layout xcf 0            ;"exception callback frame"
     500  backptr
     501  return-address                        ; always 0
     502  nominal-function
     503  relative-pc
     504  containing-object
     505  xp
     506  ra0
     507  )
    492509;;; The kernel uses these (rather generically named) structures
    534551  node-regs-mask                        ; bit set means corresponding reg contains node
    535552  linear
     553  ;; save0 *must* be aligned on a 16-byte boundary!
     554  save0                                 ;spill area for node registers
     555  save1                                 ; (caller saved)
     556  save2                                 ; probably saved/restored in
     557  save3                                 ; callout/trap handlers
    536558  save-ebp                              ; lisp frame ptr for foreign code
    537559  lisp-mxcsr
    11481170      ,@body)))
     1172;;; When found at a tagged return address, the instruction
     1173;;; (movl ($ imm32) (% fn))
     1174;;; lets the runtime easily map a return address to the containing
     1175;;; function.
     1177;;; The notation ($ :self) is used in the assembler to mean "a 32-bit
     1178;;; immediate whose offset will be remembered in a table at the end of
     1179;;; the function object."
     1181;;; Before the function is made executable (or when the GC moves the
     1182;;; function), these :self immediates are filled in with the actual
     1183;;; address of the function.
     1185(defconstant recover-fn-opcode-byte #b10111111) ;when %fn is %edi
     1186(defconstant recover-fn-address-offset 1)
    11501188(provide "X8632-ARCH")
Note: See TracChangeset for help on using the changeset viewer.