use of com.oracle.truffle.llvm.nodes.intrinsics.interop.LLVMPolyglotBoxedPredicate.IsBoolean in project sulong by graalvm.
the class NFIIntrinsicsProvider method registerTruffleIntrinsics.
protected void registerTruffleIntrinsics(NodeFactory nodeFactory) {
LLVMNativeIntrinsicFactory polyglotImport = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_import", LLVMPolyglotImportNodeGen.create(LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_import", polyglotImport);
factories.put("@truffle_import", polyglotImport);
factories.put("@truffle_import_cached", polyglotImport);
factories.put("@polyglot_export", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_export", LLVMPolyglotExportNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@polyglot_eval", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_eval", LLVMPolyglotEval.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
//
factories.put("@polyglot_is_value", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_is_value", LLVMPolyglotIsValueNodeGen.create(LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_is_number", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_is_number", LLVMPolyglotBoxedPredicateNodeGen.create(new IsNumber(), LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_is_boolean", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_is_boolean", LLVMPolyglotBoxedPredicateNodeGen.create(new IsBoolean(), LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_is_string", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_is_string", LLVMPolyglotBoxedPredicateNodeGen.create(new IsString(), LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_fits_in_i8", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_fits_in_i8", LLVMPolyglotBoxedPredicateNodeGen.create(FitsInI8NodeGen.create(), LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_fits_in_i16", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_fits_in_i16", LLVMPolyglotBoxedPredicateNodeGen.create(FitsInI16NodeGen.create(), LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_fits_in_i32", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_fits_in_i32", LLVMPolyglotBoxedPredicateNodeGen.create(FitsInI32NodeGen.create(), LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_fits_in_i64", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_fits_in_i64", LLVMPolyglotBoxedPredicateNodeGen.create(FitsInI64NodeGen.create(), LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_fits_in_float", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_fits_in_float", LLVMPolyglotBoxedPredicateNodeGen.create(FitsInFloatNodeGen.create(), LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_fits_in_double", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_fits_in_double", LLVMPolyglotBoxedPredicateNodeGen.create(FitsInDoubleNodeGen.create(), LLVMArgNodeGen.create(1)));
}
});
LLVMNativeIntrinsicFactory polyglotPutMember = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_put_member", LLVMTruffleWriteToNameNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
};
factories.put("@polyglot_put_member", polyglotPutMember);
factories.put("@truffle_write", polyglotPutMember);
factories.put("@truffle_write_i", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_i", LLVMTruffleWriteToNameNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
factories.put("@truffle_write_l", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_l", LLVMTruffleWriteToNameNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
factories.put("@truffle_write_c", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_c", LLVMTruffleWriteToNameNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
factories.put("@truffle_write_f", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_f", LLVMTruffleWriteToNameNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
factories.put("@truffle_write_d", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("truffle_write_d", LLVMTruffleWriteToNameNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
factories.put("@truffle_write_b", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_b", LLVMTruffleWriteToNameNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
LLVMNativeIntrinsicFactory polyglotSetArrayElement = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_set_array_element", LLVMTruffleWriteToIndexNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
};
factories.put("@polyglot_set_array_element", polyglotSetArrayElement);
factories.put("@truffle_write_idx", polyglotSetArrayElement);
factories.put("@truffle_write_idx_i", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_idx_i", LLVMTruffleWriteToIndexNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
factories.put("@truffle_write_idx_l", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_idx_l", LLVMTruffleWriteToIndexNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
factories.put("@truffle_write_idx_c", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_idx_c", LLVMTruffleWriteToIndexNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
factories.put("@truffle_write_idx_f", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_idx_f", LLVMTruffleWriteToIndexNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
factories.put("@truffle_write_idx_d", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_idx_d", LLVMTruffleWriteToIndexNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
factories.put("@truffle_write_idx_b", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_write_idx_b", LLVMTruffleWriteToIndexNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
LLVMNativeIntrinsicFactory polyglotGetMember = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_get_member", LLVMTruffleReadFromNameNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.POINTER), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
};
factories.put("@polyglot_get_member", polyglotGetMember);
factories.put("@truffle_read", polyglotGetMember);
factories.put("@truffle_read_i", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_i", LLVMTruffleReadFromNameNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I32), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_l", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_l", LLVMTruffleReadFromNameNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I64), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_c", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_c", LLVMTruffleReadFromNameNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I8), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_f", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_f", LLVMTruffleReadFromNameNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.FLOAT), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_d", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_d", LLVMTruffleReadFromNameNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.DOUBLE), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_b", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_b", LLVMTruffleReadFromNameNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I1), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
LLVMNativeIntrinsicFactory polyglotGetArrayElement = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_get_array_element", LLVMTruffleReadFromIndexNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.POINTER), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
};
factories.put("@polyglot_get_array_element", polyglotGetArrayElement);
factories.put("@truffle_read_idx", polyglotGetArrayElement);
factories.put("@truffle_read_idx_i", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_idx_i", LLVMTruffleReadFromIndexNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I32), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_idx_l", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_idx_l", LLVMTruffleReadFromIndexNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I64), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_idx_c", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_idx_c", LLVMTruffleReadFromIndexNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I8), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_idx_f", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_idx_f", LLVMTruffleReadFromIndexNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.FLOAT), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_idx_d", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_idx_d", LLVMTruffleReadFromIndexNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.DOUBLE), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_idx_b", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_idx_b", LLVMTruffleReadFromIndexNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I1), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
LLVMNativeIntrinsicFactory polyglotAsI8 = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_as_i8", LLVMTruffleUnboxNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I8), LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_as_i8", polyglotAsI8);
factories.put("@truffle_unbox_c", polyglotAsI8);
LLVMNativeIntrinsicFactory polyglotAsI16 = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_as_i16", LLVMTruffleUnboxNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I16), LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_as_i16", polyglotAsI16);
LLVMNativeIntrinsicFactory polyglotAsI32 = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_as_i32", LLVMTruffleUnboxNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I32), LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_as_i32", polyglotAsI32);
factories.put("@truffle_unbox_i", polyglotAsI32);
LLVMNativeIntrinsicFactory polyglotAsI64 = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_as_i64", LLVMTruffleUnboxNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I64), LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_as_i64", polyglotAsI64);
factories.put("@truffle_unbox_l", polyglotAsI64);
LLVMNativeIntrinsicFactory polyglotAsFloat = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_as_float", LLVMTruffleUnboxNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.FLOAT), LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_as_float", polyglotAsFloat);
factories.put("@truffle_unbox_f", polyglotAsFloat);
LLVMNativeIntrinsicFactory polyglotAsDouble = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_as_double", LLVMTruffleUnboxNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.DOUBLE), LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_as_double", polyglotAsDouble);
factories.put("@truffle_unbox_d", polyglotAsDouble);
LLVMNativeIntrinsicFactory polyglotAsBoolean = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_as_boolean", LLVMTruffleUnboxNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I1), LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_as_boolean", polyglotAsBoolean);
factories.put("@truffle_unbox_b", polyglotAsBoolean);
//
LLVMNativeIntrinsicFactory polyglotInvoke = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_invoke", LLVMTruffleInvokeNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.POINTER), argumentsArray(3, type.getArgumentTypes().length - 3), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
};
factories.put("@polyglot_invoke", polyglotInvoke);
factories.put("@truffle_invoke", polyglotInvoke);
factories.put("@truffle_invoke_i", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_invoke_i", LLVMTruffleInvokeNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I32), argumentsArray(3, type.getArgumentTypes().length - 3), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_invoke_l", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_invoke_l", LLVMTruffleInvokeNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I64), argumentsArray(3, type.getArgumentTypes().length - 3), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_invoke_c", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_invoke_c", LLVMTruffleInvokeNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I8), argumentsArray(3, type.getArgumentTypes().length - 3), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_invoke_f", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_invoke_f", LLVMTruffleInvokeNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.FLOAT), argumentsArray(3, type.getArgumentTypes().length - 3), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_invoke_d", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_invoke_d", LLVMTruffleInvokeNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.DOUBLE), argumentsArray(3, type.getArgumentTypes().length - 3), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_invoke_b", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_invoke_b", LLVMTruffleInvokeNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I1), argumentsArray(3, type.getArgumentTypes().length - 3), LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
//
factories.put("@truffle_execute", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_execute", LLVMTruffleExecuteNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.POINTER), argumentsArray(2, type.getArgumentTypes().length - 2), LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_execute_i", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_execute_i", LLVMTruffleExecuteNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I32), argumentsArray(2, type.getArgumentTypes().length - 2), LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_execute_l", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_execute_l", LLVMTruffleExecuteNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I64), argumentsArray(2, type.getArgumentTypes().length - 2), LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_execute_c", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_execute_c", LLVMTruffleExecuteNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I8), argumentsArray(2, type.getArgumentTypes().length - 2), LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_execute_f", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_execute_f", LLVMTruffleExecuteNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.FLOAT), argumentsArray(2, type.getArgumentTypes().length - 2), LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_execute_d", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_execute_d", LLVMTruffleExecuteNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.DOUBLE), argumentsArray(2, type.getArgumentTypes().length - 2), LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_execute_b", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_execute_b", LLVMTruffleExecuteNodeGen.create(ForeignToLLVM.create(ForeignToLLVMType.I1), argumentsArray(2, type.getArgumentTypes().length - 2), LLVMArgNodeGen.create(1)));
}
});
//
factories.put("@truffle_address_to_function", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_address_to_function", LLVMTruffleAddressToFunctionNodeGen.create(LLVMArgNodeGen.create(1)));
}
});
LLVMNativeIntrinsicFactory polyglotCanExecute = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_can_execute", LLVMTruffleIsExecutableNodeGen.create(LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_can_execute", polyglotCanExecute);
factories.put("@truffle_is_executable", polyglotCanExecute);
LLVMNativeIntrinsicFactory polyglotIsNull = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_is_null", LLVMTruffleIsNullNodeGen.create(LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_is_null", polyglotIsNull);
factories.put("@truffle_is_null", polyglotIsNull);
LLVMNativeIntrinsicFactory polyglotHasArrayElements = new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_has_array_elements", LLVMTruffleHasSizeNodeGen.create(LLVMArgNodeGen.create(1)));
}
};
factories.put("@polyglot_has_array_elements", polyglotHasArrayElements);
factories.put("@truffle_has_size", polyglotHasArrayElements);
factories.put("@polyglot_has_members", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_has_members", LLVMTruffleHasKeysNodeGen.create(LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_is_boxed", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_is_boxed", LLVMTruffleIsBoxedNodeGen.create(LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_get_array_size", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_get_array_size", LLVMTruffleGetSizeNodeGen.create(ForeignToLLVMType.I64, LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_get_size", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_get_size", LLVMTruffleGetSizeNodeGen.create(ForeignToLLVMType.I32, LLVMArgNodeGen.create(1)));
}
});
//
factories.put("@polyglot_get_string_size", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_get_string_size", LLVMPolyglotGetStringSizeNodeGen.create(LLVMArgNodeGen.create(1)));
}
});
factories.put("@polyglot_as_string", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_as_string", LLVMPolyglotAsString.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3), LLVMArgNodeGen.create(4)));
}
});
factories.put("@polyglot_from_string", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_from_string", LLVMPolyglotFromString.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@polyglot_from_string_n", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@polyglot_from_string", LLVMPolyglotFromString.createN(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
//
factories.put("@truffle_read_string", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_string", LLVMTruffleReadStringNodeGen.create(LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_read_n_string", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_n_string", LLVMTruffleReadNStringNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_read_bytes", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_bytes", LLVMTruffleReadBytesNodeGen.create(LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_read_n_bytes", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_read_n_bytes", LLVMTruffleReadNBytesNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_string_to_cstr", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_string_to_cstr", LLVMTruffleStringAsCStringNodeGen.create(nodeFactory.createAllocateString(), LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_free_cstr", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_free_cstr", LLVMTruffleFreeCStringNodeGen.create(LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_is_truffle_object", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_is_truffle_object", LLVMTruffleIsTruffleObjectNodeGen.create(LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_sulong_function_to_native_pointer", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_sulong_function_to_native_pointer", LLVMSulongFunctionToNativePointerNodeGen.create(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@truffle_load_library", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_load_library", LLVMLoadLibraryNodeGen.create(LLVMArgNodeGen.create(1)));
}
});
factories.put("@truffle_polyglot_eval", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@truffle_polyglot_eval", LLVMPolyglotEval.createLegacy(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
//
factories.put("@__polyglot_as_typed", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@__polyglot_as_typed", LLVMPolyglotAsTyped.createStruct(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@__polyglot_as_typed_array", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@__polyglot_as_typed_array", LLVMPolyglotAsTyped.createArray(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@__polyglot_from_typed", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@__polyglot_from_typed", LLVMPolyglotFromTyped.createStruct(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2)));
}
});
factories.put("@__polyglot_from_typed_array", new LLVMNativeIntrinsicFactory(true, true) {
@Override
protected RootCallTarget generate(FunctionType type) {
return wrap("@__polyglot_from_typed_array", LLVMPolyglotFromTyped.createArray(LLVMArgNodeGen.create(1), LLVMArgNodeGen.create(2), LLVMArgNodeGen.create(3)));
}
});
}
Aggregations