in sdk/optimizationDetector/src/main/java/org/apache/teaclave/javasdk/tool/optimize/ECallInLoopDetector.java [97:119]
private static StructuredGraph getGraph(Method method) {
ResolvedJavaMethod javaMethod = accessProvider.lookupJavaMethod(method);
DebugContext debug = new DebugContext.Builder(options, compiler.getDebugHandlersFactories()).build();
StructuredGraph graph = compiler.createGraph(javaMethod, -1, null,
CompilationIdentifier.INVALID_COMPILATION_ID, options, debug);
try (DebugContext.Scope s = debug.scope("detectECallInLoop", graph)) {
InvocationPlugins plugins = new InvocationPlugins();
GraphBuilderConfiguration graphBuilderConfig = GraphBuilderConfiguration.getDefault(new GraphBuilderConfiguration.Plugins(plugins))
.withNodeSourcePosition(true)
.withEagerResolving(true)
.withRetainLocalVariables(true);
GraphBuilderPhase.Instance graphBuilder = new GraphBuilderPhase.Instance(compiler.getGraalRuntime().getHostProviders(), graphBuilderConfig, OptimisticOptimizations.NONE, null);
graphBuilder.apply(graph);
if (DEBUG) {
debug.dump(3, graph, "");
}
} catch (Throwable throwable) {
throwable.printStackTrace();
}
return graph;
}