use of com.oracle.svm.core.jdk.RuntimeSupport in project graal by oracle.
the class JavaMainWrapper method run.
@CEntryPoint
@CEntryPointOptions(prologue = EnterCreateIsolatePrologue.class, include = CEntryPointOptions.NotIncludedAutomatically.class)
public static int run(int paramArgc, CCharPointerPointer paramArgv) throws Exception {
JavaThreads.singleton().assignJavaThread(preallocatedThread, true);
JavaMainWrapper.argc = paramArgc;
JavaMainWrapper.argv = paramArgv;
Architecture imageArchitecture = ImageSingletons.lookup(TargetDescription.class).arch;
AMD64CPUFeatureAccess.verifyHostSupportsArchitecture(imageArchitecture);
String[] args = SubstrateUtil.getArgs(paramArgc, paramArgv);
if (SubstrateOptions.ParseRuntimeOptions.getValue()) {
args = RuntimeOptionParser.singleton().parse(args, DEFAULT_OPTION_PREFIX, PLUS_MINUS, true);
args = RuntimeOptionParser.singleton().parse(args, GRAAL_OPTION_PREFIX, NAME_VALUE, true);
args = XOptions.singleton().parse(args);
args = RuntimePropertyParser.parse(args);
}
mainArgs = args;
try {
final RuntimeSupport rs = RuntimeSupport.getRuntimeSupport();
if (AllocationSite.Options.AllocationProfiling.getValue()) {
rs.addShutdownHook(new AllocationSite.AllocationProfilingShutdownHook());
}
if (SubstrateOptions.PrintGCSummary.getValue()) {
rs.addShutdownHook(new PrintGCSummaryShutdownHook());
}
try {
JavaMainSupport.executeStartupHooks();
ImageSingletons.lookup(JavaMainSupport.class).getJavaMainMethod().invoke(null, (Object) mainArgs);
} finally {
// always execute the shutdown hooks
JavaMainSupport.executeShutdownHooks();
}
} catch (Throwable ex) {
SnippetRuntime.reportUnhandledExceptionJava(ex);
}
JavaThreads.singleton().joinAllNonDaemons();
Counter.logValues();
return 0;
}
Aggregations