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

public Class CodeUtil

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .Collections, .Map, jdk.vm.ci.meta.JavaType, .MetaUtil, .ResolvedJavaMethod, .Signature

Miscellaneous collection of utility methods used by jdk.vm.ci.code and its clients.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
CodeUtil.DefaultRefMapFormatter

Formats a location present in a reference map.

public static class
public static interface

Field Summary

Modifier and TypeField and Description
public static final int
K

public static final int
M

public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static StringBuilder

Returns:

the value of sb
append
(StringBuilder
the StringBuilder to append to
sb
,
BytecodePosition
the code position to format and append to sb
pos
)

Appends a formatted code position to a StringBuilder.

public static StringBuilder

Returns:

the value of sb
append
(StringBuilder
the StringBuilder to append to
sb
,
BytecodeFrame
the frame to format and append to sb
frame
)

Appends a formatted frame to a StringBuilder.

public static StringBuilder

Returns:

the value of sb
append
(StringBuilder
the StringBuilder to append to
sb
,
DebugInfo
the debug info to format and append to sb
info
,
CodeUtil.RefMapFormatter formatterArg)

Appends a formatted debug info to a StringBuilder.

public static long

Returns:

a long with the same value as the inputBits-bit number value
convert
(long
the input value
value
,
int
the bit width of the input value
inputBits
,
boolean
whether the values should be interpreted as signed or unsigned
unsigned
)

Convert an integer to long.

public static CallingConvention
getCallingConvention(CodeCacheProvider codeCache, CallingConvention.Type type, ResolvedJavaMethod method, ValueKindFactory<?> valueKindFactory)

Create a calling convention from a ResolvedJavaMethod.

public static boolean
isEven(int n)

public static boolean
isOdd(int n)

public static boolean

Returns:

true if the value is a power of two; false otherwise
isPowerOf2
(int
the value to check
val
)

Checks whether the specified integer is a power of two.

public static boolean

Returns:

true if the value is a power of two; false otherwise
isPowerOf2
(long
the value to check
val
)

Checks whether the specified long is a power of two.

public static int

Returns:

the log base 2 of the value
log2
(int
the value
val
)

Computes the log (base 2) of the specified integer, rounding down.

public static int

Returns:

the log base 2 of the value
log2
(long
the value
val
)

Computes the log (base 2) of the specified long, rounding down.

public static long
mask(int bits)

Get a bitmask with the low bits bit set and the high 64 - bits bit clear.

public static long
maxValue(int bits)

Get the maximum value representable in a bits bit signed integer.

public static long
minValue(int bits)

Get the minimum value representable in a bits bit signed integer.

public static long

Returns:

value interpreted as resultBits bit number, encoded as signed long
narrow
(long
the value
value
,
int
the result bit width
resultBits
)

Narrow an integer value to a given bit width, and return the result as a signed long.

public static long

Returns:

a signed long with the same value as the signed inputBits-bit number value
signExtend
(long
the input value
value
,
int
the bit width of the input value
inputBits
)

Sign extend an integer.

public static String

Returns:

a string with one line per row and each column left-aligned
tabulate
(Object[]
the cells of the table in row-major order
cells
,
int
the number of columns per row
cols
,
int
the number of space padding inserted before each formatted cell value
lpad
,
int
the number of space padding inserted after each formatted cell value
rpad
)

Formats a given table as a string.

public static String

Returns:

the values in frame as a tabulated string
tabulateValues
(BytecodeFrame frame)

Formats the values in a frame as a tabulated string.

public static long

Returns:

an unsigned long with the same value as the unsigned inputBits-bit number value
zeroExtend
(long
the input value
value
,
int
the bit width of the input value
inputBits
)

Zero extend an integer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

Kback to summary
public static final int K
Mback to summary
public static final int M
NEW_LINEback to summary
public static final String NEW_LINE

Constructor Detail

CodeUtilback to summary
public CodeUtil()

Method Detail

appendback to summary
public static StringBuilder append(StringBuilder sb, BytecodePosition pos)

Appends a formatted code position to a StringBuilder.

Parameters
sb:StringBuilder

the StringBuilder to append to

pos:BytecodePosition

the code position to format and append to sb

Returns:StringBuilder

the value of sb

appendback to summary
public static StringBuilder append(StringBuilder sb, BytecodeFrame frame)

Appends a formatted frame to a StringBuilder.

Parameters
sb:StringBuilder

the StringBuilder to append to

frame:BytecodeFrame

the frame to format and append to sb

Returns:StringBuilder

the value of sb

appendback to summary
public static StringBuilder append(StringBuilder sb, DebugInfo info, CodeUtil.RefMapFormatter formatterArg)

Appends a formatted debug info to a StringBuilder.

Parameters
sb:StringBuilder

the StringBuilder to append to

info:DebugInfo

the debug info to format and append to sb

Returns:StringBuilder

the value of sb

convertback to summary
public static long convert(long value, int inputBits, boolean unsigned)

Convert an integer to long.

Parameters
value:long

the input value

inputBits:int

the bit width of the input value

unsigned:boolean

whether the values should be interpreted as signed or unsigned

Returns:long

a long with the same value as the inputBits-bit number value

getCallingConventionback to summary
public static CallingConvention getCallingConvention(CodeCacheProvider codeCache, CallingConvention.Type type, ResolvedJavaMethod method, ValueKindFactory<?> valueKindFactory)

