WIP
This commit is contained in:
parent
3e666af206
commit
07faed6779
|
@ -31,7 +31,7 @@ use crate::{symbol_resolver::InnerResolver, timeline::TimeFns};
|
|||
|
||||
use inkwell::types::BasicType;
|
||||
use itertools::Itertools;
|
||||
use nac3core::codegen::classes::{ArrayLikeIndexer, ArrayLikeValue, NDArrayType};
|
||||
use nac3core::codegen::classes::{ArrayLikeIndexer, ArrayLikeValue, ArraySliceValue, NDArrayType};
|
||||
use nac3core::codegen::llvm_intrinsics;
|
||||
use std::{
|
||||
collections::{hash_map::DefaultHasher, HashMap},
|
||||
|
@ -552,8 +552,18 @@ fn rpc_codegen_callback_fn<'ctx>(
|
|||
NDArrayType::new(generator, ctx.ctx, ctx.get_llvm_type(generator, elem_ty));
|
||||
let llvm_arg = NDArrayValue::from_ptr_val(arg.into_pointer_value(), size_type, None);
|
||||
|
||||
let llvm_usize_sizeof = llvm_arg_ty.size_type().size_of();
|
||||
let llvm_elem_sizeof = llvm_arg_ty.element_type().size_of().unwrap();
|
||||
let llvm_usize_sizeof = ctx
|
||||
.builder
|
||||
.build_int_truncate_or_bit_cast(llvm_arg_ty.size_type().size_of(), int32, "")
|
||||
.unwrap();
|
||||
let llvm_elem_sizeof = ctx
|
||||
.builder
|
||||
.build_int_truncate_or_bit_cast(
|
||||
llvm_arg_ty.element_type().size_of().unwrap(),
|
||||
int32,
|
||||
"",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let dims_buf_sz =
|
||||
ctx.builder.build_int_mul(llvm_arg.load_ndims(ctx), llvm_usize_sizeof, "").unwrap();
|
||||
|
@ -568,8 +578,8 @@ fn rpc_codegen_callback_fn<'ctx>(
|
|||
|
||||
let buffer_size = ctx.builder.build_int_add(dims_buf_sz, data_buf_sz, "").unwrap();
|
||||
|
||||
let buffer =
|
||||
generator.gen_array_var_alloc(ctx, int8.into(), buffer_size, None).unwrap();
|
||||
let buffer = ctx.builder.build_array_alloca(int8, buffer_size, "").unwrap();
|
||||
let buffer = ArraySliceValue::from_ptr_val(buffer, buffer_size, None);
|
||||
|
||||
llvm_intrinsics::call_memcpy_generic(
|
||||
ctx,
|
||||
|
|
Loading…
Reference in New Issue