# HG changeset patch # User Thomas Wuerthinger # Date 1366740952 -7200 # Node ID fe5bc02fcd19a70953f9c2e7d0ace4bef90e7c00 # Parent 4015295cc5f5823e081fab8c8cffedb63ff5e435 Replace TruffleIntrinsics.deoptimize() calls with CompilerDirectives.transferToInterpreter(). Remove obsolete TruffleIntrinsics class. diff -r 4015295cc5f5 -r fe5bc02fcd19 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/TruffleIntrinsics.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/TruffleIntrinsics.java Tue Apr 23 16:19:52 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2012, 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.truffle.api.intrinsics; - -/** - * Predefined Truffle intrinsics that allow direct influence of the generated machine code. - */ -public final class TruffleIntrinsics { - - /** - * Specifies that the compiler should put a deoptimization point at this position that will - * continue execution in the interpreter. Should be used to cut off cold paths that should not - * be part of the compiled machine code. - */ - public static void deoptimize() { - } - - /** - * Checks whether the Thread has been interrupted in the interpreter in order to avoid endless - * loops. The compiled code may choose a more efficient implementation. - */ - public static void checkThreadInterrupted() { - if (Thread.currentThread().isInterrupted()) { - throw new RuntimeException("Timeout"); - } - } - - public static void mustNotReachHere() { - } - - public static void interpreterOnly(Runnable runnable) { - runnable.run(); - } -} diff -r 4015295cc5f5 -r fe5bc02fcd19 graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleTypes.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleTypes.java Tue Apr 23 16:19:52 2013 +0200 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleTypes.java Tue Apr 23 20:15:52 2013 +0200 @@ -28,8 +28,8 @@ import javax.lang.model.type.*; import javax.tools.Diagnostic.*; +import com.oracle.truffle.api.*; import com.oracle.truffle.api.frame.*; -import com.oracle.truffle.api.intrinsics.*; import com.oracle.truffle.api.nodes.*; import com.oracle.truffle.api.nodes.Node.Child; import com.oracle.truffle.api.nodes.Node.Children; @@ -45,7 +45,7 @@ private final TypeMirror frame; private final DeclaredType childAnnotation; private final DeclaredType childrenAnnotation; - private final TypeMirror truffleIntrinsics; + private final TypeMirror compilerDirectives; private final List errors = new ArrayList<>(); @@ -56,7 +56,7 @@ frame = getRequired(context, VirtualFrame.class); childAnnotation = getRequired(context, Child.class); childrenAnnotation = getRequired(context, Children.class); - truffleIntrinsics = getRequired(context, TruffleIntrinsics.class); + compilerDirectives = getRequired(context, CompilerDirectives.class); } public boolean verify(ProcessorContext context, Element element, AnnotationMirror mirror) { @@ -79,8 +79,8 @@ return (DeclaredType) type; } - public TypeMirror getTruffleIntrinsics() { - return truffleIntrinsics; + public TypeMirror getCompilerDirectives() { + return compilerDirectives; } public TypeMirror getNode() { diff -r 4015295cc5f5 -r fe5bc02fcd19 graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java Tue Apr 23 16:19:52 2013 +0200 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java Tue Apr 23 20:15:52 2013 +0200 @@ -1477,7 +1477,7 @@ private CodeTree createDeoptimize(CodeTreeBuilder parent) { CodeTreeBuilder builder = new CodeTreeBuilder(parent); builder.startStatement(); - builder.startStaticCall(getContext().getTruffleTypes().getTruffleIntrinsics(), "deoptimize").end(); + builder.startStaticCall(getContext().getTruffleTypes().getCompilerDirectives(), "transferToInterpreter").end(); builder.end(); return builder.getRoot(); }