IndexCoreasmjit::LabelEntry

asmjit::LabelEntry Class Reference [¶]

Label entry provides data stored by CodeHolder for each Label.

Label entry is used mostly internall by AsmJit, but it's possibly to use it to query various information about a label. For example to get its type, flags, name, and fixups (if the label is not bound) or offset (if the label is bound).

To make the entry small, it's currently split into two data structures - LabelEntry, which is stored in an array as a value, and LabelEntry::ExtraData, which can be pointed to via LabelEntry::_objectData. Extra data of unnamed anonymous labels is shared (and immutable), thus all unnamed anonymous labels would only use LabelEntry (16 bytes per label).

Classes

Member Functions

Accessors

LabelType LabelEntry::labelType() constnoexcept[¶]

Returns the type of the label.

The type of the label depends on how it was created. Most JIT code uses unnamed anonymous labels created by emitters, for example BaseEmitter::newLabel() returns a Label instance having id that was created by CodeHolder::newLabelId.

LabelFlags LabelEntry::labelFlags() constnoexcept[¶]

Returns label flags.

Note
Label flags are mostly for internal use, there is probably no reason to use them in user code.

bool LabelEntry::hasLabelFlag() constnoexcept[¶]

Tests whether the label has the given flag set.

Note
Using other getters instead is advised, for example using hasName() and hasParent() is better (and shorter) than checking label flags.

bool LabelEntry::_hasOwnExtraData() constnoexcept[¶]

Tests whether the LabelEntry has own extra data (see LabelEntry::ExtraData).

Note
This should only be used by AsmJit for internal purposes. Own extra data means that the LabelEntry has a mutable extra data separately allocated. This information should not be necessary to users as LabelEntry getters should encapsulate label introspection.

bool LabelEntry::hasName() constnoexcept[¶]

Tests whether the Label represented by this LabelEntry has a name.

bool LabelEntry::hasParent() constnoexcept[¶]

Tests whether the Label represented by this LabelEntry has a parent label.

bool LabelEntry::isBound() constnoexcept[¶]

Tests whether the label represented by this LabelEntry is bound.

Bound label means that it has an associated Section and a position in such section. Labels are bound by calling BaseEmitter::bind() method with Label operand.

bool LabelEntry::isBoundTo(
const Section* section
) constnoexcept[1/2][¶]

Tests whether the label is bound to a the given section.

bool LabelEntry::isBoundTo(
uint32_t sectionId
) constnoexcept[2/2][¶]

Tests whether the label is bound to a the given sectionId.

uint32_t LabelEntry::sectionId() constnoexcept[¶]

Returns the section where the label was bound.

If the label was not yet bound the return value is nullptr.

uint32_t LabelEntry::parentId() constnoexcept[¶]

Returns label's parent id or Globals::kInvalidId if the label has no parent.

const char* LabelEntry::name() constnoexcept[¶]

Returns the label's name.

Note
Local labels will return their local name without their parent part, for example ".L1".

uint32_t LabelEntry::nameSize() constnoexcept[¶]

Returns size of label's name.

Note
Label name is always null terminated, so you can use strlen() to get it, however, it's also cached in LabelEntry itself, so if you want to know the size the fastest way is to call LabelEntry::nameSize().

bool LabelEntry::hasFixups() constnoexcept[¶]

Returns unresolved fixups associated with this label.

Fixup* LabelEntry::unresolvedLinks() constnoexcept[¶]

Returns unresolved fixups associated with this label.

uint64_t LabelEntry::offset() constnoexcept[¶]

Returns the label offset (can only be used after the label is bound).

Note
This would trigger an assertion failure in debug builds when called on an unbound label. When accessing offsets, always check whether the label is bound. Unbound labels don't have offsets.

SectionOrLabelEntryExtraHeader* LabelEntry::_objectData[¶]

Either references a Section where the label is bound or ExtraData.

uint64_t LabelEntry::_offsetOrFixups[¶]

Label entry payload.

When a Label is bound, _offsetOrFixups is the relative offset from the start of the section where the Label has been bound, otherwise _offsetOrFixups is a pointer to the first Fixup.