Solaris 64-bit Developer's Guide

Code Models

Different code models are available from the compiler for different purposes to improve performance and reduce code size in 64-bit SPARC programs. The code model is determined by the following factors:

The following table describes the different code models available for 64-bit SPARC programs.

Table 6-1 Code Model Descriptions

Code Model 

Positionability 

Code Size 

Location 

External Object Reference Model 

abs32

Absolute 

< 2 gigabytes 

Low (low 32 bits of address space) 

None 

abs44

Absolute 

< 2 gigabytes 

Middle (low 44 bits of address space) 

None 

abs64

Absolute 

< 2 gigabytes 

Anywhere 

None 

pic

PIC 

< 2 gigabytes 

Anywhere 

Small (<= 1024 external objects) 

PIC

PIC 

< 2 gigabytes 

Anywhere 

Large (<= 2**29 external objects) 

Shorter instruction sequences can be achieved in some instances with the smaller code models. The number of instructions needed to do static data references in absolute code is the fewest for the abs32 code model and the most for the abs64 code model, while abs44 is in the middle. Likewise, the pic code model uses fewer instructions for static data references than the PIC code model. Consequently, the smaller code models can reduce the code size and perhaps improve the performance of programs that do not need the fuller functionality of the larger code models.

To specify which code model to use, the -xcode=<model> compiler option should be used. Currently, for 64-bit objects, the compiler uses the abs64 model by default. You can optimize your code by using the abs44 code model; you will use fewer instructions and still cover the 44-bit address space that the current UltraSPARC platforms support.

See the SPARC V9 ABI and compiler documentation for more information on code models.


Note -

A program compiled with the abs32 code model must be linked below 4 gigabytes using the -M /usr/lib/ld/sparcv9/map.below4G option.