Class StorageEntry
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.type.StorageEntry
Representation of an immutable storage entry (input/output) for sub-routine calls. Used to define
ICallingConvention objects.
Types of storage entries:
- stack entries (any slot count)
- platform register (single slot)
- pair of platform registers (double slot)
- double-pair of platform registers (quad slot)
- a mixed entry, made up of registers and stack slots (any slot count)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTransformation rules for multi-slot storages.static enumType of storage requirements (on the stack, in registers, etc.). -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectRegisters(Set<Long> sink) static StorageEntrycreateMixed(StorageEntry... items) Create a mixed storage entry.static StorageEntrycreateMixed(Collection<StorageEntry> items) Create a mixed storage entry.static StorageEntrycreateRegister(long regId) Create a single-register storage entry.static StorageEntrycreateRegisterPair(long regId1, long regId2) Create a double-register storage entry.static StorageEntrycreateRegisterPairEndianDep(long regId1, long regId2) Create a double-register storage entry.static StorageEntrycreateRegisterQuad(long regId1, long regId2, long regId3, long regId4) static StorageEntrycreateRegisterQuadEndianDep(long regId1, long regId2, long regId3, long regId4) static StorageEntrycreateStackEntry(long slotIndex, int slotCount) Create a stack storage entry.static StorageEntrycreateStackSlot(long slotIndex) Create a single-slot stack storage entry.booleanformatLong(IRegisterBank rbl) getMixedItem(int index) intgetType()longgetValue()Get the slot index or native register id, depending on the type of this object.longgetValue(Endianness endian) Get the slot index or native register id, depending on the type of this object.longFor register pairs, retrieve the native register id of the second register of the pair.longgetValue2(Endianness endian) For register pairs, retrieve the native register id of the second register of the pair.longFor register quads, retrieve the native register id of the third register.longFor register quads, retrieve the native register id of the fourth register.intinthashCode()booleanbooleanintnextSlotIndex(int currentSlotIndex, int requestedSlotCount) Calculate the next slot index given the slot index of the current storage entry.nextStackEntry(int slotcount) nextStackEntry(int slotcount, int slotalign) toString()withCount(int count) Duplicate this STACK entry, and set a custom slot count.
-
Method Details
-
createStackSlot
Create a single-slot stack storage entry. Stack entries are relative to the stack pointer at the called routine entry-point.- Parameters:
slotIndex-- Returns:
-
createStackEntry
Create a stack storage entry. Stack entries are relative to the stack pointer at the called routine entry-point.- Parameters:
slotIndex-slotCount-- Returns:
-
createRegister
Create a single-register storage entry.- Parameters:
regId- register id (refer to register banks)- Returns:
-
createRegisterPair
Create a double-register storage entry.- Parameters:
regId1- low register id (refer to register banks)regId2- high register id (refer to register banks)- Returns:
-
createRegisterPairEndianDep
Create a double-register storage entry. Register order (which one stores the LSB, which one stores the MSB) depends on external parameters.- Parameters:
regId1- first register id (refer to register banks)regId2- second register id (refer to register banks)- Returns:
-
createRegisterQuad
- Parameters:
regId1-regId2-regId3-regId4-- Returns:
-
createRegisterQuadEndianDep
public static StorageEntry createRegisterQuadEndianDep(long regId1, long regId2, long regId3, long regId4) - Parameters:
regId1-regId2-regId3-regId4-- Returns:
-
createMixed
Create a mixed storage entry.- Parameters:
items- a 2+ items list of one or moreStorageEntry.Type.REGISTERentries, followed by an optionalStorageEntry.Type.STACKentry.- Returns:
-
createMixed
Create a mixed storage entry.- Parameters:
items- a 2+ items list of one or moreStorageEntry.Type.REGISTERentries, followed by an optionalStorageEntry.Type.STACKentry.- Returns:
-
withCount
Duplicate this STACK entry, and set a custom slot count.- Parameters:
count-- Returns:
-
hashCode
public int hashCode() -
equals
-
getType
-
getValueAsStackIndex
public int getValueAsStackIndex() -
getRegisters
-
collectRegisters
-
getValue
public long getValue()Get the slot index or native register id, depending on the type of this object.- Returns:
-
getValue
Get the slot index or native register id, depending on the type of this object. To be used forStorageEntry.Type.REGISTER_PAIRovergetValue()which may return the wrong slot index.- Returns:
-
getValue2
public long getValue2()For register pairs, retrieve the native register id of the second register of the pair.- Returns:
-
getValue2
For register pairs, retrieve the native register id of the second register of the pair.- Parameters:
endian-- Returns:
-
getValue3
public long getValue3()For register quads, retrieve the native register id of the third register.- Returns:
-
getValue4
public long getValue4()For register quads, retrieve the native register id of the fourth register.- Returns:
-
getMixedItems
- Returns:
-
getMixedItem
- Parameters:
index-- Returns:
-
nextSlotIndex
public int nextSlotIndex(int currentSlotIndex, int requestedSlotCount) Calculate the next slot index given the slot index of the current storage entry.- Parameters:
currentSlotIndex- slot index of this storage entryrequestedSlotCount- the amount of slots used to accommodate this entry, unless it was a register-based entry- Returns:
- the next available slot for storage
-
isStackBased
public boolean isStackBased() -
isRegisterBased
public boolean isRegisterBased() -
nextStackEntry
-
nextStackEntry
-
getSlotCount
public int getSlotCount() -
toString
-
formatLong
-
formatParseable
-