Revert "WIP fix for zig functions returning Bool (strEqual)"

This reverts commit 09b01893c6.
This commit is contained in:
Folkert 2023-04-08 16:11:12 +02:00
parent 09b01893c6
commit 9dd69f6f9c
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
7 changed files with 12 additions and 51 deletions

View file

@ -141,7 +141,6 @@ comptime {
exportStrFn(str.strJoinWithC, "joinWith");
exportStrFn(str.strNumberOfBytes, "number_of_bytes");
exportStrFn(str.strEqual, "equal");
exportStrFn(str.strEqualU64, "equalU64");
exportStrFn(str.substringUnsafe, "substring_unsafe");
exportStrFn(str.getUnsafe, "get_unsafe");
exportStrFn(str.reserve, "reserve");

View file

@ -571,16 +571,6 @@ pub fn strEqual(self: RocStr, other: RocStr) callconv(.C) bool {
return self.eq(other);
}
// Str.equalU64
pub fn strEqualU64(self: RocStr, other: RocStr) callconv(.C) u64 {
// required by the dev backend, which does not currently correctly handle C functions returning bools
if (strEqual(self, other)) {
return 1;
} else {
return 0;
}
}
// Str.numberOfBytes
pub fn strNumberOfBytes(string: RocStr) callconv(.C) usize {
return string.len();

View file

@ -319,7 +319,6 @@ pub const STR_TO_INT: IntrinsicName = int_intrinsic!("roc_builtins.str.to_int");
pub const STR_TO_FLOAT: IntrinsicName = float_intrinsic!("roc_builtins.str.to_float");
pub const STR_TO_DECIMAL: &str = "roc_builtins.str.to_decimal";
pub const STR_EQUAL: &str = "roc_builtins.str.equal";
pub const STR_EQUAL_U64: &str = "roc_builtins.str.equalU64";
pub const STR_SUBSTRING_UNSAFE: &str = "roc_builtins.str.substring_unsafe";
pub const STR_TO_UTF8: &str = "roc_builtins.str.to_utf8";
pub const STR_FROM_UTF8_RANGE: &str = "roc_builtins.str.from_utf8_range";

View file

@ -1201,7 +1201,7 @@ impl<
ASM::eq_reg64_reg64_reg64(&mut self.buf, dst_reg, src1_reg, src2_reg);
}
Layout::STR => {
// use a zig call. This is a bit weird because the dev backend does not handle
// use a zig call
self.build_fn_call(
dst,
bitcode::STR_EQUAL.to_string(),

View file

@ -349,16 +349,10 @@ impl<
self.free_reference(sym);
reg
}
Stack(Complex { size, base_offset }) => {
if size <= 8 {
let reg = self.get_general_reg(buf);
ASM::mov_reg64_base32(buf, reg, base_offset);
reg
} else {
internal_error!(
"Cannot load large values (size {size}) into general registers: {sym:?}",
)
}
Stack(Complex { size, .. }) => {
internal_error!(
"Cannot load large values (size {size}) into general registers: {sym:?}",
)
}
NoData => {
internal_error!("Cannot load no data into general registers: {}", sym)
@ -477,14 +471,10 @@ impl<
ASM::movzx_reg64_base32(buf, reg, *base_offset, *size as u8)
}
}
Stack(Complex { size, base_offset }) => {
if *size <= 8 {
ASM::mov_reg64_base32(buf, reg, *base_offset);
} else {
internal_error!(
"Cannot load large values (size {size}) into general registers: {sym:?}",
)
}
Stack(Complex { size, .. }) => {
internal_error!(
"Cannot load large values (size {size}) into general registers: {sym:?}",
)
}
NoData => {
internal_error!("Cannot load no data into general registers: {:?}", sym)

View file

@ -1371,7 +1371,7 @@ fn issue_2445() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm"))]
fn issue_2458() {
assert_evals_to!(
indoc!(
@ -2010,7 +2010,7 @@ fn unify_types_with_fixed_fixpoints_outside_fixing_region() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn lambda_set_with_imported_toplevels_issue_4733() {
assert_evals_to!(
indoc!(
@ -2032,23 +2032,6 @@ fn lambda_set_with_imported_toplevels_issue_4733() {
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn fooba() {
assert_evals_to!(
indoc!(
r#"
app "test" provides [main] to "./platform"
main : Bool
main = "*" == "*"
"#
),
1,
u64
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn non_unary_union_with_lambda_set_with_imported_toplevels_issue_4733() {

View file

@ -210,7 +210,7 @@ pub fn helper(
let builtins_host_tempfile =
roc_bitcode::host_tempfile().expect("failed to write host builtins object to tempfile");
if true {
if false {
std::fs::copy(&app_o_file, "/tmp/app.o").unwrap();
}