Skip to content

Commit 18de1b1

Browse files
authored
Merge pull request #1131 from bjorn3/abi_compat
Full abi compatibilty
2 parents 6a739b3 + 7fcf59f commit 18de1b1

17 files changed

+769
-574
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ object = { version = "0.22.0", default-features = false, features = ["std", "rea
2121
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
2222
indexmap = "1.0.2"
2323
libloading = { version = "0.6.0", optional = true }
24+
smallvec = "1.6.1"
2425

2526
# Uncomment to use local checkout of cranelift
2627
#[patch."https://github.com/bytecodealliance/wasmtime/"]

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2021-01-21
1+
nightly-2021-01-25

src/abi/comments.rs

+17-9
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
use std::borrow::Cow;
55

66
use rustc_middle::mir;
7+
use rustc_target::abi::call::PassMode;
78

89
use cranelift_codegen::entity::EntityRef;
910

10-
use crate::abi::pass_mode::*;
1111
use crate::prelude::*;
1212

1313
pub(super) fn add_args_header_comment(fx: &mut FunctionCx<'_, '_, impl Module>) {
@@ -21,9 +21,9 @@ pub(super) fn add_arg_comment<'tcx>(
2121
kind: &str,
2222
local: Option<mir::Local>,
2323
local_field: Option<usize>,
24-
params: EmptySinglePair<Value>,
25-
pass_mode: PassMode,
26-
ty: Ty<'tcx>,
24+
params: &[Value],
25+
arg_abi_mode: PassMode,
26+
arg_layout: TyAndLayout<'tcx>,
2727
) {
2828
let local = if let Some(local) = local {
2929
Cow::Owned(format!("{:?}", local))
@@ -37,20 +37,28 @@ pub(super) fn add_arg_comment<'tcx>(
3737
};
3838

3939
let params = match params {
40-
Empty => Cow::Borrowed("-"),
41-
Single(param) => Cow::Owned(format!("= {:?}", param)),
42-
Pair(param_a, param_b) => Cow::Owned(format!("= {:?}, {:?}", param_a, param_b)),
40+
[] => Cow::Borrowed("-"),
41+
[param] => Cow::Owned(format!("= {:?}", param)),
42+
[param_a, param_b] => Cow::Owned(format!("= {:?},{:?}", param_a, param_b)),
43+
params => Cow::Owned(format!(
44+
"= {}",
45+
params
46+
.iter()
47+
.map(ToString::to_string)
48+
.collect::<Vec<_>>()
49+
.join(",")
50+
)),
4351
};
4452

45-
let pass_mode = format!("{:?}", pass_mode);
53+
let pass_mode = format!("{:?}", arg_abi_mode);
4654
fx.add_global_comment(format!(
4755
"{kind:5}{local:>3}{local_field:<5} {params:10} {pass_mode:36} {ty:?}",
4856
kind = kind,
4957
local = local,
5058
local_field = local_field,
5159
params = params,
5260
pass_mode = pass_mode,
53-
ty = ty,
61+
ty = arg_layout.ty,
5462
));
5563
}
5664

0 commit comments

Comments
 (0)