X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fassembly%2Fx86-64%2Farith.lisp;h=fc05cbe1fa9adb84842066bddb3e32c16234d129;hb=4fa1c71c7dfa5c6d361304321cc67069a6410694;hp=d47b7206d698b1db3137e683a6bea40b9c022eff;hpb=d95f1e6476aa63695e018a7769a1ae9e002fca36;p=sbcl.git diff --git a/src/assembly/x86-64/arith.lisp b/src/assembly/x86-64/arith.lisp index d47b720..fc05cbe 100644 --- a/src/assembly/x86-64/arith.lisp +++ b/src/assembly/x86-64/arith.lisp @@ -36,17 +36,16 @@ (inst jmp :nz DO-STATIC-FUN) ; no - do generic ,@body - (inst clc) + (inst clc) ; single-value return (inst ret) DO-STATIC-FUN - (inst pop rax) + ;; Same as: (inst enter (fixnumize 1)) (inst push rbp-tn) - (inst lea - rbp-tn - (make-ea :qword :base rsp-tn :disp n-word-bytes)) - (inst sub rsp-tn (fixnumize 2)) - (inst push rax) ; callers return addr + (inst mov rbp-tn rsp-tn) + (inst sub rsp-tn (fixnumize 1)) + (inst push (make-ea :qword :base rbp-tn + :disp (frame-byte-offset return-pc-save-offset))) (inst mov rcx (fixnumize 2)) ; arg count (inst jmp (make-ea :qword @@ -127,11 +126,11 @@ (inst test x fixnum-tag-mask) (inst jmp :z FIXNUM) - (inst pop rax) (inst push rbp-tn) - (inst lea rbp-tn (make-ea :qword :base rsp-tn :disp n-word-bytes)) - (inst sub rsp-tn (fixnumize 2)) - (inst push rax) + (inst mov rbp-tn rsp-tn) + (inst sub rsp-tn (fixnumize 1)) + (inst push (make-ea :qword :base rbp-tn + :disp (frame-byte-offset return-pc-save-offset))) (inst mov rcx (fixnumize 1)) ; arg count (inst jmp (make-ea :qword :disp (+ nil-value (static-fun-offset '%negate)))) @@ -163,19 +162,24 @@ (inst mov rcx x) (inst or rcx y) (inst test rcx fixnum-tag-mask) - (inst jmp :nz DO-STATIC-FUN) + (inst jmp :nz DO-STATIC-FUN) ; are both fixnums? (inst cmp x y) (inst ret) DO-STATIC-FUN - (move rcx rsp-tn) (inst sub rsp-tn (fixnumize 3)) - (inst mov (make-ea :qword - :base rcx - :disp (fixnumize -1)) + (inst mov (make-ea :qword :base rsp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset))) rbp-tn) - (move rbp-tn rcx) + (inst lea rbp-tn (make-ea :qword :base rsp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset)))) (inst mov rcx (fixnumize 2)) (inst call (make-ea :qword :disp (+ nil-value @@ -234,13 +238,18 @@ (inst ret) DO-STATIC-FUN - (move rcx rsp-tn) (inst sub rsp-tn (fixnumize 3)) - (inst mov (make-ea :qword - :base rcx - :disp (fixnumize -1)) + (inst mov (make-ea :qword :base rsp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset))) rbp-tn) - (move rbp-tn rcx) + (inst lea rbp-tn (make-ea :qword :base rsp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset)))) (inst mov rcx (fixnumize 2)) (inst call (make-ea :qword :disp (+ nil-value (static-fun-offset 'eql)))) @@ -291,13 +300,19 @@ (inst ret) DO-STATIC-FUN - (move rcx rsp-tn) (inst sub rsp-tn (fixnumize 3)) - (inst mov (make-ea :qword - :base rcx - :disp (fixnumize -1)) + (inst mov (make-ea :qword :base rsp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset))) rbp-tn) - (move rbp-tn rcx) + (inst lea rbp-tn (make-ea :qword :base rsp-tn + :disp (frame-byte-offset + (+ sp->fp-offset + -3 + ocfp-save-offset)))) + (inst mov rcx (fixnumize 2)) (inst call (make-ea :qword :disp (+ nil-value (static-fun-offset 'two-arg-=))))