Changeset 6478
- Timestamp:
- May 9, 2007, 12:42:03 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-0/X86/x86-def.lisp (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-0/X86/x86-def.lisp
r4955 r6478 92 92 (jmp-subprim .SPvalues)) 93 93 94 95 94 96 95 … … 156 155 157 156 (defx86lapfunction %fixnum-ref ((fixnum arg_y) #| &optional |# (offset arg_z)) 157 (:arglist (fixnum &optional offset)) 158 158 (check-nargs 1 2) 159 159 (cmpw ($ x8664::fixnumone) (% nargs)) … … 167 167 168 168 (defx86lapfunction %fixnum-ref-natural ((fixnum arg_y) #| &optional |# (offset arg_z)) 169 (:arglist (fixnum &optional offset)) 169 170 (check-nargs 1 2) 170 171 (cmpw ($ x8664::fixnumone) (% nargs)) … … 178 179 179 180 (defx86lapfunction %fixnum-set ((fixnum arg_x) (offset arg_y) #| &optional |# (new-value arg_z)) 181 (:arglist (fixnum offset &optional newval)) 180 182 (check-nargs 2 3) 181 183 (cmpw ($ '2) (% nargs)) … … 190 192 191 193 192 193 194 (defx86lapfunction %fixnum-set-natural ((fixnum arg_x) (offset arg_y) #| &optional |# (new-value arg_z)) 195 (:arglist (fixnum offset &optional newval)) 194 196 (check-nargs 2 3) 195 197 (save-simple-frame) … … 223 225 (single-value-return)) 224 226 225 227 ;;; Look for "lea -nnnn(%rip),%fn" AT the tra; if that's present, use 228 ;;; the dispacement -nnnn to find the function. The end of the 229 ;;; encoded displacement is 230 ;;; x8664::recover-fn-from-rip-disp-offset (= 7) bytes from the tra. 226 231 (defx86lapfunction %return-address-function ((r arg_z)) 227 232 (extract-lisptag r imm0) 228 233 (cmpb ($ x8664::tag-tra) (% imm0.b)) 229 234 (jne @fail) 230 (movl (@ -4 (% r)) (% imm0.l)) 231 (testl (% imm0.l) (% imm0.l)) 232 (jle @fail) 233 (subq (% imm0) (% arg_z)) 235 (cmpw ($ x8664::recover-fn-from-rip-word0) (@ (% r))) 236 (jne @fail) 237 (cmpb ($ x8664::recover-fn-from-rip-byte2) (@ 2 (% r))) 238 (movslq (@ x8664::recover-fn-from-rip-disp-offset (% r)) (% imm0)) 239 (jne @fail) 240 (lea (@ x8664::recover-fn-from-rip-length (% imm0) (% r)) (% arg_z)) 234 241 (single-value-return) 235 242 @fail … … 241 248 (cmpb ($ x8664::tag-tra) (% imm0.b)) 242 249 (jne @fail) 243 (movl (@ -4 (% r)) (% imm0.l)) 244 (testl (% imm0.l) (% imm0.l)) 245 (jle @fail) 246 (box-fixnum imm0 arg_z) 250 (cmpw ($ x8664::recover-fn-from-rip-word0) (@ (% r))) 251 (jne @fail) 252 (cmpb ($ x8664::recover-fn-from-rip-byte2) (@ 2 (% r))) 253 (movslq (@ x8664::recover-fn-from-rip-disp-offset (% r)) (% imm0)) 254 (jne @fail) 255 (negq (% imm0)) 256 (leaq (@ (ash x8664::recover-fn-from-rip-length x8664::fixnumshift) (% imm0) 8) (% arg_z)) 247 257 (single-value-return) 248 258 @fail … … 252 262 ;;; It's always been the case that the function associated with a 253 263 ;;; frame pointer is the caller of the function that "uses" that frame. 254 (defx86lapfunction %cfp-lfun ((p arg_z)) 255 (ref-global ret1valaddr imm0) 256 (movq (@ x8664::lisp-frame.return-address (% p)) (% arg_y)) 257 (cmpq (% imm0) (% arg_y)) 258 (cmoveq (@ x8664::lisp-frame.xtra (% p)) (% arg_y)) 259 (extract-lisptag arg_y imm0) 260 (cmpb ($ x8664::tag-tra) (%b imm0)) 261 (jne @no) 262 (movl (@ -4 (% arg_y)) (%l imm0)) 263 (testl (% imm0.l) (% imm0.l)) 264 (je @no) 265 (subq (% imm0) (% arg_y)) 266 (box-fixnum imm0 arg_z) 267 (movq (% rsp) (% temp0)) 268 (pushq (% arg_y)) 269 (pushq (% arg_z)) 270 (set-nargs 2) 271 (jmp-subprim .SPvalues) 272 @no 273 (movq (% rsp) (% temp0)) 274 (pushq ($ x8664::nil-value)) 275 (pushq ($ x8664::nil-value)) 276 (set-nargs 2) 277 (jmp-subprim .SPvalues)) 264 (defun %cfp-lfun (p) 265 (let* ((ra (%fixnum-ref p x8664::lisp-frame.return-address))) 266 (if (eq ra (%get-kernel-global ret1valaddr)) 267 (setq ra (%fixnum-ref p x8664::lisp-frame.xtra))) 268 (values (%return-address-function ra) (%return-address-offset ra)))) 278 269 279 270 … … 350 341 ;; but preserves x866::xfn/x8664::next-method-context. 351 342 ;; Jump to the function in x8664::xfn. 343 (popq (% ra0)) 352 344 (movq (% magic) (% next-method-context)) 353 345 (movq (% function) (% xfn)) … … 381 373 (jmp @three) 382 374 @go 383 ( xchgq (% xfn) (% fn))384 (jmp (% fn)))375 (push (% ra0)) 376 (jmp (% xfn))) 385 377 386 378 (defx86lapfunction %apply-with-method-context ((magic arg_x) … … 393 385 ;; but preserves x8664::xfn/x8664::next-method-context. 394 386 ;; Jump to the function in x8664::xfn. 395 ;; We need to inline the "spreadargz" operation, 'cause there's no 396 ;; good place to keep %ra0. 387 (pop (% ra0)) 397 388 (movq (% magic) (% x8664::next-method-context)) 398 389 (movq (% function) (% x8664::xfn)) … … 431 422 (je @discard-and-go) 432 423 @go 433 ( xchgq (% xfn) (% fn))434 (jmp (% fn))424 (push (% ra0)) 425 (jmp (% xfn)) 435 426 @bad 436 427 (addq (% imm0) (% rsp)) … … 447 438 ;;; entry must be in %rbp. 448 439 (defx86lapfunction %apply-lexpr-tail-wise ((method arg_y) (args arg_z)) 440 (addq ($ x8664::node-size) (% rsp)) ; discard extra return address 449 441 (movq (% method) (% xfn)) 450 442 (movq (% args) (% rsp)) … … 478 470 (discard-reserved-frame) 479 471 @popped 480 ( xchgq (% xfn) (% fn))481 (jmp (% fn)))472 (push (% ra0)) 473 (jmp (% xfn))) 482 474 483 475 … … 495 487 (defun apply+ (&lap function arg1 arg2 &rest other-args) 496 488 (x86-lap-function apply+ () 489 (:arglist (function arg1 arg2 &rest other-args)) 497 490 (check-nargs 3 nil) 498 491 (cmpw ($ '3) (% nargs)) 492 (pop (% ra0)) 499 493 (ja @no-frame) 500 494 (pushq ($ x8664::reserved-frame-marker)) … … 533 527 @no-discard 534 528 (load-constant funcall temp0) 529 (push (% ra0)) 535 530 (jmp-subprim .SPfuncall) 536 531 @bad ; error spreading list. … … 541 536 (jmp-subprim .SPksignalerr) )) 542 537 543 (lfun-bits #'apply+ (logior $lfbits-rest-bit 544 (dpb 3 $lfbits-numreq 0))) 538 545 539 546 540 ;;; This needs to: … … 551 545 ;;; (%rax/%xmm0) there 552 546 (defx86lapfunction %do-ff-call ((nfp 0) (frame arg_x) (fp-regs arg_y) (entry arg_z)) 547 (popq (% ra0)) 553 548 (popq (% rax)) 554 (movq (% rbp) (@ @(% rsp)))549 (movq (% rbp) (@ (% rsp))) 555 550 (movq (% rsp) (% rbp)) 556 551 (movq (% ra0) (@ 8 (% rbp)))
Note:
See TracChangeset
for help on using the changeset viewer.
