Changeset 15564


Ignore:
Timestamp:
Jan 6, 2013, 7:27:02 AM (6 years ago)
Author:
gb
Message:

When "eliding pushes" on the vstack, we punt if any vinsn in the
sequence between the push and pop changes or depends on the compiler's
notion of vstack depth.
When generating a function return sequence and optimizing for space,
we try to reuse previously-generated sequences if (a) nvrs need to be
restored and (b) the current vstack depth is = to the vstack depth at
the point where the previously generated sequence was generated. (In
other words, the branch to a previous label depends on the compiler's
notion of vstack depth, and eliding a PUSH would invalidate that.
It's not clear that trying to share POPJ sequences saves space (that
depends on the size of the JMP and the size of the instructions used
to restore NVRs), but if we're going to do this use a new POPJ-VIA-JUMP
vinsn to branch to the earlier sequence; the vinsn attributes of that
vinsn are equivalent to those of POPJ and this should scare the push-elision
code out of eliding anything.

(That's likely not the best solution, but this fixes ticket:1046 in the
trunk.)

The most likely symptom of getting this wrong is that NVRs may not be
restored correctly. We don't have NVRs on x8632 or ARM, but we should
probably recognize the fact that "push elision" and "popj folding" can
have this kind of unexpected interaction.

Location:
trunk/source/compiler/X86
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/X86/X8632/x8632-vinsns.lisp

    r15519 r15564  
    496496  (leave)
    497497  (ret))
     498
     499(define-x8632-vinsn (popj-via-jump :lispcontext :pop :vsp :lrRestore :jumpLR)
     500    (()
     501     ((lab :label)))
     502  (jmp lab))
    498503
    499504(define-x8632-vinsn (restore-full-lisp-context :lispcontext :pop :vsp )
  • trunk/source/compiler/X86/X8664/x8664-vinsns.lisp

    r15519 r15564  
    598598  (leave)
    599599  (ret))
     600
     601(define-x8664-vinsn (popj-via-jump :lispcontext :pop :vsp :lrRestore :jumpLR)
     602    (()
     603     ((lab :label)))
     604  (jmp lab))
    600605
    601606(define-x8664-vinsn (restore-full-lisp-context :lispcontext :pop :vsp )
  • trunk/source/compiler/X86/x862.lisp

    r15542 r15564  
    57585758        (if *x862-returning-values*
    57595759          (cond ((and mask foldp (setq label (%cdr (assq vstack *x862-valret-labels*))))
    5760                  (-> label))
     5760                 (! popj-via-jump (aref *backend-labels* label)))
    57615761                (t
    57625762                 (@ (setq label (backend-get-next-label)))
     
    57675767            (! popj)
    57685768            (if (and foldp (setq label (assq *x862-vstack* *x862-popreg-labels*)))
    5769               (-> (cdr label))
     5769              (! popj-via-jump (aref *backend-labels* (cdr label)))
    57705770              (let* ((new-label (backend-get-next-label)))
    57715771                (@ new-label)
Note: See TracChangeset for help on using the changeset viewer.