src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java	Fri Jul  7 09:29:28 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java	Fri Jul  7 09:29:28 2017

*** 20,31 **** --- 20,29 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package org.graalvm.compiler.core.test; import static org.graalvm.compiler.debug.DelegatingDebugConfig.Feature.INTERCEPT; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.annotation.Annotation;
*** 46,63 **** --- 44,58 ---- import org.graalvm.compiler.api.replacements.Snippet.NonNullParameter; import org.graalvm.compiler.api.replacements.Snippet.VarargsParameter; import org.graalvm.compiler.api.test.Graal; import org.graalvm.compiler.bytecode.BridgeMethodUtils; import org.graalvm.compiler.core.CompilerThreadFactory; import org.graalvm.compiler.core.CompilerThreadFactory.DebugConfigAccess; import org.graalvm.compiler.core.common.LIRKind; import org.graalvm.compiler.core.common.type.ArithmeticOpTable; ! import org.graalvm.compiler.debug.DebugCloseable; ! import org.graalvm.compiler.debug.DebugConfigScope; ! import org.graalvm.compiler.debug.DebugEnvironment; import org.graalvm.compiler.debug.DelegatingDebugConfig; import org.graalvm.compiler.debug.GraalDebugConfig; ! import org.graalvm.compiler.debug.DebugHandlersFactory; ! import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.graph.Node; import org.graalvm.compiler.graph.NodeClass; import org.graalvm.compiler.java.GraphBuilderPhase; import org.graalvm.compiler.nodeinfo.NodeInfo;
*** 201,225 **** --- 196,216 ---- // Allows a subset of methods to be checked through use of a system property String property = System.getProperty(CheckGraalInvariants.class.getName() + ".filters"); String[] filters = property == null ? null : property.split(","); OptionValues options = getInitialOptions(); ! CompilerThreadFactory factory = new CompilerThreadFactory("CheckInvariantsThread", new DebugConfigAccess() { @Override public GraalDebugConfig getDebugConfig() { return DebugEnvironment.ensureInitialized(options); } }); ! CompilerThreadFactory factory = new CompilerThreadFactory("CheckInvariantsThread"); int availableProcessors = Runtime.getRuntime().availableProcessors(); ThreadPoolExecutor executor = new ThreadPoolExecutor(availableProcessors, availableProcessors, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), factory); List<String> errors = Collections.synchronizedList(new ArrayList<>()); for (Method m : BadUsageWithEquals.class.getDeclaredMethods()) { ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m); StructuredGraph graph = new StructuredGraph.Builder(options, AllowAssumptions.YES).method(method).build(); try (DebugConfigScope s = Debug.setConfig(new DelegatingDebugConfig().disable(INTERCEPT)); Debug.Scope ds = Debug.scope("CheckingGraph", graph, method)) { + try (DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER)) { + StructuredGraph graph = new StructuredGraph.Builder(options, debug, AllowAssumptions.YES).method(method).build(); + try (DebugCloseable s = debug.disableIntercept(); DebugContext.Scope ds = debug.scope("CheckingGraph", graph, method)) { graphBuilderSuite.apply(graph, context); // update phi stamps graph.getNodes().filter(PhiNode.class).forEach(PhiNode::inferStamp); checkGraph(context, graph); errors.add(String.format("Expected error while checking %s", m));
*** 227,236 **** --- 218,228 ---- // expected! } catch (Throwable e) { errors.add(String.format("Error while checking %s:%n%s", m, printStackTraceToString(e))); } } + } if (errors.isEmpty()) { // Order outer classes before the inner classes classNames.sort((String a, String b) -> a.compareTo(b)); // Initialize classes in single thread to avoid deadlocking issues during initialization List<Class<?>> classes = initializeClasses(tool, classNames);
*** 249,280 **** --- 241,275 ---- // ignore } else { String methodName = className + "." + m.getName(); if (matches(filters, methodName)) { executor.execute(() -> { + try (DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER)) { ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m); ! StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build(); ! try (DebugConfigScope s = Debug.setConfig(new DelegatingDebugConfig().disable(INTERCEPT)); Debug.Scope ds = Debug.scope("CheckingGraph", graph, method)) { ! try (DebugCloseable s = debug.disableIntercept(); DebugContext.Scope ds = debug.scope("CheckingGraph", graph, method)) { checkMethod(method); graphBuilderSuite.apply(graph, context); // update phi stamps graph.getNodes().filter(PhiNode.class).forEach(PhiNode::inferStamp); checkGraph(context, graph); } catch (VerificationError e) { errors.add(e.getMessage()); } catch (LinkageError e) { // suppress linkages errors resulting from eager resolution } catch (BailoutException e) { // Graal bail outs on certain patterns in Java bytecode (e.g., + // Graal bail outs on certain patterns in Java bytecode + // (e.g., // unbalanced monitors introduced by jacoco). } catch (Throwable e) { try { tool.handleParsingException(e); } catch (Throwable t) { errors.add(String.format("Error while checking %s:%n%s", methodName, printStackTraceToString(e))); } } + } }); } } } }

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File