[cmucl-ticket] [cmucl] #61: Darwin+clang doesn't produce a working lisp

cmucl cmucl-devel at common-lisp.net
Sat Jul 14 21:25:08 UTC 2012


#61: Darwin+clang doesn't produce a working lisp
--------------------+-------------------------------------------------------
 Reporter:  rtoy    |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  major   |   Milestone:          
Component:  Core    |     Version:  2012-07 
 Keywords:          |  
--------------------+-------------------------------------------------------
 Compiling the C runtime on Darwin with clang does not produce a working
 lisp.  The cause is that clang uses xmm registers in gencgc.c, but the
 allocator calls {{{alloc()}}} directly without saving any live xmm
 registers which eventually get trashed.  For example the vop

 {{{
 (define-vop (move-from-single)
   (:args (x :scs (single-reg) :to :save))
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"float to pointer coercion")
   (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:single-float-type vm:single-float-size
 node)
        (inst movss (ea-for-sf-desc y) x))))

 }}}

 will save any live float registers, but not the arg {{{x}}}.  If the
 allocator calls {{{alloc()}}}, {{{x}}} could be destroyed.

 Possible solutions:

  1. Save and restore float args to the stack in every float vop that does
 allocation.
  1. Make {{{alloc()}}} save all the float registers.

 The first solution is nice because only the registers that need to be
 saved are saved.  But it's not nice because every vop will save/restore
 when most of the time {{{alloc()}}} will not be called.

 The second solution is nice because it's always safe, even if some vop
 forgot to save a register.  But it's not nice because all float registers
 are saved when only one (or a very small number) needs to be saved.  But
 it looks like {{{alloc()}}} is relatively expensive so perhaps the cost of
 saving all registers is in the noise.  (Should measure this.)

-- 
Ticket URL: <http://trac.common-lisp.net/cmucl/ticket/61>
cmucl <http://common-lisp.net/project/cmucl>
Cmucl is a high-performance, free Common Lisp implementation.


More information about the cmucl-ticket mailing list