Create a calling convention from a ResolvedJavaMethod.

isEvenback to summary
public static boolean isEven(int n)
isOddback to summary
public static boolean isOdd(int n)
isPowerOf2back to summary
public static boolean isPowerOf2(int val)

Checks whether the specified integer is a power of two.

Parameters
val:int

the value to check

Returns:boolean

true if the value is a power of two; false otherwise

isPowerOf2back to summary
public static boolean isPowerOf2(long val)

Checks whether the specified long is a power of two.

Parameters
val:long

the value to check

Returns:boolean

true if the value is a power of two; false otherwise

log2back to summary
public static int log2(int val)

Computes the log (base 2) of the specified integer, rounding down. (E.g log2(8) = 3, log2(21) = 4 )

Parameters
val:int

the value

Returns:int

the log base 2 of the value

log2back to summary
public static int log2(long val)

Computes the log (base 2) of the specified long, rounding down. (E.g log2(8) = 3, log2(21) = 4)

Parameters
val:long

the value

Returns:int

the log base 2 of the value

maskback to summary
public static long mask(int bits)

Get a bitmask with the low bits bit set and the high 64 - bits bit clear.

maxValueback to summary
public static long maxValue(int bits)

Get the maximum value representable in a bits bit signed integer.

minValueback to summary
public static long minValue(int bits)

Get the minimum value representable in a bits bit signed integer.

narrowback to summary
public static long narrow(long value, int resultBits)

Narrow an integer value to a given bit width, and return the result as a signed long.

Parameters
value:long

the value

resultBits:int

the result bit width

Returns:long

value interpreted as resultBits bit number, encoded as signed long

signExtendback to summary
public static long signExtend(long value, int inputBits)

Sign extend an integer.

Parameters
value:long

the input value

inputBits:int

the bit width of the input value

Returns:long

a signed long with the same value as the signed inputBits-bit number value

tabulateback to summary
public static String tabulate(Object[] cells, int cols, int lpad, int rpad)

Formats a given table as a string. The value of each cell is produced by String#valueOf(Object).

Parameters
cells:Object[]

the cells of the table in row-major order

cols:int

the number of columns per row

lpad:int

the number of space padding inserted before each formatted cell value

rpad:int

the number of space padding inserted after each formatted cell value

Returns:String

a string with one line per row and each column left-aligned

tabulateValuesback to summary
public static String tabulateValues(BytecodeFrame frame)

Formats the values in a frame as a tabulated string.

Returns:String

the values in frame as a tabulated string

zeroExtendback to summary
public static long zeroExtend(long value, int inputBits)

Zero extend an integer.

Parameters
value:long

the input value

inputBits:int

the bit width of the input value

Returns:long

an unsigned long with the same value as the unsigned inputBits-bit number value

jdk.vm.ci.code back to summary

public Class CodeUtil.DefaultRefMapFormatter

extends Object
implements RefMapFormatter
Class Inheritance
All Implemented Interfaces
jdk.vm.ci.code.CodeUtil.RefMapFormatter

Formats a location present in a reference map.

Field Summary

Modifier and TypeField and Description
public final Register
fp

The register used as the frame pointer.

public final int
refMapToFPOffset

The offset (in bytes) from the slot pointed to by fp to the slot corresponding to bit 0 in the frame reference map.

public final int
slotSize

The size of a stack slot.

Constructor Summary

AccessConstructor and Description
public
DefaultRefMapFormatter(int slotSize, Register fp, int refMapToFPOffset)

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fpback to summary
public final Register fp

The register used as the frame pointer.

refMapToFPOffsetback to summary
public final int refMapToFPOffset

The offset (in bytes) from the slot pointed to by fp to the slot corresponding to bit 0 in the frame reference map.

slotSizeback to summary
public final int slotSize

The size of a stack slot.

Constructor Detail

DefaultRefMapFormatterback to summary
public DefaultRefMapFormatter(int slotSize, Register fp, int refMapToFPOffset)

Method Detail

formatStackSlotback to summary
public String formatStackSlot(int frameRefMapIndex)

Implements jdk.vm.ci.code.CodeUtil.RefMapFormatter.formatStackSlot.

Annotations
@Override
jdk.vm.ci.code back to summary

public Class CodeUtil.NumberedRefMapFormatter

extends Object
implements RefMapFormatter
Class Inheritance
All Implemented Interfaces
jdk.vm.ci.code.CodeUtil.RefMapFormatter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
formatRegister(int regRefMapIndex)

public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

NumberedRefMapFormatterback to summary
public NumberedRefMapFormatter()

Method Detail

formatRegisterback to summary
public String formatRegister(int regRefMapIndex)
formatStackSlotback to summary
public String formatStackSlot(int frameRefMapIndex)

Implements jdk.vm.ci.code.CodeUtil.RefMapFormatter.formatStackSlot.

Annotations
@Override
jdk.vm.ci.code back to summary

public Interface CodeUtil.RefMapFormatter

Known Direct Implementers
jdk.vm.ci.code.CodeUtil.DefaultRefMapFormatter, jdk.vm.ci.code.CodeUtil.NumberedRefMapFormatter

Method Summary

Modifier and TypeMethod and Description
public String
formatStackSlot(int frameRefMapIndex)

Method Detail

formatStackSlotback to summary
public String formatStackSlot(int frameRefMapIndex)