Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 02dec62

Browse files
committed
Update to Cranelift 0.100
This skips Cranelift 0.99 as it depends on an object version that is broken on macOS.
1 parent 9b855a9 commit 02dec62

File tree

6 files changed

+57
-75
lines changed

6 files changed

+57
-75
lines changed

Cargo.lock

Lines changed: 38 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ crate-type = ["dylib"]
88

99
[dependencies]
1010
# These have to be in sync with each other
11-
cranelift-codegen = { version = "0.98", features = ["unwind", "all-arch"] }
12-
cranelift-frontend = { version = "0.98" }
13-
cranelift-module = { version = "0.98" }
14-
cranelift-native = { version = "0.98" }
15-
cranelift-jit = { version = "0.98", optional = true }
16-
cranelift-object = { version = "0.98" }
11+
cranelift-codegen = { version = "0.100", features = ["unwind", "all-arch"] }
12+
cranelift-frontend = { version = "0.100" }
13+
cranelift-module = { version = "0.100" }
14+
cranelift-native = { version = "0.100" }
15+
cranelift-jit = { version = "0.100", optional = true }
16+
cranelift-object = { version = "0.100" }
1717
target-lexicon = "0.12.0"
18-
gimli = { version = "0.27.2", default-features = false, features = ["write"]}
19-
object = { version = "0.30.3", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
18+
gimli = { version = "0.28", default-features = false, features = ["write"]}
19+
object = { version = "0.32", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
2020

2121
indexmap = "2.0.0"
2222
libloading = { version = "0.7.3", optional = true }

src/cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ pub(crate) fn clif_int_or_float_cast(
129129
let (min, max) = match (to_ty, to_signed) {
130130
(types::I8, false) => (0, i64::from(u8::MAX)),
131131
(types::I16, false) => (0, i64::from(u16::MAX)),
132-
(types::I8, true) => (i64::from(i8::MIN), i64::from(i8::MAX)),
133-
(types::I16, true) => (i64::from(i16::MIN), i64::from(i16::MAX)),
132+
(types::I8, true) => (i64::from(i8::MIN as u32), i64::from(i8::MAX as u32)),
133+
(types::I16, true) => (i64::from(i16::MIN as u32), i64::from(i16::MAX as u32)),
134134
_ => unreachable!(),
135135
};
136136
let min_val = fx.bcx.ins().iconst(types::I32, min);

src/common.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ pub(crate) fn type_min_max_value(
203203
(types::I8, false) | (types::I16, false) | (types::I32, false) | (types::I64, false) => {
204204
0i64
205205
}
206-
(types::I8, true) => i64::from(i8::MIN),
207-
(types::I16, true) => i64::from(i16::MIN),
208-
(types::I32, true) => i64::from(i32::MIN),
206+
(types::I8, true) => i64::from(i8::MIN as u8),
207+
(types::I16, true) => i64::from(i16::MIN as u16),
208+
(types::I32, true) => i64::from(i32::MIN as u32),
209209
(types::I64, true) => i64::MIN,
210210
_ => unreachable!(),
211211
};
@@ -215,9 +215,9 @@ pub(crate) fn type_min_max_value(
215215
(types::I16, false) => i64::from(u16::MAX),
216216
(types::I32, false) => i64::from(u32::MAX),
217217
(types::I64, false) => u64::MAX as i64,
218-
(types::I8, true) => i64::from(i8::MAX),
219-
(types::I16, true) => i64::from(i16::MAX),
220-
(types::I32, true) => i64::from(i32::MAX),
218+
(types::I8, true) => i64::from(i8::MAX as u8),
219+
(types::I16, true) => i64::from(i16::MAX as u16),
220+
(types::I32, true) => i64::from(i32::MAX as u32),
221221
(types::I64, true) => i64::MAX,
222222
_ => unreachable!(),
223223
};

src/constant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub(crate) fn codegen_const_value<'tcx>(
9999
if fx.clif_type(layout.ty).is_some() {
100100
return CValue::const_val(fx, layout, int);
101101
} else {
102-
let raw_val = int.to_bits(int.size()).unwrap();
102+
let raw_val = int.size().truncate(int.to_bits(int.size()).unwrap());
103103
let val = match int.size().bytes() {
104104
1 => fx.bcx.ins().iconst(types::I8, raw_val as i64),
105105
2 => fx.bcx.ins().iconst(types::I16, raw_val as i64),

src/value_and_place.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ impl<'tcx> CValue<'tcx> {
309309
fx.bcx.ins().iconcat(lsb, msb)
310310
}
311311
ty::Bool | ty::Char | ty::Uint(_) | ty::Int(_) | ty::Ref(..) | ty::RawPtr(..) => {
312-
fx.bcx.ins().iconst(clif_ty, const_val.to_bits(layout.size).unwrap() as i64)
312+
let raw_val = const_val.size().truncate(const_val.to_bits(layout.size).unwrap());
313+
fx.bcx.ins().iconst(clif_ty, raw_val as i64)
313314
}
314315
ty::Float(FloatTy::F32) => {
315316
fx.bcx.ins().f32const(Ieee32::with_bits(u32::try_from(const_val).unwrap()))

0 commit comments

Comments
 (0)