- (when (and (eq (block-info 1block) block)
- (block-start 1block))
- (sb!assem:assemble (*code-segment*)
- (sb!assem:emit-label (block-label 1block)))
- (let ((env (block-physenv 1block)))
- (unless (eq env prev-env)
- (let ((lab (gen-label)))
- (setf (ir2-physenv-elsewhere-start (physenv-info env))
- lab)
- (emit-label-elsewhere lab))
- (setq prev-env env)))))
+ (when (and (eq (block-info 1block) block)
+ (block-start 1block))
+ (sb!assem:assemble (*code-segment*)
+ ;; Align first emitted block of each loop: x86 and x86-64 both
+ ;; like 16 byte alignment, however, since x86 aligns code objects
+ ;; on 8 byte boundaries we cannot guarantee proper loop alignment
+ ;; there (yet.) Only x86-64 does something with ALIGNP, but
+ ;; it may be useful in the future.
+ (let ((alignp (let ((cloop (block-loop 1block)))
+ (when (and cloop
+ (loop-tail cloop)
+ (not (loop-info cloop)))
+ ;; Mark the loop as aligned by saving the IR1 block aligned.
+ (setf (loop-info cloop) 1block)
+ t))))
+ (emit-block-header (block-label 1block)
+ (ir2-block-%trampoline-label block)
+ (ir2-block-dropped-thru-to block)
+ alignp)))
+ (let ((env (block-physenv 1block)))
+ (unless (eq env prev-env)
+ (let ((lab (gen-label)))
+ (setf (ir2-physenv-elsewhere-start (physenv-info env))
+ lab)
+ (emit-label-elsewhere lab))
+ (setq prev-env env)))))