Search in sources :

Example 1 with AccessLocation

use of com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropAccessNode.AccessLocation in project sulong by graalvm.

the class LLVMInteropWriteNode method doUnknownType.

@Fallback
void doUnknownType(@SuppressWarnings("unused") LLVMInteropType.Structured type, TruffleObject foreign, long offset, Object value) {
    if (getSize == null) {
        CompilerDirectives.transferToInterpreterAndInvalidate();
        getSize = insert(GetValueSizeNodeGen.create());
    }
    // type unknown: fall back to "array of unknown value type"
    int elementAccessSize = getSize.execute(value);
    AccessLocation location = new AccessLocation(foreign, Long.divideUnsigned(offset, elementAccessSize), null);
    write(location, value);
}
Also used : AccessLocation(com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropAccessNode.AccessLocation) Fallback(com.oracle.truffle.api.dsl.Fallback)

Example 2 with AccessLocation

use of com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropAccessNode.AccessLocation in project sulong by graalvm.

the class LLVMInteropWriteNode method doKnownType.

@Specialization(guards = "type != null")
void doKnownType(LLVMInteropType.Structured type, TruffleObject foreign, long offset, Object value, @Cached("create()") LLVMInteropAccessNode access) {
    AccessLocation location = access.execute(type, foreign, offset);
    write(location, value);
}
Also used : AccessLocation(com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropAccessNode.AccessLocation) Specialization(com.oracle.truffle.api.dsl.Specialization)

Aggregations

AccessLocation (com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropAccessNode.AccessLocation)2 Fallback (com.oracle.truffle.api.dsl.Fallback)1 Specialization (com.oracle.truffle.api.dsl.Specialization)1