Mercurial > hg > truffle
changeset 18145:0e7455cb3004
Truffle: fixed remaining slow path name fragements.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 21 Oct 2014 20:33:04 +0200 |
parents | 70077134cabc |
children | 9db0af368bb4 |
files | graal/com.oracle.graal.truffle.test/sl/TestSlowPath01.sl graal/com.oracle.graal.truffle.test/sl/TestTruffleBoundary01.sl graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/SLTruffleGraalTestSuite.java graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/builtins/SLTestSlowPath01Builtin.java graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/builtins/SLTestTruffleBoundary01Builtin.java |
diffstat | 5 files changed, 84 insertions(+), 84 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle.test/sl/TestSlowPath01.sl Tue Oct 21 16:43:14 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -/* - * This test verifies that CallTargets cannot exceed the TruffleInliningMaxCallerSize limit when inlining. - */ - -function test1() { - testSlowPath01(); -} -function main() { - callUntilOptimized(test1); - assertTrue(isOptimized(test1), "inlinableFunction must be compiled properly"); -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.truffle.test/sl/TestTruffleBoundary01.sl Tue Oct 21 20:33:04 2014 +0200 @@ -0,0 +1,11 @@ +/* + * This test verifies that CallTargets cannot exceed the TruffleInliningMaxCallerSize limit when inlining. + */ + +function test1() { + testTruffleBoundary01(); +} +function main() { + callUntilOptimized(test1); + assertTrue(isOptimized(test1), "inlinableFunction must be compiled properly"); +}
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/SLTruffleGraalTestSuite.java Tue Oct 21 16:43:14 2014 +0200 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/SLTruffleGraalTestSuite.java Tue Oct 21 20:33:04 2014 +0200 @@ -51,7 +51,7 @@ SLTestRunner.installBuiltin(SLIsCompilationConstantBuiltinFactory.getInstance()); /* test specific builtins */ - SLTestRunner.installBuiltin(SLTestSlowPath01BuiltinFactory.getInstance()); + SLTestRunner.installBuiltin(SLTestTruffleBoundary01BuiltinFactory.getInstance()); } /*
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/builtins/SLTestSlowPath01Builtin.java Tue Oct 21 16:43:14 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.truffle.test.builtins; - -import java.util.concurrent.*; - -import com.oracle.truffle.api.*; -import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; -import com.oracle.truffle.api.dsl.*; -import com.oracle.truffle.api.nodes.*; -import com.oracle.truffle.sl.runtime.*; - -/** - * Just used in TestSlowPath01.sl. Verifies that all intrinsics have no effect inside of a @TruffleBoundary - * annotated method. - */ -@NodeInfo(shortName = "testSlowPath01") -public abstract class SLTestSlowPath01Builtin extends SLGraalRuntimeBuiltin { - - private static Object nonConstantValue = new Object(); - - @Specialization - @TruffleBoundary - public Object testSlowPath() { - CompilerAsserts.neverPartOfCompilation(); - CompilerAsserts.neverPartOfCompilation("Should never throw an exception when compiling."); - CompilerAsserts.compilationConstant(nonConstantValue); - CompilerDirectives.transferToInterpreter(); - CompilerDirectives.transferToInterpreterAndInvalidate(); - CompilerDirectives.bailout("Should not fail"); - if (CompilerDirectives.inCompiledCode()) { - throw new AssertionError(); - } - if (!CompilerDirectives.inInterpreter()) { - throw new AssertionError(); - } - try { - int result = (int) CompilerDirectives.interpreterOnly(new Callable<Object>() { - public Object call() throws Exception { - return 1; - } - }); - if (result != 1) { - throw new AssertionError(); - } - } catch (Exception e) { - throw new AssertionError(); - } - - return SLNull.SINGLETON; - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/builtins/SLTestTruffleBoundary01Builtin.java Tue Oct 21 20:33:04 2014 +0200 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.truffle.test.builtins; + +import java.util.concurrent.*; + +import com.oracle.truffle.api.*; +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.api.dsl.*; +import com.oracle.truffle.api.nodes.*; +import com.oracle.truffle.sl.runtime.*; + +/** + * Just used in TestSlowPath01.sl. Verifies that all intrinsics have no effect inside of a @TruffleBoundary + * annotated method. + */ +@NodeInfo(shortName = "testTruffleBoundary01") +public abstract class SLTestTruffleBoundary01Builtin extends SLGraalRuntimeBuiltin { + + private static Object nonConstantValue = new Object(); + + @Specialization + @TruffleBoundary + public Object testSlowPath() { + CompilerAsserts.neverPartOfCompilation(); + CompilerAsserts.neverPartOfCompilation("Should never throw an exception when compiling."); + CompilerAsserts.compilationConstant(nonConstantValue); + CompilerDirectives.transferToInterpreter(); + CompilerDirectives.transferToInterpreterAndInvalidate(); + CompilerDirectives.bailout("Should not fail"); + if (CompilerDirectives.inCompiledCode()) { + throw new AssertionError(); + } + if (!CompilerDirectives.inInterpreter()) { + throw new AssertionError(); + } + try { + int result = (int) CompilerDirectives.interpreterOnly(new Callable<Object>() { + public Object call() throws Exception { + return 1; + } + }); + if (result != 1) { + throw new AssertionError(); + } + } catch (Exception e) { + throw new AssertionError(); + } + + return SLNull.SINGLETON; + } +}