From cmucl-devel at common-lisp.net Sat Jul 14 21:25:08 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Sat, 14 Jul 2012 21:25:08 -0000 Subject: [cmucl-ticket] [cmucl] #61: Darwin+clang doesn't produce a working lisp Message-ID: <052.3fc25f639f63a752829c9ad54f227e0c@common-lisp.net> #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: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Wed Jul 18 03:13:47 2012 From: cmucl-devel at common-lisp.net (cmucl) Date: Wed, 18 Jul 2012 03:13:47 -0000 Subject: [cmucl-ticket] [cmucl] #61: Darwin+clang doesn't produce a working lisp In-Reply-To: <052.3fc25f639f63a752829c9ad54f227e0c@common-lisp.net> References: <052.3fc25f639f63a752829c9ad54f227e0c@common-lisp.net> Message-ID: <061.872b678f637e011b7c7c9adeb7a6b908@common-lisp.net> #61: Darwin+clang doesn't produce a working lisp ---------------------+------------------------------------------------------ Reporter: rtoy | Owner: somebody Type: defect | Status: closed Priority: major | Milestone: Component: Core | Version: 2012-07 Resolution: fixed | Keywords: ---------------------+------------------------------------------------------ Changes (by toy.raymond@?): * status: new => closed * resolution: => fixed Comment: commit 40b532c59cd9ff6d48588ed8c36880a625009142 Author: Raymond Toy Date: Tue Jul 17 20:11:13 2012 -0700 Fix ticket:61, using option 2. src/lisp/gencgc.c: o Save and restore the FPU state in alloc(). src/compiler/x86/alloc.lisp src/compiler/x86/array.lisp src/compiler/x86/call.lisp src/compiler/x86/float-sse2.lisp src/compiler/x86/float.lisp src/compiler/x86/move.lisp src/compiler/x86/sap.lisp: o Don't need to use :save-p anymore because the allocation routine saves an live registers anyway. This improves code generation as well. src/general-info/release-20d.txt: o Update. -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation.