Eliminated frame-pointer adjustment around calls if the adjustment

is 0.  Previously, you'd get 
    addl 0, fpr
    <stuff>
    subl 0, fpr
which are useless.
This commit is contained in:
Abdulaziz Ghuloum 2008-01-10 03:26:18 -05:00
parent 9e06ec35bf
commit 7a2ac14f5a
3 changed files with 28 additions and 16 deletions

View File

@ -2367,14 +2367,20 @@
(when (< padding 0) (when (< padding 0)
(error 'compile-call-frame "call sequence too long" call-sequence)) (error 'compile-call-frame "call sequence too long" call-sequence))
(list 'seq (list 'seq
(if (or (= framesize 0) (= framesize 1))
'(seq)
`(subl ,(* (fxsub1 framesize) wordsize) ,fpr))
(jmp L_CALL) (jmp L_CALL)
`(byte-vector ,livemask-vec) `(byte-vector ,livemask-vec)
`(int ,framesize) `(int ,(* framesize wordsize))
'(current-frame-offset) '(current-frame-offset)
multiarg-rp multiarg-rp
`(byte-vector ,(make-vector padding 0)) `(byte-vector ,(make-vector padding 0))
L_CALL L_CALL
call-sequence))) call-sequence
(if (or (= framesize 0) (= framesize 1))
'(seq)
`(addl ,(* (fxsub1 framesize) wordsize) ,fpr)))))
@ -2479,33 +2485,33 @@
(label-address (sl-mv-ignore-rp-label)))) (label-address (sl-mv-ignore-rp-label))))
(cond (cond
[(string? target) ;; foreign call [(string? target) ;; foreign call
(cons* `(subl ,(* (fxsub1 size) wordsize) ,fpr) (cons* ;`(subl ,(* (fxsub1 size) wordsize) ,fpr)
`(movl (foreign-label "ik_foreign_call") %ebx) `(movl (foreign-label "ik_foreign_call") %ebx)
(compile-call-frame (compile-call-frame
(* size wordsize) size
mask mask
(rp-label value) (rp-label value)
`(call %ebx)) `(call %ebx))
`(addl ,(* (fxsub1 size) wordsize) ,fpr) ;`(addl ,(* (fxsub1 size) wordsize) ,fpr)
ac)] ac)]
[target ;;; known call [target ;;; known call
(cons* `(subl ,(* (fxsub1 size) wordsize) ,fpr) (cons* ;`(subl ,(* (fxsub1 size) wordsize) ,fpr)
(compile-call-frame (compile-call-frame
(* size wordsize) size
mask mask
(rp-label value) (rp-label value)
`(call (label ,target))) `(call (label ,target)))
`(addl ,(* (fxsub1 size) wordsize) ,fpr) ;`(addl ,(* (fxsub1 size) wordsize) ,fpr)
ac)] ac)]
[else [else
(cons* `(subl ,(* (fxsub1 size) wordsize) ,fpr) (cons* ;`(subl ,(* (fxsub1 size) wordsize) ,fpr)
(compile-call-frame (compile-call-frame
(* size wordsize) size
mask mask
(rp-label value) (rp-label value)
`(call (disp ,(fx- disp-closure-code closure-tag) `(call (disp ,(fx- disp-closure-code closure-tag)
,cp-register))) ,cp-register)))
`(addl ,(* (fxsub1 size) wordsize) ,fpr) ;`(addl ,(* (fxsub1 size) wordsize) ,fpr)
ac)]))] ac)]))]
[(asm-instr op d s) [(asm-instr op d s)
(case op (case op

View File

@ -2409,14 +2409,14 @@
(cmpl (int closure-tag) ebx) (cmpl (int closure-tag) ebx)
(jne (label (sl-nonprocedure-error-label))) (jne (label (sl-nonprocedure-error-label)))
(movl (int (argc-convention 0)) eax) (movl (int (argc-convention 0)) eax)
(subl (int (fx* wordsize 2)) fpr) ;(subl (int (fx* wordsize 2)) fpr)
(compile-call-frame (compile-call-frame
(* wordsize 3) 3
'#(#b110) '#(#b110)
(label-address L_cwv_multi_rp) (label-address L_cwv_multi_rp)
(indirect-cpr-call)) (indirect-cpr-call))
;;; one value returned ;;; one value returned
(addl (int (fx* wordsize 2)) fpr) ;(addl (int (fx* wordsize 2)) fpr)
(movl (mem (fx* -2 wordsize) fpr) ebx) ; consumer (movl (mem (fx* -2 wordsize) fpr) ebx) ; consumer
(movl ebx cpr) (movl ebx cpr)
(movl eax (mem (fx- 0 wordsize) fpr)) (movl eax (mem (fx- 0 wordsize) fpr))
@ -2529,6 +2529,12 @@
(tail-indirect-cpr-call)))) (tail-indirect-cpr-call))))
SL_fx+_overflow])) SL_fx+_overflow]))
(define (print-instr x)
(cond
[(and (pair? x) (eq? (car x) 'seq))
(for-each print-instr (cdr x))]
[else
(printf " ~s\n" x)]))
(define (compile-core-expr->code p) (define (compile-core-expr->code p)
(let* ([p (recordize p)] (let* ([p (recordize p)]
@ -2548,7 +2554,7 @@
(for-each (for-each
(lambda (ls) (lambda (ls)
(newline) (newline)
(for-each (lambda (x) (printf " ~s\n" x)) ls)) (for-each print-instr ls))
ls*))) ls*)))
(let ([code* (let ([code*
(assemble-sources (assemble-sources

View File

@ -1 +1 @@
1336 1337