windows fix getScalarUnsafe, run gen_str tests

This commit is contained in:
Luke Boswell 2023-09-12 22:14:45 +10:00 committed by Folkert
parent 446cff6157
commit dd766686d1
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 20 additions and 9 deletions

View file

@ -59,6 +59,11 @@ jobs:
- name: Test setjmp/longjmp logic - name: Test setjmp/longjmp logic
run: cargo test-gen-dev --locked --release nat_alias && cargo test-gen-dev --locked --release a_crash run: cargo test-gen-dev --locked --release nat_alias && cargo test-gen-dev --locked --release a_crash
- name: Run gen tests
run: cargo test-gen-llvm --locked --release gen_str
- name: Actually run the tests. - name: Actually run the tests.
run: cargo test --locked --release -p roc_ident -p roc_region -p roc_collections -p roc_can -p roc_types -p roc_solve -p roc_mono -p roc_gen_dev -p roc_gen_wasm -p roc_serialize -p roc_editor -p roc_linker -p roc_cli run: cargo test --locked --release -p roc_ident -p roc_region -p roc_collections -p roc_can -p roc_types -p roc_solve -p roc_mono -p roc_gen_dev -p roc_gen_wasm -p roc_serialize -p roc_editor -p roc_linker -p roc_cli

View file

@ -1,7 +1,7 @@
use inkwell::{ use inkwell::{
attributes::{Attribute, AttributeLoc}, attributes::{Attribute, AttributeLoc},
module::Linkage, module::Linkage,
types::{BasicType, IntType}, types::{BasicType, BasicTypeEnum, IntType},
values::{ values::{
BasicValue, BasicValueEnum, FloatValue, FunctionValue, InstructionOpcode, IntValue, BasicValue, BasicValueEnum, FloatValue, FunctionValue, InstructionOpcode, IntValue,
PointerValue, StructValue, PointerValue, StructValue,
@ -513,12 +513,18 @@ pub(crate) fn run_low_level<'a, 'ctx>(
use roc_target::OperatingSystem::*; use roc_target::OperatingSystem::*;
match env.target_info.operating_system { match env.target_info.operating_system {
Windows => { Windows => {
let return_type = env.context.struct_type( let zig_return_type = env
&[env.ptr_int().into(), env.context.i32_type().into()], .module
false, .get_function(bitcode::STR_GET_SCALAR_UNSAFE)
); .unwrap()
.get_type()
.get_param_types()[0]
.into_pointer_type()
.get_element_type();
let result = env.builder.build_alloca(return_type, "result"); let result = env
.builder
.build_alloca(BasicTypeEnum::try_from(zig_return_type).unwrap(), "result");
call_void_bitcode_fn( call_void_bitcode_fn(
env, env,
@ -526,19 +532,19 @@ pub(crate) fn run_low_level<'a, 'ctx>(
bitcode::STR_GET_SCALAR_UNSAFE, bitcode::STR_GET_SCALAR_UNSAFE,
); );
let return_type = basic_type_from_layout( let roc_return_type = basic_type_from_layout(
env, env,
layout_interner, layout_interner,
layout_interner.get_repr(layout), layout_interner.get_repr(layout),
); );
let cast_result = env.builder.build_pointer_cast( let cast_result = env.builder.build_pointer_cast(
result, result,
return_type.ptr_type(AddressSpace::default()), roc_return_type.ptr_type(AddressSpace::default()),
"cast", "cast",
); );
env.builder env.builder
.new_build_load(return_type, cast_result, "load_result") .new_build_load(roc_return_type, cast_result, "load_result")
} }
Unix => { Unix => {
let result = call_str_bitcode_fn( let result = call_str_bitcode_fn(