< prev index next >

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

Print this page




  72     public void runTooManyExits() throws Exception {
  73         checkForBailout("tooManyExits");
  74     }
  75 
  76     @Test
  77     public void runTooFewExitsExceptional() throws Exception {
  78         checkForBailout("tooFewExitsExceptional");
  79     }
  80 
  81     @Test
  82     public void runTooManyExitsExceptional() throws Exception {
  83         checkForBailout("tooManyExitsExceptional");
  84     }
  85 
  86     private void checkForBailout(String name) throws ClassNotFoundException {
  87         ResolvedJavaMethod method = getResolvedJavaMethod(LOADER.findClass(INNER_CLASS_NAME), name);
  88         try {
  89             OptionValues options = getInitialOptions();
  90             StructuredGraph graph = new StructuredGraph.Builder(options, getDebugContext(options)).method(method).build();
  91             Plugins plugins = new Plugins(new InvocationPlugins());
  92             GraphBuilderConfiguration graphBuilderConfig = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true);
  93             OptimisticOptimizations optimisticOpts = OptimisticOptimizations.NONE;
  94 
  95             GraphBuilderPhase.Instance graphBuilder = new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), null, null, graphBuilderConfig, optimisticOpts, null);
  96             graphBuilder.apply(graph);
  97         } catch (BailoutException e) {
  98             if (e.getMessage().contains("unbalanced monitors")) {
  99                 return;
 100             }
 101             throw e;
 102         }
 103         assertTrue("should have bailed out", false);
 104     }
 105 
 106     static class Gen implements Opcodes {
 107 
 108     // @formatter:off
 109     // Template class used with Bytecode Outline to generate ASM code
 110     //    public static class UnbalancedMonitors {
 111     //
 112     //        public UnbalancedMonitors() {




  72     public void runTooManyExits() throws Exception {
  73         checkForBailout("tooManyExits");
  74     }
  75 
  76     @Test
  77     public void runTooFewExitsExceptional() throws Exception {
  78         checkForBailout("tooFewExitsExceptional");
  79     }
  80 
  81     @Test
  82     public void runTooManyExitsExceptional() throws Exception {
  83         checkForBailout("tooManyExitsExceptional");
  84     }
  85 
  86     private void checkForBailout(String name) throws ClassNotFoundException {
  87         ResolvedJavaMethod method = getResolvedJavaMethod(LOADER.findClass(INNER_CLASS_NAME), name);
  88         try {
  89             OptionValues options = getInitialOptions();
  90             StructuredGraph graph = new StructuredGraph.Builder(options, getDebugContext(options)).method(method).build();
  91             Plugins plugins = new Plugins(new InvocationPlugins());
  92             GraphBuilderConfiguration graphBuilderConfig = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true).withUnresolvedIsError(true);
  93             OptimisticOptimizations optimisticOpts = OptimisticOptimizations.NONE;
  94 
  95             GraphBuilderPhase.Instance graphBuilder = new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), null, null, graphBuilderConfig, optimisticOpts, null);
  96             graphBuilder.apply(graph);
  97         } catch (BailoutException e) {
  98             if (e.getMessage().contains("unbalanced monitors")) {
  99                 return;
 100             }
 101             throw e;
 102         }
 103         assertTrue("should have bailed out", false);
 104     }
 105 
 106     static class Gen implements Opcodes {
 107 
 108     // @formatter:off
 109     // Template class used with Bytecode Outline to generate ASM code
 110     //    public static class UnbalancedMonitors {
 111     //
 112     //        public UnbalancedMonitors() {


< prev index next >