Java Code Examples for com.oracle.truffle.api.CompilerAsserts#neverPartOfCompilation()

The following examples show how to use com.oracle.truffle.api.CompilerAsserts#neverPartOfCompilation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapArgObject.java    From grcuda with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@ExportMessage
@TruffleBoundary
Object execute(Object[] arguments) throws UnsupportedMessageException, UnsupportedTypeException, ArityException {
    if (value instanceof MapArgObjectMember) {
        MapArgObjectMember member = (MapArgObjectMember) value;
        if (MAP.equals(member.name)) {
            checkArity(arguments, 1);
            return new MapArgObject(member.parent).map(arguments[0]);
        } else if (SHRED.equals(member.name)) {
            checkArity(arguments, 0);
            CompilerAsserts.neverPartOfCompilation();
            return new MapArgObject(member.parent).shred();
        } else if (DESCRIBE.equals(member.name)) {
            checkArity(arguments, 0);
            CompilerAsserts.neverPartOfCompilation();
            return new MapArgObject(member.parent).describe();
        } else if (BIND.equals(member.name)) {
            checkArity(arguments, 3);
            return member.parent.bind(arguments[0], arguments[1], arguments[2]);
        }
    }
    CompilerDirectives.transferToInterpreter();
    throw UnsupportedMessageException.create();
}
 
Example 2
Source File: SlotLocation.java    From trufflesqueak with MIT License 5 votes vote down vote up
@Override
public void write(final AbstractPointersObject object, final Object value) throws IllegalWriteException {
    CompilerAsserts.neverPartOfCompilation();
    if (value instanceof Boolean) {
        setMask(object);
        UnsafeUtils.putBoolAt(object, address, (boolean) value);
    } else {
        transferToInterpreterAndThrowIllegalWriteException();
    }
}
 
Example 3
Source File: BitBltPlugin.java    From trufflesqueak with MIT License 5 votes vote down vote up
private static void respecializeArrayToLongOrPrimFail(final ArrayObject array) {
    CompilerAsserts.neverPartOfCompilation();
    final Object[] values = ArrayObjectToObjectArrayCopyNode.getUncached().execute(array);
    final long[] longs = new long[values.length];
    try {
        for (int i = 0; i < values.length; i++) {
            longs[i] = ((Number) values[i]).longValue();
        }
    } catch (final ClassCastException e) {
        throw PrimitiveFailed.GENERIC_ERROR;
    }
    array.setStorage(longs);
}
 
Example 4
Source File: ObjectLayouts.java    From trufflesqueak with MIT License 5 votes vote down vote up
public static String getClassComment(final ClassObject squeakClass) {
    CompilerAsserts.neverPartOfCompilation("For instrumentation access only.");
    final AbstractSqueakObject organization = squeakClass.getOrganization();
    if (organization == NilObject.SINGLETON) {
        return null;
    }
    final AbstractSqueakObjectWithClassAndHash classComment = (AbstractSqueakObjectWithClassAndHash) ((VariablePointersObject) organization).instVarAt0Slow(CLASS_ORGANIZER.CLASS_COMMENT);
    final NativeObject string = (NativeObject) classComment.send("string");
    return string.asStringUnsafe();
}
 
Example 5
Source File: CUBLASRegistry.java    From grcuda with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static void checkCUBLASReturnCode(Object result, String... function) {
    CompilerAsserts.neverPartOfCompilation();
    int returnCode;
    try {
        returnCode = InteropLibrary.getFactory().getUncached().asInt(result);
    } catch (UnsupportedMessageException e) {
        throw new GrCUDAInternalException("expected return code as Integer object in " + function + ", got " + result.getClass().getName());
    }
    if (returnCode != 0) {
        throw new GrCUDAException(returnCode, cublasReturnCodeToString(returnCode), function);
    }
}
 
