Variable | Package: compiler | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## align-branch-targets-switch

As with most compiler switch variables, the value of this variable can be `t`, `nil`, or a function object that accepts five arguments and returns `t` or `nil`. The arguments passed to the function will be the values of the safety, space, speed, debug, and compilation-speed optimization qualities, in that order. `nil` is equivalent to a function that always returns `nil` and `t` to a function that always returns `t`. When the value is a function and we say `t` (or true) or `nil` (or false) in the text below, we mean that the function returns, respectively, `t` or `nil`. This switch additionally may return certain integers which are true values (meaning the switch will affect compilation on platforms where it has effect) but provide finer control on that effect.

This switch affects compilation on x86 64-bit systems and Panasonic IPP3 systems only (the IPP3 implementation is not a publically released port). On all other platforms, this switch is ignored.

The issue addressed by this switch is the following. The final stage of the Lisp compiler is the in-core assembler, which works very similarly to any other assembler for the architecture it serves. Code is usually in-line, and when possible, optimization phases before the assembler phase will remove as many branches as possible. But branches are inevitable, and architectures are generally optimized for branches that land on evenly aligned byte boundaries, due to instruction fetch and optimization implementations.

For AMD64 architecture, it is recommended that assembler labels which are the target of branches be placed on 32-byte boundaries, and that no more than 3 branches be placed in any one 16-byte segment of code. There are many intricacies, but we have decided to halve the alignment performed by default, so labels are aligned to 16 bytes and are forced there by a series of nop instructions. This is actually as large as can be done in a 64-bit lisp, since code vectors, along with all other Lisp objects, are aligned to 16-byte boundaries themeselves. The IPP3, which is a 32-bit lisp, aligns to 8 byte boundaries for the same reason.

There are currently three kinds of branches which might be affected by alignment: backward branches, Forward bracnches of more than 16 bytes, and forward branches of less than 16 bytes.

If this switch returns nil, then none of these targets are aligned. If it returns a value of true which is not a fixnum, then all backward and longer-than-16-byte forward branches are aligned.

If this switch is set to a fixnum value, or if it is set to a function of the 5 optimization qualities and returns a fixnum value, then it is interpreted as a bitwise value whose least significant bit (the 1 bit) signifies whether backward-branches should be aligned, the 2 bit signifies whether long forward branches should be aligned, and the 4 bit signifies whether short branches should be aligned. In each of these cases, if the bit is 1, then the alignment is performed, and if it is 0, then the alignment is not performed.

Initially true if speed is 3 and compilation-speed is 0 or 1.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version