Methods and Systems for automatically reordering variables as a part of
compiling and linking source code. In one embodiment, a compiler
identifies a set of variables that are candidates for reordering. The
candidate variables are associated with one or more source code files
that are being compiled. The compiler collects data used for determining
a potential layout of the candidate variables. The linker determines the
potential layout based, at least in part, on the data and reorders the
candidate variables based, at least in part, on the potential layout.