Example 6
Source File: SlotLocation.java    From trufflesqueak with MIT License 5 votes vote down vote up
@Override
public void write(final AbstractPointersObject object, final Object value) throws IllegalWriteException {
    CompilerAsserts.neverPartOfCompilation();
    if (canStore(value)) {
        setMask(object);
        UnsafeUtils.putLongAt(object, address, (long) value);
    } else {
        transferToInterpreterAndThrowIllegalWriteException();
    }
}
 
Example 7
Source File: NVRuntimeCompiler.java    From grcuda with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static NVRTCResult toNVRTCResult(Object result) {
    CompilerAsserts.neverPartOfCompilation();
    if (!(result instanceof Integer)) {
        throw new GrCUDAInternalException(
                        "expected return code as Integer object for nvrtcResult, got " +
                                        result.getClass().getName());
    }
    Integer returnCode = (Integer) result;
    for (NVRTCResult r : NVRTCResult.values()) {
        if (r.errorCode == returnCode) {
            return r;
        }
    }
    return NVRTCResult.NVRTC_UNKNOWN_CODE;
}
 
Example 8
Source File: SlotLocation.java    From trufflesqueak with MIT License 5 votes vote down vote up
@Override
public void write(final AbstractPointersObject object, final Object value) throws IllegalWriteException {
    CompilerAsserts.neverPartOfCompilation();
    if (canStore(value)) {
        setMask(object);
        UnsafeUtils.putDoubleIntoLongs(object.primitiveExtension, index, (double) value);
    } else {
        transferToInterpreterAndThrowIllegalWriteException();
    }
}
 
Example 9
Source File: SlotLocation.java    From trufflesqueak with MIT License 5 votes vote down vote up
@Override
public Object read(final AbstractPointersObject object) {
    CompilerAsserts.neverPartOfCompilation();
    if (isSet(object)) {
        return UnsafeUtils.getBoolAt(object, address);
    } else {
        return NilObject.SINGLETON;
    }
}
 
Example 10
Source File: SlotLocation.java    From trufflesqueak with MIT License 5 votes vote down vote up
@Override
public Object read(final AbstractPointersObject object) {
    CompilerAsserts.neverPartOfCompilation();
    if (isSet(object)) {
        return UnsafeUtils.getLongAt(object, address);
    } else {
        return NilObject.SINGLETON;
    }
}
 
Example 11
Source File: MapArgObject.java    From grcuda with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public MapArgObject shred() {
    CompilerAsserts.neverPartOfCompilation();
    return new MapArgObject(new MapArgObjectShred(value));
}
 
Example 12
Source File: ExecuteContextNode.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public String toString() {
    CompilerAsserts.neverPartOfCompilation();
    return code.toString();
}
 
Example 13
Source File: PushBytecodes.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public String toString() {
    CompilerAsserts.neverPartOfCompilation();
    return "self";
}
 
Example 14
Source File: EnterCodeNode.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public String toString() {
    CompilerAsserts.neverPartOfCompilation();
    return code.toString();
}
 
Example 15
Source File: PushBytecodes.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public String toString() {
    CompilerAsserts.neverPartOfCompilation();
    return "pushTemp: " + tempIndex;
}
 
Example 16
Source File: Returns.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public String toString() {
    CompilerAsserts.neverPartOfCompilation();
    return "TLR (value: " + returnValue + ")";
}
 
Example 17
Source File: JumpBytecodes.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public String toString() {
    CompilerAsserts.neverPartOfCompilation();
    return "jumpTo: " + offset;
}
 
Example 18
Source File: PushBytecodes.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public String toString() {
    CompilerAsserts.neverPartOfCompilation();
    return "pushTemp: " + indexInArray + " inVectorAt: " + indexOfArray;
}
 
Example 19
Source File: PushBytecodes.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public String toString() {
    CompilerAsserts.neverPartOfCompilation();
    return "pushConstant: " + constant.toString();
}
 
Example 20
Source File: AbstractSqueakObjectWithHash.java    From trufflesqueak with MIT License 4 votes vote down vote up
@Override
public int getNumSlots() {
    CompilerAsserts.neverPartOfCompilation();
    return size();
}