Opened 12 years ago
Closed 12 years ago
#61 closed defect (fixed)
Darwin+clang doesn't produce a working lisp
Reported by: | Raymond Toy | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Core | Version: | 2012-07 |
Keywords: | Cc: |
Description
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:
- Save and restore float args to the stack in every float vop that does allocation.
- 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.)
commit 40b532c59cd9ff6d48588ed8c36880a625009142 Author: Raymond Toy <toy.raymond@…> Date: Tue Jul 17 20:11:13 2012 -0700