public class SubstrateUtil extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
SubstrateUtil.Thunk
The functional interface for a "thunk".
|
Modifier and Type | Field and Description |
---|---|
static boolean |
HOSTED
Field that is true during native image generation, but false at run time.
|
Constructor and Description |
---|
SubstrateUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
assertionsEnabled()
Checks whether assertions are enabled in the VM.
|
static void |
breakpoint(Object arg0)
Emits a node that triggers a breakpoint in debuggers.
|
static <T> T |
cast(Object obj,
Class<T> toType)
The same as
Class.cast(java.lang.Object) . |
static String |
digest(String value) |
static String |
getArchitectureName() |
static String[] |
getArgs(int argc,
org.graalvm.nativeimage.c.type.CCharPointerPointer argv)
Convert C-style to Java-style command line arguments.
|
static FileDescriptor |
getFileDescriptor(FileOutputStream out) |
static String |
getShellCommandString(List<String> cmd,
boolean multiLine) |
static boolean |
isBuildingLibgraal() |
static boolean |
isHiddenClass(Class<?> javaClass) |
static boolean |
isInLibgraal() |
static boolean |
isPowerOf2(long value) |
static String |
mangleName(String methodName)
Mangle the given method name according to our image's (default) mangling convention.
|
static void |
printDiagnostics(Log log,
org.graalvm.word.Pointer sp,
org.graalvm.nativeimage.c.function.CodePointer ip)
Prints extensive diagnostic information to the given Log.
|
static String |
quoteShellArg(String arg)
Reliably quote a string as a single shell command argument.
|
static String[] |
split(String value,
String separator)
Similar to
String.split(String) but with a fixed separator string instead of a
regular expression. |
static String[] |
split(String value,
String separator,
int limit)
Similar to
String.split(String, int) but with a fixed separator string instead of a
regular expression. |
static org.graalvm.nativeimage.c.type.CCharPointer |
strchr(org.graalvm.nativeimage.c.type.CCharPointer str,
int c)
Returns a pointer to the matched character or NULL if the character is not found.
|
static org.graalvm.word.UnsignedWord |
strlen(org.graalvm.nativeimage.c.type.CCharPointer str)
Returns the length of a C
char* string. |
static String |
toHex(byte[] data) |
static String |
uniqueShortName(Member m)
Returns a short, reasonably descriptive, but still unique name for the provided
Method , Constructor , or Field . |
static String |
uniqueShortName(jdk.vm.ci.meta.ResolvedJavaMethod m)
Returns a short, reasonably descriptive, but still unique name for the provided method.
|
public static final boolean HOSTED
public static String getArchitectureName()
public static boolean isBuildingLibgraal()
public static boolean isInLibgraal()
public static String quoteShellArg(String arg)
public static String getShellCommandString(List<String> cmd, boolean multiLine)
public static FileDescriptor getFileDescriptor(FileOutputStream out)
public static String[] getArgs(int argc, org.graalvm.nativeimage.c.type.CCharPointerPointer argv)
argc
- the number of arguments in the argv
array.argv
- a C char**
.public static org.graalvm.word.UnsignedWord strlen(org.graalvm.nativeimage.c.type.CCharPointer str)
char*
string.public static org.graalvm.nativeimage.c.type.CCharPointer strchr(org.graalvm.nativeimage.c.type.CCharPointer str, int c)
public static <T> T cast(Object obj, Class<T> toType)
Class.cast(java.lang.Object)
. This method is available for use in places where either the
Java compiler or static analysis tools would complain about a cast because the cast appears
to violate the Java type system rules.
The most prominent example are casts between a TargetClass
and the original class,
i.e., two classes that appear to be unrelated from the Java type system point of view, but
are actually the same class.public static boolean assertionsEnabled()
public static void breakpoint(Object arg0)
arg0
- value to inspect when the breakpoint hitshow to use breakpoints and inspect breakpoint values in the debugger
public static boolean isPowerOf2(long value)
public static void printDiagnostics(Log log, org.graalvm.word.Pointer sp, org.graalvm.nativeimage.c.function.CodePointer ip)
public static String[] split(String value, String separator)
String.split(String)
but with a fixed separator string instead of a
regular expression. This avoids making regular expression code reachable.public static String[] split(String value, String separator, int limit)
String.split(String, int)
but with a fixed separator string instead of a
regular expression. This avoids making regular expression code reachable.public static String toHex(byte[] data)
public static String uniqueShortName(jdk.vm.ci.meta.ResolvedJavaMethod m)
public static String uniqueShortName(Member m)
Method
, Constructor
, or Field
. The name includes a digest of the
fully qualified method name, which ensures uniqueness.public static String mangleName(String methodName)
methodName
- a string to manglepublic static boolean isHiddenClass(Class<?> javaClass)