use of com.oracle.truffle.nfi.types.NativeSimpleType in project graal by oracle.
the class ImplicitConvertNFITest method data.
@Parameters(name = "{0}, ({3}) {1}")
public static Collection<Object[]> data() {
ArrayList<Object[]> ret = new ArrayList<>();
for (NativeSimpleType type : NumericNFITest.NUMERIC_TYPES) {
for (Object value : NUMERIC_VALUES) {
long numericValue = 0;
if (value instanceof Number) {
numericValue = ((Number) value).longValue();
} else if (value instanceof Character) {
numericValue = (Character) value;
} else if (value instanceof Boolean) {
numericValue = (Boolean) value ? 1 : 0;
}
ret.add(new Object[] { type, value, numericValue, value.getClass() });
}
}
return ret;
}
use of com.oracle.truffle.nfi.types.NativeSimpleType in project graal by oracle.
the class NFIInitialization method initializeNativeSimpleType.
@CEntryPoint
@CEntryPointOptions(publishAs = Publish.NotPublished, include = CEntryPointOptions.NotIncludedAutomatically.class)
static void initializeNativeSimpleType(@SuppressWarnings("unused") IsolateThread thread, NativeTruffleContext ctx, CCharPointer typeName, ffi_type ffiType) {
NativeSimpleType simpleType = NativeSimpleType.valueOf(CTypeConversion.toJavaString(typeName));
int size = (int) ffiType.size().rawValue();
int alignment = ffiType.alignment();
TruffleNFISupport support = ImageSingletons.lookup(TruffleNFISupport.class);
Target_com_oracle_truffle_nfi_impl_NFIContext context = support.resolveContextHandle(ctx.contextHandle());
context.initializeSimpleType(simpleType, size, alignment, ffiType.rawValue());
}
Aggregations