Top Description Fields Constructors Methods
jdk.vm.ci.code

public abstract Class Architecture

extends Object
Class Inheritance
Known Direct Subclasses
jdk.vm.ci.aarch64.AArch64, jdk.vm.ci.amd64.AMD64, jdk.vm.ci.riscv64.RISCV64
Imports
java.nio.ByteOrder, java.util.Set, jdk.vm.ci.code.Register.RegisterCategory, jdk.vm.ci.meta.JavaKind, .PlatformKind

Represents a CPU architecture, including information such as its endianness, CPU registers, word width, etc.

Field Summary

Modifier and TypeField and Description
private final ByteOrder
byteOrder

The byte ordering can be either little or big endian.

private final int
implicitMemoryBarriers

Mask of the barrier constants denoting the barriers that are not required to be explicitly inserted under this architecture.

private final int
machineCodeCallDisplacementOffset

Offset in bytes from the beginning of a call instruction to the displacement.

private final String
name

The name of this architecture (e.g. "AMD64").

private final RegisterArray
registers

List of all available registers on this architecture.

private final int
returnAddressSize

The size of the return address pushed to the stack by a call instruction.

private final boolean
unalignedMemoryAccess

Whether the architecture supports unaligned memory accesses.

private final PlatformKind
wordKind

The architecture specific type of a native word.

Constructor Summary

AccessConstructor and Description
protected
Architecture(String name, PlatformKind wordKind, ByteOrder byteOrder, boolean unalignedMemoryAccess, RegisterArray registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset, int returnAddressSize)

Method Summary

Modifier and TypeMethod and Description
public abstract boolean
canStoreValue(Register.RegisterCategory
the category of the register
category
,
PlatformKind
the kind that should be stored in the register
kind
)

Determine whether a kind can be stored in a register of a given category.

public final boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public RegisterArray
getAvailableValueRegisters()

Gets a list of all registers available for storing values on this architecture.

public ByteOrder
public abstract Set<? extends CPUFeatureName>
getFeatures()

Gets the set of CPU features supported by the current platform.

public abstract PlatformKind

Returns:

the largest kind that can be stored in a register category
getLargestStorableKind
(Register.RegisterCategory
the category of the register
category
)

Return the largest kind that can be stored in a register of a given category.

public int
getMachineCodeCallDisplacementOffset()

Gets the offset in bytes from the beginning of a call instruction to the displacement.

public String
getName()

Gets the name of this architecture.

public abstract PlatformKind

Returns:

null if there no deterministic PlatformKind for javaKind
getPlatformKind
(JavaKind javaKind)

Gets the PlatformKind that is used to store values of a given JavaKind.

public RegisterArray
getRegisters()

Gets the list of all registers that exist on this architecture.

public int
getReturnAddressSize()

Gets the size of the return address pushed to the stack by a call instruction.

public PlatformKind
public int
getWordSize()

Gets the natural size of words (typically registers and pointers) of this architecture, in bytes.

public final int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public final int

Returns:

the value of barriers minus the barriers unnecessary on this architecture
requiredBarriers
(int
a mask of the barrier constants
barriers
)

Determines the barriers in a given barrier mask that are explicitly required on this architecture.

public boolean

Returns:

true if the architecture supports unaligned memory accesses.
supportsUnalignedMemoryAccess
()

public final String

Returns:

the string representation of this architecture
toString
()

Overrides java.lang.Object.toString.

Converts this architecture to a string.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

byteOrderback to summary
private final ByteOrder byteOrder

The byte ordering can be either little or big endian.

implicitMemoryBarriersback to summary
private final int implicitMemoryBarriers

Mask of the barrier constants denoting the barriers that are not required to be explicitly inserted under this architecture.

machineCodeCallDisplacementOffsetback to summary
private final int machineCodeCallDisplacementOffset

Offset in bytes from the beginning of a call instruction to the displacement.

nameback to summary
private final String name

The name of this architecture (e.g. "AMD64").

registersback to summary
private final RegisterArray registers

List of all available registers on this architecture. The index of each register in this list is equal to its number.

returnAddressSizeback to summary
private final int returnAddressSize

The size of the return address pushed to the stack by a call instruction. A value of 0 denotes that call linkage uses registers instead (e.g. SPARC).

unalignedMemoryAccessback to summary
private final boolean unalignedMemoryAccess

Whether the architecture supports unaligned memory accesses.

wordKindback to summary
private final PlatformKind wordKind

The architecture specific type of a native word.

Constructor Detail

Architectureback to summary
protected Architecture(String name, PlatformKind wordKind, ByteOrder byteOrder, boolean unalignedMemoryAccess, RegisterArray registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset, int returnAddressSize)

Method Detail

canStoreValueback to summary
public abstract boolean canStoreValue(Register.RegisterCategory category, PlatformKind kind)

Determine whether a kind can be stored in a register of a given category.

Parameters
category:Register.RegisterCategory

the category of the register

kind:PlatformKind

the kind that should be stored in the register

equalsback to summary
public final boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAvailableValueRegistersback to summary
public RegisterArray getAvailableValueRegisters()

Gets a list of all registers available for storing values on this architecture. This may be a subset of getRegisters(), depending on the capabilities of this particular CPU.

getByteOrderback to summary
public ByteOrder getByteOrder()
getFeaturesback to summary
public abstract Set<? extends CPUFeatureName> getFeatures()

Gets the set of CPU features supported by the current platform.

getLargestStorableKindback to summary
public abstract PlatformKind getLargestStorableKind(Register.RegisterCategory category)

Return the largest kind that can be stored in a register of a given category.

Parameters
category:Register.RegisterCategory

the category of the register

Returns:PlatformKind

the largest kind that can be stored in a register category

getMachineCodeCallDisplacementOffsetback to summary
public int getMachineCodeCallDisplacementOffset()

Gets the offset in bytes from the beginning of a call instruction to the displacement.

getNameback to summary
public String getName()

Gets the name of this architecture.

getPlatformKindback to summary
public abstract PlatformKind getPlatformKind(JavaKind javaKind)

Gets the PlatformKind that is used to store values of a given JavaKind.

Returns:PlatformKind

null if there no deterministic PlatformKind for javaKind

getRegistersback to summary
public RegisterArray getRegisters()

Gets the list of all registers that exist on this architecture. This contains all registers that exist in the specification of this architecture. Not all of them may be available on this particular architecture instance. The index of each register in this list is equal to its number.

getReturnAddressSizeback to summary
public int getReturnAddressSize()

Gets the size of the return address pushed to the stack by a call instruction. A value of 0 denotes that call linkage uses registers instead.

getWordKindback to summary
public PlatformKind getWordKind()
getWordSizeback to summary
public int getWordSize()

Gets the natural size of words (typically registers and pointers) of this architecture, in bytes.

hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
requiredBarriersback to summary
public final int requiredBarriers(int barriers)

Determines the barriers in a given barrier mask that are explicitly required on this architecture.

Parameters
barriers:int

a mask of the barrier constants

Returns:int

the value of barriers minus the barriers unnecessary on this architecture

supportsUnalignedMemoryAccessback to summary
public boolean supportsUnalignedMemoryAccess()
Returns:boolean

true if the architecture supports unaligned memory accesses.

toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Converts this architecture to a string.

Returns:String

the string representation of this architecture

Annotations
@Override