コード例 #1
0
def pq_read_string_parallel_lower(context, builder, sig, args):
    typ = sig.return_type
    dtype = StringArrayPayloadType()
    meminfo, data_pointer = construct_string_array(context, builder)
    string_array = cgutils.create_struct_proxy(dtype)(context, builder)
    string_array.size = args[3]
    fnty = lir.FunctionType(lir.IntType(32), [
        lir.IntType(8).as_pointer(),
        lir.IntType(64),
        lir.IntType(8).as_pointer().as_pointer(),
        lir.IntType(8).as_pointer().as_pointer(),
        lir.IntType(64),
        lir.IntType(64)
    ])

    fn = builder.module.get_or_insert_function(fnty,
                                               name="pq_read_string_parallel")
    res = builder.call(fn, [
        args[0], args[1],
        string_array._get_ptr_by_name('offsets'),
        string_array._get_ptr_by_name('data'), args[2], args[3]
    ])

    builder.store(string_array._getvalue(), data_pointer)
    inst_struct = context.make_helper(builder, typ)
    inst_struct.meminfo = meminfo
    ret = inst_struct._getvalue()
    return impl_ret_new_ref(context, builder, typ, ret)
コード例 #2
0
def pq_read_string_parallel_lower(context, builder, sig, args):
    typ = sig.return_type
    dtype = StringArrayPayloadType()
    meminfo, meminfo_data_ptr = construct_string_array(context, builder)
    str_arr_payload = cgutils.create_struct_proxy(dtype)(context, builder)
    string_array = context.make_helper(builder, typ)
    string_array.num_items = args[3]

    fnty = lir.FunctionType(lir.IntType(32),
                            [lir.IntType(8).as_pointer(), lir.IntType(64),
                             lir.IntType(32).as_pointer().as_pointer(),
                             lir.IntType(8).as_pointer().as_pointer(),
                             lir.IntType(8).as_pointer().as_pointer(),
                             lir.IntType(64), lir.IntType(64)])

    fn = builder.module.get_or_insert_function(
        fnty, name="pq_read_string_parallel")
    res = builder.call(fn, [args[0], args[1],
                            str_arr_payload._get_ptr_by_name('offsets'),
                            str_arr_payload._get_ptr_by_name('data'),
                            str_arr_payload._get_ptr_by_name('null_bitmap'),
                            args[2],
                            args[3]])

    builder.store(str_arr_payload._getvalue(), meminfo_data_ptr)

    string_array.meminfo = meminfo
    string_array.offsets = str_arr_payload.offsets
    string_array.data = str_arr_payload.data
    string_array.null_bitmap = str_arr_payload.null_bitmap
    string_array.num_total_chars = builder.zext(builder.load(
        builder.gep(string_array.offsets, [string_array.num_items])), lir.IntType(64))
    ret = string_array._getvalue()
    return impl_ret_new_ref(context, builder, typ, ret)
コード例 #3
0
ファイル: xenon_ext.py プロジェクト: raonyguimaraes/hpat
    def codegen(context, builder, sig, args):
        typ = sig.return_type
        dtype = StringArrayPayloadType()
        meminfo, meminfo_data_ptr = construct_string_array(context, builder)
        str_arr_payload = cgutils.create_struct_proxy(dtype)(context, builder)
        string_array = context.make_helper(builder, typ)
        string_array.num_items = args[3]

        ctinfo = context.make_helper(builder, schema_arr_tp, value=args[4])
        fnty = lir.FunctionType(lir.VoidType(), [
            lir.IntType(8).as_pointer(),
            lir.IntType(8).as_pointer(),
            lir.IntType(64),
            lir.IntType(8).as_pointer().as_pointer(),
            lir.IntType(8).as_pointer().as_pointer(),
            lir.IntType(64).as_pointer()
        ])

        fn = builder.module.get_or_insert_function(fnty,
                                                   name="c_read_xenon_col_str")
        res = builder.call(fn, [
            args[0], args[1], args[2],
            str_arr_payload._get_ptr_by_name('offsets'),
            str_arr_payload._get_ptr_by_name('data'), ctinfo.data
        ])
        builder.store(str_arr_payload._getvalue(), meminfo_data_ptr)

        string_array.meminfo = meminfo
        string_array.offsets = str_arr_payload.offsets
        string_array.data = str_arr_payload.data
        string_array.num_total_chars = builder.zext(
            builder.load(
                builder.gep(string_array.offsets, [string_array.num_items])),
            lir.IntType(64))
        ret = string_array._getvalue()
        return impl_ret_new_ref(context, builder, typ, ret)