diff --git a/nac3core/src/codegen/mod.rs b/nac3core/src/codegen/mod.rs index e74071bc..28b9a654 100644 --- a/nac3core/src/codegen/mod.rs +++ b/nac3core/src/codegen/mod.rs @@ -989,6 +989,17 @@ pub fn gen_func_impl< debug_info: (dibuilder, compile_unit, func_scope.as_debug_info_scope()), }; + let target_llvm_usize = context.ptr_sized_int_type( + ®istry.llvm_options.create_target_machine().map(|tm| tm.get_target_data()).unwrap(), + None, + ); + let generator_llvm_usize = generator.get_size_type(context); + assert_eq!( + generator_llvm_usize, + target_llvm_usize, + "CodeGenerator (size_t = {generator_llvm_usize}) is not compatible with CodeGen Target (size_t = {target_llvm_usize})", + ); + let loc = code_gen_context.debug_info.0.create_debug_location( context, row as u32, diff --git a/nac3core/src/codegen/test.rs b/nac3core/src/codegen/test.rs index 48bef5f2..6518d858 100644 --- a/nac3core/src/codegen/test.rs +++ b/nac3core/src/codegen/test.rs @@ -98,7 +98,7 @@ fn test_primitives() { let statements = parse_program(source, FileName::default()).unwrap(); let context = inkwell::context::Context::create(); - let composer = TopLevelComposer::new(Vec::new(), Vec::new(), ComposerConfig::default(), 32).0; + let composer = TopLevelComposer::new(Vec::new(), Vec::new(), ComposerConfig::default(), 64).0; let mut unifier = composer.unifier.clone(); let primitives = composer.primitives_ty; let top_level = Arc::new(composer.make_top_level_context()); @@ -108,7 +108,7 @@ fn test_primitives() { Arc::new(Resolver { id_to_type: HashMap::new(), id_to_def: RwLock::new(HashMap::new()) }) as Arc; - let threads = vec![DefaultCodeGenerator::new("test".into(), context.i32_type()).into()]; + let threads = vec![DefaultCodeGenerator::new("test".into(), context.i64_type()).into()]; let signature = FunSignature { args: vec![ FuncArg { @@ -262,7 +262,7 @@ fn test_simple_call() { let statements_2 = parse_program(source_2, FileName::default()).unwrap(); let context = inkwell::context::Context::create(); - let composer = TopLevelComposer::new(Vec::new(), Vec::new(), ComposerConfig::default(), 32).0; + let composer = TopLevelComposer::new(Vec::new(), Vec::new(), ComposerConfig::default(), 64).0; let mut unifier = composer.unifier.clone(); let primitives = composer.primitives_ty; let top_level = Arc::new(composer.make_top_level_context()); @@ -309,7 +309,7 @@ fn test_simple_call() { unreachable!() } - let threads = vec![DefaultCodeGenerator::new("test".into(), context.i32_type()).into()]; + let threads = vec![DefaultCodeGenerator::new("test".into(), context.i64_type()).into()]; let mut function_data = FunctionData { resolver: resolver.clone(), bound_variables: Vec::new(),