10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.core.test.ea; 24 25 import org.junit.Test; 26 27 import org.graalvm.compiler.api.directives.GraalDirectives; 28 import org.graalvm.compiler.code.SourceStackTraceBailoutException; 29 import org.graalvm.compiler.core.test.GraalCompilerTest; 30 31 public class PEAAssertionsTest extends GraalCompilerTest { 32 33 public static Object field; 34 35 public static void snippet1(int i) { 36 Integer object = new Integer(i); 37 GraalDirectives.ensureVirtualized(object); 38 } 39 40 @Test 41 public void test1() { 42 test("snippet1", 1); 43 } 44 45 public static void snippet2(int i) { 46 Integer object = new Integer(i); 47 GraalDirectives.ensureVirtualized(object); 48 field = object; // assert here 49 } 50 51 @Test(expected = SourceStackTraceBailoutException.class) | 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.core.test.ea; 24 25 import org.junit.Test; 26 27 import org.graalvm.compiler.api.directives.GraalDirectives; 28 import org.graalvm.compiler.code.SourceStackTraceBailoutException; 29 import org.graalvm.compiler.core.test.GraalCompilerTest; 30 import org.graalvm.compiler.phases.OptimisticOptimizations; 31 import org.graalvm.compiler.phases.OptimisticOptimizations.Optimization; 32 import org.graalvm.compiler.phases.tiers.HighTierContext; 33 34 public class PEAAssertionsTest extends GraalCompilerTest { 35 36 /** 37 * These tests assume all code paths are reachable so disable profile based dead code removal. 38 */ 39 @Override 40 protected HighTierContext getDefaultHighTierContext() { 41 return new HighTierContext(getProviders(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL.remove(Optimization.RemoveNeverExecutedCode)); 42 } 43 44 public static Object field; 45 46 public static void snippet1(int i) { 47 Integer object = new Integer(i); 48 GraalDirectives.ensureVirtualized(object); 49 } 50 51 @Test 52 public void test1() { 53 test("snippet1", 1); 54 } 55 56 public static void snippet2(int i) { 57 Integer object = new Integer(i); 58 GraalDirectives.ensureVirtualized(object); 59 field = object; // assert here 60 } 61 62 @Test(expected = SourceStackTraceBailoutException.class) |