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)
(error 'compile-call-frame "call sequence too long" call-sequence))
(list 'seq
(if (or (= framesize 0) (= framesize 1))
'(seq)
`(subl ,(* (fxsub1 framesize) wordsize) ,fpr))
(jmp L_CALL)
`(byte-vector ,livemask-vec)
`(int ,framesize)
`(int ,(* framesize wordsize))
'(current-frame-offset)
multiarg-rp
`(byte-vector ,(make-vector padding 0))
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))))
(cond
[(string? target) ;; foreign call
(cons* `(subl ,(* (fxsub1 size) wordsize) ,fpr)
(cons* ;`(subl ,(* (fxsub1 size) wordsize) ,fpr)
`(movl (foreign-label "ik_foreign_call") %ebx)
(compile-call-frame
(* size wordsize)
size
mask
(rp-label value)
`(call %ebx))
`(addl ,(* (fxsub1 size) wordsize) ,fpr)
;`(addl ,(* (fxsub1 size) wordsize) ,fpr)
ac)]
[target ;;; known call
(cons* `(subl ,(* (fxsub1 size) wordsize) ,fpr)
(cons* ;`(subl ,(* (fxsub1 size) wordsize) ,fpr)
(compile-call-frame
(* size wordsize)
size
mask
(rp-label value)
`(call (label ,target)))
`(addl ,(* (fxsub1 size) wordsize) ,fpr)
;`(addl ,(* (fxsub1 size) wordsize) ,fpr)
ac)]
[else
(cons* `(subl ,(* (fxsub1 size) wordsize) ,fpr)
(cons* ;`(subl ,(* (fxsub1 size) wordsize) ,fpr)
(compile-call-frame
(* size wordsize)
size
mask
(rp-label value)
`(call (disp ,(fx- disp-closure-code closure-tag)
,cp-register)))
`(addl ,(* (fxsub1 size) wordsize) ,fpr)
;`(addl ,(* (fxsub1 size) wordsize) ,fpr)
ac)]))]
[(asm-instr op d s)
(case op

View File

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

View File

@ -1 +1 @@
1336
1337