< prev index next >

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

Print this page




 115                 read.setGuard(AbstractBeginNode.prevBegin(read));
 116                 return true;
 117             }
 118         });
 119     }
 120 
 121     class InlineAll implements InlineInvokePlugin {
 122         @Override
 123         public InlineInfo shouldInlineInvoke(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args) {
 124             return createStandardInlineInfo(method);
 125         }
 126     }
 127 
 128     @Test
 129     @SuppressWarnings("try")
 130     public void test() {
 131         ResolvedJavaMethod testMethod = getResolvedJavaMethod(PEGraphDecoderTest.class, "doTest", Object.class);
 132         StructuredGraph targetGraph = null;
 133         DebugContext debug = getDebugContext();
 134         try (DebugContext.Scope scope = debug.scope("GraphPETest", testMethod)) {
 135             GraphBuilderConfiguration graphBuilderConfig = GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withEagerResolving(true);
 136             registerPlugins(graphBuilderConfig.getPlugins().getInvocationPlugins());
 137             targetGraph = new StructuredGraph.Builder(getInitialOptions(), debug, AllowAssumptions.YES).method(testMethod).build();
 138             CachingPEGraphDecoder decoder = new CachingPEGraphDecoder(getTarget().arch, targetGraph, getProviders(), graphBuilderConfig, OptimisticOptimizations.NONE, AllowAssumptions.YES,
 139                             null, null, new InlineInvokePlugin[]{new InlineAll()}, null, null);
 140 
 141             decoder.decode(testMethod);
 142             debug.dump(DebugContext.BASIC_LEVEL, targetGraph, "Target Graph");
 143             targetGraph.verify();
 144 
 145             PhaseContext context = new PhaseContext(getProviders());
 146             new CanonicalizerPhase().apply(targetGraph, context);
 147             targetGraph.verify();
 148 
 149         } catch (Throwable ex) {
 150             if (targetGraph != null) {
 151                 debug.dump(DebugContext.BASIC_LEVEL, targetGraph, ex.toString());
 152             }
 153             debug.handle(ex);
 154         }
 155     }
 156 }


 115                 read.setGuard(AbstractBeginNode.prevBegin(read));
 116                 return true;
 117             }
 118         });
 119     }
 120 
 121     class InlineAll implements InlineInvokePlugin {
 122         @Override
 123         public InlineInfo shouldInlineInvoke(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args) {
 124             return createStandardInlineInfo(method);
 125         }
 126     }
 127 
 128     @Test
 129     @SuppressWarnings("try")
 130     public void test() {
 131         ResolvedJavaMethod testMethod = getResolvedJavaMethod(PEGraphDecoderTest.class, "doTest", Object.class);
 132         StructuredGraph targetGraph = null;
 133         DebugContext debug = getDebugContext();
 134         try (DebugContext.Scope scope = debug.scope("GraphPETest", testMethod)) {
 135             GraphBuilderConfiguration graphBuilderConfig = GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withEagerResolving(true).withUnresolvedIsError(true);
 136             registerPlugins(graphBuilderConfig.getPlugins().getInvocationPlugins());
 137             targetGraph = new StructuredGraph.Builder(getInitialOptions(), debug, AllowAssumptions.YES).method(testMethod).build();
 138             CachingPEGraphDecoder decoder = new CachingPEGraphDecoder(getTarget().arch, targetGraph, getProviders(), graphBuilderConfig, OptimisticOptimizations.NONE, AllowAssumptions.YES,
 139                             null, null, new InlineInvokePlugin[]{new InlineAll()}, null, null, null);
 140 
 141             decoder.decode(testMethod);
 142             debug.dump(DebugContext.BASIC_LEVEL, targetGraph, "Target Graph");
 143             targetGraph.verify();
 144 
 145             PhaseContext context = new PhaseContext(getProviders());
 146             new CanonicalizerPhase().apply(targetGraph, context);
 147             targetGraph.verify();
 148 
 149         } catch (Throwable ex) {
 150             if (targetGraph != null) {
 151                 debug.dump(DebugContext.BASIC_LEVEL, targetGraph, ex.toString());
 152             }
 153             debug.handle(ex);
 154         }
 155     }
 156 }
< prev index next >