Search in sources :

Example 21 with TruffleBoundary

use of com.oracle.truffle.api.CompilerDirectives.TruffleBoundary in project graal by oracle.

the class SLDisableSplittingBuiltin method disableSplitting.

@Specialization
@TruffleBoundary
public SLFunction disableSplitting(SLFunction function) {
    OptimizedCallTarget target = (OptimizedCallTarget) function.getCallTarget();
    ((SLRootNode) target.getRootNode()).setCloningAllowed(false);
    return function;
}
Also used : OptimizedCallTarget(org.graalvm.compiler.truffle.runtime.OptimizedCallTarget) SLRootNode(com.oracle.truffle.sl.nodes.SLRootNode) Specialization(com.oracle.truffle.api.dsl.Specialization) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 22 with TruffleBoundary

use of com.oracle.truffle.api.CompilerDirectives.TruffleBoundary in project sulong by graalvm.

the class LLVMInfo method getpid.

@TruffleBoundary
public static long getpid() {
    LLVMProcessStat stat = getstat();
    if (stat != null) {
        return stat.getPid();
    }
    String info = java.lang.management.ManagementFactory.getRuntimeMXBean().getName();
    return Long.parseLong(info.split("@")[0]);
}
Also used : LLVMString(com.oracle.truffle.llvm.nodes.asm.support.LLVMString) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 23 with TruffleBoundary

use of com.oracle.truffle.api.CompilerDirectives.TruffleBoundary in project sulong by graalvm.

the class LLVMNativeDispatchNode method identityFunction.

@TruffleBoundary
protected TruffleObject identityFunction() {
    LLVMContext context = getContextReference().get();
    NFIContextExtension nfiContextExtension = context.getContextExtension(NFIContextExtension.class);
    String signature;
    try {
        signature = nfiContextExtension.getNativeSignature(type, LLVMCallNode.USER_ARGUMENT_OFFSET);
    } catch (UnsupportedNativeTypeException e) {
        throw new IllegalStateException(e);
    }
    return nfiContextExtension.getNativeFunction(context, "@identity", String.format("(POINTER):%s", signature));
}
Also used : LLVMContext(com.oracle.truffle.llvm.runtime.LLVMContext) UnsupportedNativeTypeException(com.oracle.truffle.llvm.runtime.NFIContextExtension.UnsupportedNativeTypeException) NFIContextExtension(com.oracle.truffle.llvm.runtime.NFIContextExtension) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 24 with TruffleBoundary

use of com.oracle.truffle.api.CompilerDirectives.TruffleBoundary in project sulong by graalvm.

the class LongDivision method divs128by64.

@TruffleBoundary
public static Result divs128by64(long a1, long a0, long b) {
    if (a1 == 0 && a0 > 0) {
        return new Result(a0 / b, a0 % b);
    }
    BigInteger x = s128(a1, a0);
    BigInteger y = BigInteger.valueOf(b);
    BigInteger[] result = x.divideAndRemainder(y);
    BigInteger q = result[0];
    BigInteger r = result[1];
    if (q.bitCount() > 64) {
        return Result.OVERFLOW;
    } else {
        return new Result(q.longValue(), r.longValue());
    }
}
Also used : BigInteger(java.math.BigInteger) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 25 with TruffleBoundary

use of com.oracle.truffle.api.CompilerDirectives.TruffleBoundary in project sulong by graalvm.

the class LLVMPrintStackTrace method doOp.

@TruffleBoundary
@Specialization
protected Object doOp() {
    SulongStackTrace trace = getStackTrace("__sulong_print_stacktrace");
    printCStackTrace(trace);
    return null;
}
Also used : SulongStackTrace(com.oracle.truffle.llvm.runtime.SulongStackTrace) Specialization(com.oracle.truffle.api.dsl.Specialization) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Aggregations

TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)49 RootNode (com.oracle.truffle.api.nodes.RootNode)6 Property (com.oracle.truffle.api.object.Property)6 Specialization (com.oracle.truffle.api.dsl.Specialization)5 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)5 BigInteger (java.math.BigInteger)4 Node (com.oracle.truffle.api.nodes.Node)3 SourceSection (com.oracle.truffle.api.source.SourceSection)3 ByteBuffer (java.nio.ByteBuffer)3 Substitute (com.oracle.svm.core.annotate.Substitute)2 FrameInstance (com.oracle.truffle.api.frame.FrameInstance)2 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)2 NodeVisitor (com.oracle.truffle.api.nodes.NodeVisitor)2 Source (com.oracle.truffle.api.source.Source)2 LLVMContext (com.oracle.truffle.llvm.runtime.LLVMContext)2 SLRootNode (com.oracle.truffle.sl.nodes.SLRootNode)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Assumption (com.oracle.truffle.api.Assumption)1 RootCallTarget (com.oracle.truffle.api.RootCallTarget)1