@Override public void beforeAnalysis(BeforeAnalysisAccess access) { RuntimeSupport.getRuntimeSupport().addStartupHook(SubstrateSegfaultHandler::install); } }
@Override public void afterRegistration(AfterRegistrationAccess access) { RuntimeSupport rs = RuntimeSupport.getRuntimeSupport(); rs.addCommandPlugin(new GetCRuntimeArgumentBlockLengthCommand()); rs.addCommandPlugin(new SetCRuntimeArgument0Command()); } }
/** * Adds a tear down hook that is executed before the isolate torn down. * * @param tearDownHook hook to executed on isolate tear down. */ public void addTearDownHook(Runnable tearDownHook) { addHook(tearDownHooks, tearDownHook); }
/** * Called only internally as part of the JDK shutdown process, use {@link #shutdown()} to * trigger the whoke JDK shutdown process. */ static void executeShutdownHooks() { executeHooks(getRuntimeSupport().shutdownHooks); }
@Override public void beforeAnalysis(BeforeAnalysisAccess access) { RuntimeSupport.getRuntimeSupport().sortCommandPlugins(); } }
public void initializeAtRuntime() { if (SubstrateOptions.MultiThreaded.getValue()) { compileQueue = new BackgroundCompileQueue(); RuntimeSupport.getRuntimeSupport().addTearDownHook(this::tearDown); } if (TruffleRuntimeOptions.getValue(SharedTruffleRuntimeOptions.TraceTruffleTransferToInterpreter)) { if (!SubstrateOptions.IncludeNodeSourcePositions.getValue()) { System.out.println("Warning: TraceTruffleTransferToInterpreter cannot print stack traces. Build image with -H:+IncludeNodeSourcePositions to enable stack traces."); } RuntimeOptionValues.singleton().update(Deoptimizer.Options.TraceDeoptimization, true); } updateGraalArchitectureWithHostCPUFeatures(getTruffleCompiler().getBackend()); installDefaultListeners(); }
@Override public void afterRegistration(AfterRegistrationAccess access) { if (AllocationSite.Options.AllocationProfiling.getValue()) { RuntimeSupport.getRuntimeSupport().addShutdownHook(AllocationSite::dumpProfilingResults); } } }
RuntimeSupport.getRuntimeSupport().executeStartupHooks(); RuntimeSupport.getRuntimeSupport().shutdown();
@Override public void afterRegistration(AfterRegistrationAccess access) { RuntimeSupport.initializeRuntimeSupport(); ImageSingletons.add(VMRuntimeSupport.class, RuntimeSupport.getRuntimeSupport()); }
@Substitute static Object command(Object arg) { if (arg instanceof Object[]) { Object[] args = (Object[]) arg; if (args.length > 0) { Object arg0 = args[0]; if (arg0 instanceof String) { String cmd = (String) arg0; Object[] cmdargs = Arrays.copyOfRange(args, 1, args.length); RuntimeSupport rs = RuntimeSupport.getRuntimeSupport(); return rs.runCommand(cmd, cmdargs); } } } throw new IllegalArgumentException("Argument to java.lang.Compiler.command(Object) must be an Object[] " + "with the first element being a String providing the name of the SVM command to run " + "and subsequent elements being the arguments to the command"); } }
@Override public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) { com.oracle.svm.core.jdk.RuntimeSupport result = com.oracle.svm.core.jdk.RuntimeSupport.getRuntimeSupport(); JavaConstant constant = snippetReflection.forObject(result); ConstantNode node = ConstantNode.forConstant(constant, b.getMetaAccess(), b.getGraph()); b.push(JavaKind.Object, node); b.notifyReplacedCall(targetMethod, node); return true; } @Override
@Override public void executeStartupHooks() { executeHooks(startupHooks); }
/** Construct and register the singleton instance, if necessary. */ public static void initializeRuntimeSupport() { assert ImageSingletons.contains(RuntimeSupport.class) == false : "Initializing RuntimeSupport again."; ImageSingletons.add(RuntimeSupport.class, new RuntimeSupport()); }
@SubstrateForeignCallTarget private static int tearDownIsolate() { try { RuntimeSupport.executeTearDownHooks(); if (!JavaThreads.singleton().tearDownVM()) { return CEntryPointErrors.UNSPECIFIED; } return Isolates.tearDownCurrent(); } catch (Throwable t) { logException(t); return CEntryPointErrors.UNCAUGHT_EXCEPTION; } }
public JNINativeInterface getGlobalFunctionTable() { JNINativeInterface functionTable = globalFunctionTable.get(); if (functionTable.isNull()) { functionTable = UnmanagedMemory.malloc(SizeOf.get(JNINativeInterface.class)); functionTableInitializer.initialize(functionTable); if (globalFunctionTable.compareAndSet(WordFactory.nullPointer(), functionTable)) { RuntimeSupport.getRuntimeSupport().addTearDownHook(() -> UnmanagedMemory.free(globalFunctionTable.get())); } else { // lost the race UnmanagedMemory.free(functionTable); functionTable = globalFunctionTable.get(); } } return functionTable; }
this.walkRegisteredMemoryTimer = new Timer("walkRegisteredMemory"); RuntimeSupport.getRuntimeSupport().addShutdownHook(this::printGCSummary);
/** * Called only internally as part of the isolate tear down process. These hooks clean up all * running threads to allow proper isolate tear down. * * Although public, this method should not go to the public API. */ public static void executeTearDownHooks() { executeHooks(getRuntimeSupport().tearDownHooks); }
dispatchThread.setDaemon(true); dispatchThread.start(); RuntimeSupport.getRuntimeSupport().addTearDownHook(() -> DispatchThread.interrupt(dispatchThread));
@Override public void beforeAnalysis(BeforeAnalysisAccess access) { RuntimeSupport.getRuntimeSupport().addStartupHook(new Runnable() { @Override /** * Ignore SIGPIPE. Reading from a closed pipe, instead of delivering a process-wide * signal whose default action is to terminate the process, will instead return an error * code from the specific write operation. * * From pipe(7}: If all file descriptors referring to the read end of a pipe have been * closed, then a write(2) will cause a SIGPIPE signal to be generated for the calling * process. If the calling process is ignoring this signal, then write(2) fails with the * error EPIPE. */ public void run() { final Signal.SignalDispatcher signalResult = Signal.signal(Signal.SignalEnum.SIGPIPE.getCValue(), Signal.SIG_IGN()); VMError.guarantee(signalResult != Signal.SIG_ERR(), "IgnoreSIGPIPEFeature.run: Could not ignore SIGPIPE"); } }); } }
objectReplacer.setGraalRuntime(graalRuntime); ImageSingletons.add(GraalRuntime.class, graalRuntime); RuntimeSupport.getRuntimeSupport().addShutdownHook(new GraalSupport.GraalShutdownHook());