diff --git a/compiler/builtins/bitcode/src/list.zig b/compiler/builtins/bitcode/src/list.zig index 9b0144aca8..2f9077180f 100644 --- a/compiler/builtins/bitcode/src/list.zig +++ b/compiler/builtins/bitcode/src/list.zig @@ -975,7 +975,6 @@ pub fn listRange(width: utils.IntWidth, low: Opaque, high: Opaque) callconv(.C) .I32 => helper1(i32, low, high), .I64 => helper1(i64, low, high), .I128 => helper1(i128, low, high), - .Usize => helper1(usize, low, high), }; } diff --git a/compiler/builtins/bitcode/src/utils.zig b/compiler/builtins/bitcode/src/utils.zig index 25f057961c..ab2ea26171 100644 --- a/compiler/builtins/bitcode/src/utils.zig +++ b/compiler/builtins/bitcode/src/utils.zig @@ -92,17 +92,16 @@ pub const REFCOUNT_ONE_ISIZE: isize = std.math.minInt(isize); pub const REFCOUNT_ONE: usize = @bitCast(usize, REFCOUNT_ONE_ISIZE); pub const IntWidth = enum(u8) { - U8, - U16, - U32, - U64, - U128, - I8, - I16, - I32, - I64, - I128, - Usize, + U8 = 0, + U16 = 1, + U32 = 2, + U64 = 3, + U128 = 4, + I8 = 5, + I16 = 6, + I32 = 7, + I64 = 8, + I128 = 9, }; pub fn decrefC( diff --git a/compiler/builtins/src/bitcode.rs b/compiler/builtins/src/bitcode.rs index 7c24347d62..afffd31dd9 100644 --- a/compiler/builtins/src/bitcode.rs +++ b/compiler/builtins/src/bitcode.rs @@ -60,8 +60,6 @@ impl FloatWidth { pub const fn try_from_symbol(symbol: Symbol) -> Option { match symbol { - Symbol::NUM_FLOAT => Some(FloatWidth::F64), - Symbol::NUM_F64 | Symbol::NUM_BINARY64 | Symbol::NUM_AT_BINARY64 => { Some(FloatWidth::F64) } @@ -124,7 +122,6 @@ impl IntWidth { pub const fn try_from_symbol(symbol: Symbol) -> Option { match symbol { - Symbol::NUM_INT => Some(IntWidth::I64), Symbol::NUM_I128 | Symbol::NUM_SIGNED128 | Symbol::NUM_AT_SIGNED128 => { Some(IntWidth::I128) } diff --git a/compiler/mono/src/ir.rs b/compiler/mono/src/ir.rs index ec7d45d21d..21e11940c8 100644 --- a/compiler/mono/src/ir.rs +++ b/compiler/mono/src/ir.rs @@ -7982,7 +7982,7 @@ pub fn num_argument_to_int_or_float( Symbol::NUM_NAT | Symbol::NUM_NATURAL | Symbol::NUM_AT_NATURAL => { let int_width = match ptr_bytes { 4 => IntWidth::U32, - 8 => IntWidth::U32, + 8 => IntWidth::U64, _ => panic!("unsupported word size"), }; diff --git a/compiler/mono/src/layout.rs b/compiler/mono/src/layout.rs index 68fcc1dab1..4497786886 100644 --- a/compiler/mono/src/layout.rs +++ b/compiler/mono/src/layout.rs @@ -749,14 +749,12 @@ impl<'a> Layout<'a> { } Structure(flat_type) => layout_from_flat_type(env, flat_type), - Alias(symbol, args, _) => { + Alias(symbol, _args, actual_var) => { if let Some(int_width) = IntWidth::try_from_symbol(symbol) { - debug_assert!(args.is_empty()); return Ok(Layout::Builtin(Builtin::Int(int_width))); } if let Some(float_width) = FloatWidth::try_from_symbol(symbol) { - debug_assert!(args.is_empty()); return Ok(Layout::Builtin(Builtin::Float(float_width))); } @@ -769,7 +767,7 @@ impl<'a> Layout<'a> { return Ok(Layout::usize(env.ptr_bytes)) } - _ => Self::from_var(env, var), + _ => Self::from_var(env, actual_var), } } @@ -1124,7 +1122,7 @@ impl<'a> Layout<'a> { pub fn usize(ptr_bytes: u32) -> Layout<'a> { match ptr_bytes { 4 => Self::u32(), - 8 => Self::u32(), + 8 => Self::u64(), _ => panic!("width of usize {} not supported", ptr_bytes), } } @@ -1176,6 +1174,10 @@ impl<'a> Layout<'a> { pub fn default_integer() -> Layout<'a> { Layout::i64() } + + pub fn default_float() -> Layout<'a> { + Layout::f64() + } } impl<'a> Builtin<'a> { diff --git a/compiler/test_mono/generated/if_guard_bind_variable_false.txt b/compiler/test_mono/generated/if_guard_bind_variable_false.txt index 36630718ca..1bb0f10960 100644 --- a/compiler/test_mono/generated/if_guard_bind_variable_false.txt +++ b/compiler/test_mono/generated/if_guard_bind_variable_false.txt @@ -1,4 +1,4 @@ -procedure Bool.5 (#Attr.2, #Attr.3): +procedure Bool.7 (#Attr.2, #Attr.3): let Test.11 = lowlevel Eq #Attr.2 #Attr.3; ret Test.11; @@ -13,7 +13,7 @@ procedure Test.1 (Test.3): ret Test.12; in let Test.10 = 5i64; - let Test.9 = CallByName Bool.5 Test.6 Test.10; + let Test.9 = CallByName Bool.7 Test.6 Test.10; jump Test.8 Test.9; procedure Test.0 ():