< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/GraalTest.java

Print this page

        

*** 34,43 **** --- 34,44 ---- import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; + import jdk.vm.ci.meta.ResolvedJavaMethod; import org.graalvm.compiler.debug.DebugHandlersFactory; import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.DebugDumpHandler; import org.graalvm.compiler.options.OptionValues; import org.junit.After;
*** 390,410 **** * Gets a {@link DebugContext} object corresponding to {@code options}, creating a new one if * none currently exists. Debug contexts created by this method will have their * {@link DebugDumpHandler}s closed in {@link #afterTest()}. */ protected DebugContext getDebugContext(OptionValues options) { List<DebugContext> cached = cachedDebugs.get(); if (cached == null) { cached = new ArrayList<>(); cachedDebugs.set(cached); } for (DebugContext debug : cached) { if (debug.getOptions() == options) { return debug; } } ! DebugContext debug = DebugContext.create(options, NO_DESCRIPTION, NO_GLOBAL_METRIC_VALUES, DEFAULT_LOG_STREAM, getDebugHandlersFactories()); cached.add(debug); return debug; } private final ThreadLocal<List<DebugContext>> cachedDebugs = new ThreadLocal<>(); --- 391,431 ---- * Gets a {@link DebugContext} object corresponding to {@code options}, creating a new one if * none currently exists. Debug contexts created by this method will have their * {@link DebugDumpHandler}s closed in {@link #afterTest()}. */ protected DebugContext getDebugContext(OptionValues options) { + return getDebugContext(options, null, null); + } + + /** + * Gets a {@link DebugContext} object corresponding to {@code options}, creating a new one if + * none currently exists.Debug contexts created by this method will have their + * {@link DebugDumpHandler}s closed in {@link #afterTest()}. + * + * @param options currently active options + * @param id identification of the compilation or {@code null} + * @param method method to use for a proper description of the context or {@code null} + * @return configured context for compilation + */ + protected DebugContext getDebugContext(OptionValues options, String id, ResolvedJavaMethod method) { List<DebugContext> cached = cachedDebugs.get(); if (cached == null) { cached = new ArrayList<>(); cachedDebugs.set(cached); } for (DebugContext debug : cached) { if (debug.getOptions() == options) { return debug; } } ! final DebugContext.Description descr; ! if (method == null) { ! descr = NO_DESCRIPTION; ! } else { ! descr = new DebugContext.Description(method, id == null ? method.getName() : id); ! } ! DebugContext debug = DebugContext.create(options, descr, NO_GLOBAL_METRIC_VALUES, DEFAULT_LOG_STREAM, getDebugHandlersFactories()); cached.add(debug); return debug; } private final ThreadLocal<List<DebugContext>> cachedDebugs = new ThreadLocal<>();
< prev index next >