@Override
 @SuppressWarnings("try")
 protected Suites createSuites() {
   try (OverrideScope s = OptionValue.override(GraalOptions.ImmutableCode, true)) {
     return super.createSuites();
   }
 }
  @SuppressWarnings("try")
  private void testExplicit(Integer i) {
    Assume.assumeTrue(config().useCompressedOops);

    Container c = new Container();
    c.i = i;

    try (OverrideScope s = OptionValue.override(GraalOptions.OptImplicitNullChecks, false)) {
      test("testSnippet", c);
    }
  }
Esempio n. 3
0
  @SuppressWarnings("try")
  private ScheduleResult getFinalSchedule(
      final String snippet, final TestMode mode, final SchedulingStrategy schedulingStrategy) {
    final StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
    try (Scope d = Debug.scope("FloatingReadTest", graph)) {
      try (OverrideScope s =
          OptionValue.override(
              OptScheduleOutOfLoops,
              schedulingStrategy == SchedulingStrategy.LATEST_OUT_OF_LOOPS,
              OptImplicitNullChecks,
              false)) {
        HighTierContext context = getDefaultHighTierContext();
        CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
        canonicalizer.apply(graph, context);
        if (mode == TestMode.INLINED_WITHOUT_FRAMESTATES) {
          new InliningPhase(canonicalizer).apply(graph, context);
        }
        new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER)
            .apply(graph, context);
        if (mode == TestMode.WITHOUT_FRAMESTATES || mode == TestMode.INLINED_WITHOUT_FRAMESTATES) {
          graph.clearAllStateAfter();
        }
        Debug.dump(graph, "after removal of framestates");

        new FloatingReadPhase().apply(graph);
        new RemoveValueProxyPhase().apply(graph);

        MidTierContext midContext =
            new MidTierContext(
                getProviders(),
                getTargetProvider(),
                OptimisticOptimizations.ALL,
                graph.getProfilingInfo());
        new GuardLoweringPhase().apply(graph, midContext);
        new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.MID_TIER)
            .apply(graph, midContext);
        new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.LOW_TIER)
            .apply(graph, midContext);

        SchedulePhase schedule = new SchedulePhase(schedulingStrategy);
        schedule.apply(graph);
        assertDeepEquals(1, graph.getNodes().filter(StartNode.class).count());
        return graph.getLastSchedule();
      }
    } catch (Throwable e) {
      throw Debug.handle(e);
    }
  }
  @SuppressWarnings("try")
  private void testImplicit(Integer i) {
    Assume.assumeTrue(config().useCompressedOops);

    Container c = new Container();
    c.i = i;

    try (OverrideScope s = OptionValue.override(GraalOptions.OptImplicitNullChecks, true)) {
      ResolvedJavaMethod method = getResolvedJavaMethod("testSnippet");
      Result expect = executeExpected(method, null, c);

      // make sure we don't get a profile that removes the implicit null check
      method.reprofile();

      Result actual = executeActual(method, null, c);
      assertEquals(expect, actual);
    }
  }
 @Override
 protected OverrideScope getOScope() {
   Map<OptionValue<?>, Object> mapping = new HashMap<>();
   mapping.put(MethodMetricsPrinter.Options.MethodMeterPrintAscii, true);
   return OptionValue.override(mapping);
 }