Modifier and Type | Class and Description |
---|---|
static class |
CodeUtil.DefaultRefMapFormatter
Formats a location present in a register or frame reference map.
|
static class |
CodeUtil.DefaultRegFormatter
Formats a location in a register reference map.
|
static class |
CodeUtil.NumberedRefMapFormatter |
static interface |
CodeUtil.RefMapFormatter |
Modifier and Type | Field and Description |
---|---|
static int |
K |
static int |
M |
static String |
NEW_LINE |
Constructor and Description |
---|
CodeUtil() |
Modifier and Type | Method and Description |
---|---|
static StringBuilder |
append(StringBuilder sb,
BytecodeFrame frame)
Appends a formatted frame to a
StringBuilder . |
static StringBuilder |
append(StringBuilder sb,
BytecodePosition pos)
Appends a formatted code position to a
StringBuilder . |
static StringBuilder |
append(StringBuilder sb,
DebugInfo info,
CodeUtil.RefMapFormatter formatterArg)
Appends a formatted debug info to a
StringBuilder . |
static long |
convert(long value,
int inputBits,
boolean unsigned)
Convert an integer to long.
|
static CallingConvention |
getCallingConvention(CodeCacheProvider codeCache,
CallingConvention.Type type,
ResolvedJavaMethod method,
boolean stackOnly)
Create a calling convention from a
ResolvedJavaMethod . |
static boolean |
isEven(int n) |
static boolean |
isOdd(int n) |
static boolean |
isPowerOf2(int val)
Checks whether the specified integer is a power of two.
|
static boolean |
isPowerOf2(long val)
Checks whether the specified long is a power of two.
|
static int |
log2(int val)
Computes the log (base 2) of the specified integer, rounding down.
|
static int |
log2(long val)
Computes the log (base 2) of the specified long, rounding down.
|
static long |
mask(int bits)
Get a bitmask with the low
bits bit set and the high 64 - bits bit clear. |
static long |
maxValue(int bits)
Get the maximum value representable in a
bits bit signed integer. |
static long |
minValue(int bits)
Get the minimum value representable in a
bits bit signed integer. |
static long |
narrow(long value,
int resultBits)
Narrow an integer value to a given bit width, and return the result as a signed long.
|
static long |
signExtend(long value,
int inputBits)
Sign extend an integer.
|
static String |
tabulate(Object[] cells,
int cols,
int lpad,
int rpad)
Formats a given table as a string.
|
static String |
tabulateValues(BytecodeFrame frame)
Formats the values in a frame as a tabulated string.
|
static long |
zeroExtend(long value,
int inputBits)
Zero extend an integer.
|
public static final int K
public static final int M
public CodeUtil()
public static boolean isOdd(int n)
public static boolean isEven(int n)
public static boolean isPowerOf2(int val)
val
- the value to checktrue
if the value is a power of two; false
otherwisepublic static boolean isPowerOf2(long val)
val
- the value to checktrue
if the value is a power of two; false
otherwisepublic static int log2(int val)
log2(8) = 3
,
log2(21) = 4
)val
- the valuepublic static int log2(long val)
log2(8) = 3
,
log2(21) = 4
)val
- the valuepublic static long narrow(long value, int resultBits)
value
- the valueresultBits
- the result bit widthvalue
interpreted as resultBits
bit number, encoded as signed longpublic static long signExtend(long value, int inputBits)
value
- the input valueinputBits
- the bit width of the input valueinputBits
-bit number
value
public static long zeroExtend(long value, int inputBits)
value
- the input valueinputBits
- the bit width of the input valueinputBits
-bit number
value
public static long convert(long value, int inputBits, boolean unsigned)
value
- the input valueinputBits
- the bit width of the input valueunsigned
- whether the values should be interpreted as signed or unsignedinputBits
-bit number value
public static long mask(int bits)
bits
bit set and the high 64 - bits
bit clear.public static long minValue(int bits)
bits
bit signed integer.public static long maxValue(int bits)
bits
bit signed integer.public static String tabulateValues(BytecodeFrame frame)
frame
- frame
as a tabulated stringpublic static String tabulate(Object[] cells, int cols, int lpad, int rpad)
String.valueOf(Object)
.cells
- the cells of the table in row-major ordercols
- the number of columns per rowlpad
- the number of space padding inserted before each formatted cell valuerpad
- the number of space padding inserted after each formatted cell valuepublic static StringBuilder append(StringBuilder sb, BytecodePosition pos)
StringBuilder
.sb
- the StringBuilder
to append topos
- the code position to format and append to sb
sb
public static StringBuilder append(StringBuilder sb, BytecodeFrame frame)
StringBuilder
.sb
- the StringBuilder
to append toframe
- the frame to format and append to sb
sb
public static StringBuilder append(StringBuilder sb, DebugInfo info, CodeUtil.RefMapFormatter formatterArg)
StringBuilder
.sb
- the StringBuilder
to append toinfo
- the debug info to format and append to sb
sb
public static CallingConvention getCallingConvention(CodeCacheProvider codeCache, CallingConvention.Type type, ResolvedJavaMethod method, boolean stackOnly)
ResolvedJavaMethod
.