Skip to content

Commit c28d433

Browse files
committed
Update Cranelift to 0.113
1 parent 3f06952 commit c28d433

File tree

10 files changed

+77
-85
lines changed

10 files changed

+77
-85
lines changed

Cargo.lock

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

Cargo.toml

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

99
[dependencies]
1010
# These have to be in sync with each other
11-
# FIXME switch to native-arch instead of listing all archs on the next Cranelift update
12-
cranelift-codegen = { version = "0.112.0", default-features = false, features = ["std", "unwind", "x86", "arm64", "s390x", "riscv64"] }
13-
cranelift-frontend = { version = "0.112.0" }
14-
cranelift-module = { version = "0.112.0" }
15-
cranelift-native = { version = "0.112.0" }
16-
cranelift-jit = { version = "0.112.0", optional = true }
17-
cranelift-object = { version = "0.112.0" }
11+
cranelift-codegen = { version = "0.113.0", default-features = false, features = ["std", "unwind", "all-native-arch"] }
12+
cranelift-frontend = { version = "0.113.0" }
13+
cranelift-module = { version = "0.113.0" }
14+
cranelift-native = { version = "0.113.0" }
15+
cranelift-jit = { version = "0.113.0", optional = true }
16+
cranelift-object = { version = "0.113.0" }
1817
target-lexicon = "0.12.0"
19-
gimli = { version = "0.29", default-features = false, features = ["write"] }
18+
gimli = { version = "0.31", default-features = false, features = ["write"] }
2019
object = { version = "0.36", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
2120

2221
indexmap = "2.0.0"

src/abi/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
389389
let callee = with_no_trimmed_paths!(fx.tcx.def_path_str(def_id));
390390
fx.tcx.dcx().emit_err(CompilerBuiltinsCannotCall { caller, callee });
391391
} else {
392-
fx.bcx.ins().trap(TrapCode::User(0));
392+
fx.bcx.ins().trap(TrapCode::user(2).unwrap());
393393
return;
394394
}
395395
}
@@ -579,7 +579,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
579579
let ret_block = fx.get_block(dest);
580580
fx.bcx.ins().jump(ret_block, &[]);
581581
} else {
582-
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
582+
fx.bcx.ins().trap(TrapCode::user(1 /* unreachable */).unwrap());
583583
}
584584

585585
fn adjust_call_for_c_variadic<'tcx>(

src/base.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
294294
if arg_uninhabited {
295295
fx.bcx.append_block_params_for_function_params(fx.block_map[START_BLOCK]);
296296
fx.bcx.switch_to_block(fx.block_map[START_BLOCK]);
297-
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
297+
fx.bcx.ins().trap(TrapCode::user(1 /* unreachable */).unwrap());
298298
return;
299299
}
300300
fx.tcx
@@ -311,7 +311,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
311311
if !reachable_blocks.contains(bb) {
312312
// We want to skip this block, because it's not reachable. But we still create
313313
// the block so terminators in other blocks can reference it.
314-
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
314+
fx.bcx.ins().trap(TrapCode::user(1 /* unreachable */).unwrap());
315315
continue;
316316
}
317317

@@ -540,11 +540,11 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
540540
}
541541
TerminatorKind::UnwindResume => {
542542
// FIXME implement unwinding
543-
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
543+
fx.bcx.ins().trap(TrapCode::user(1 /* unreachable */).unwrap());
544544
}
545545
TerminatorKind::Unreachable => {
546546
fx.bcx.set_cold_block(block);
547-
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
547+
fx.bcx.ins().trap(TrapCode::user(1 /* unreachable */).unwrap());
548548
}
549549
TerminatorKind::Yield { .. }
550550
| TerminatorKind::FalseEdge { .. }
@@ -1082,7 +1082,7 @@ fn codegen_panic_inner<'tcx>(
10821082
let instance = Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx);
10831083

10841084
if is_call_from_compiler_builtins_to_upstream_monomorphization(fx.tcx, instance) {
1085-
fx.bcx.ins().trap(TrapCode::User(0));
1085+
fx.bcx.ins().trap(TrapCode::user(2).unwrap());
10861086
return;
10871087
}
10881088

@@ -1095,5 +1095,5 @@ fn codegen_panic_inner<'tcx>(
10951095
args,
10961096
);
10971097

1098-
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
1098+
fx.bcx.ins().trap(TrapCode::user(1 /* unreachable */).unwrap());
10991099
}

src/debuginfo/line_info.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ fn make_file_info(hash: SourceFileHash) -> Option<FileInfo> {
5050
if hash.kind == SourceFileHashAlgorithm::Md5 {
5151
let mut buf = [0u8; MD5_LEN];
5252
buf.copy_from_slice(hash.hash_bytes());
53-
Some(FileInfo { timestamp: 0, size: 0, md5: buf })
53+
Some(FileInfo {
54+
timestamp: 0,
55+
size: 0,
56+
md5: buf,
57+
source: None, // FIXME implement -Zembed-source
58+
})
5459
} else {
5560
None
5661
}

src/debuginfo/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,15 @@ impl DebugContext {
101101
None => (tcx.crate_name(LOCAL_CRATE).to_string(), None),
102102
};
103103

104+
let file_has_md5 = file_info.is_some();
104105
let mut line_program = LineProgram::new(
105106
encoding,
106107
LineEncoding::default(),
107108
LineString::new(comp_dir.as_bytes(), encoding, &mut dwarf.line_strings),
108109
LineString::new(name.as_bytes(), encoding, &mut dwarf.line_strings),
109110
file_info,
110111
);
111-
line_program.file_has_md5 = file_info.is_some();
112+
line_program.file_has_md5 = file_has_md5;
112113

113114
dwarf.unit.line_program = line_program;
114115

src/inline_asm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
4747
// asm!() by accident and breaks with the GNU assembler as well as global_asm!() for
4848
// the LLVM backend.
4949
if template.len() == 1 && template[0] == InlineAsmTemplatePiece::String("int $$0x29".into()) {
50-
fx.bcx.ins().trap(TrapCode::User(1));
50+
fx.bcx.ins().trap(TrapCode::user(2).unwrap());
5151
return;
5252
}
5353

@@ -137,7 +137,7 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
137137
fx.bcx.ins().jump(destination_block, &[]);
138138
}
139139
None => {
140-
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
140+
fx.bcx.ins().trap(TrapCode::user(0 /* unreachable */).unwrap());
141141
}
142142
}
143143
}

0 commit comments

Comments
 (0)