Update Cranelift
This commit is contained in:
parent
6b54b7c9f4
commit
bc555764bd
3 changed files with 49 additions and 57 deletions
57
Cargo.lock
generated
57
Cargo.lock
generated
|
|
@ -44,16 +44,16 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
|||
|
||||
[[package]]
|
||||
name = "cranelift-bforest"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#51f9ac2150bd880dc7b92952ba92e72ea3ab60b7"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#00abfcd943fdef8af5c8b2afed09e7ecef512b02"
|
||||
dependencies = [
|
||||
"cranelift-entity",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#51f9ac2150bd880dc7b92952ba92e72ea3ab60b7"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#00abfcd943fdef8af5c8b2afed09e7ecef512b02"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"cranelift-bforest",
|
||||
|
|
@ -70,8 +70,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-meta"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#51f9ac2150bd880dc7b92952ba92e72ea3ab60b7"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#00abfcd943fdef8af5c8b2afed09e7ecef512b02"
|
||||
dependencies = [
|
||||
"cranelift-codegen-shared",
|
||||
"cranelift-entity",
|
||||
|
|
@ -79,18 +79,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-shared"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#51f9ac2150bd880dc7b92952ba92e72ea3ab60b7"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#00abfcd943fdef8af5c8b2afed09e7ecef512b02"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-entity"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#51f9ac2150bd880dc7b92952ba92e72ea3ab60b7"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#00abfcd943fdef8af5c8b2afed09e7ecef512b02"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-frontend"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#51f9ac2150bd880dc7b92952ba92e72ea3ab60b7"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#00abfcd943fdef8af5c8b2afed09e7ecef512b02"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"log",
|
||||
|
|
@ -100,8 +100,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cranelift-module"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#51f9ac2150bd880dc7b92952ba92e72ea3ab60b7"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#00abfcd943fdef8af5c8b2afed09e7ecef512b02"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cranelift-codegen",
|
||||
|
|
@ -112,8 +112,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cranelift-native"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#51f9ac2150bd880dc7b92952ba92e72ea3ab60b7"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#00abfcd943fdef8af5c8b2afed09e7ecef512b02"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"raw-cpuid",
|
||||
|
|
@ -122,8 +122,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cranelift-object"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#51f9ac2150bd880dc7b92952ba92e72ea3ab60b7"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#00abfcd943fdef8af5c8b2afed09e7ecef512b02"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"cranelift-module",
|
||||
|
|
@ -133,8 +133,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cranelift-simplejit"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#51f9ac2150bd880dc7b92952ba92e72ea3ab60b7"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/bytecodealliance/wasmtime/#00abfcd943fdef8af5c8b2afed09e7ecef512b02"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"cranelift-module",
|
||||
|
|
@ -184,11 +184,10 @@ checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
|
|||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.20.0"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81dd6190aad0f05ddbbf3245c54ed14ca4aa6dd32f22312b70d8f168c3e3e633"
|
||||
checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"indexmap",
|
||||
]
|
||||
|
||||
|
|
@ -227,9 +226,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mach"
|
||||
version = "0.2.3"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1"
|
||||
checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
|
@ -277,9 +276,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regalloc"
|
||||
version = "0.0.24"
|
||||
version = "0.0.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5842bece8a4b1690ffa6d9d959081c1d5d851ee4337a36c0a121fafe8c16add2"
|
||||
checksum = "cca5b48c9db66c5ba084e4660b4c0cfe8b551a96074bc04b7c11de86ad0bf1f9"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rustc-hash",
|
||||
|
|
@ -288,9 +287,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "region"
|
||||
version = "2.1.2"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "448e868c6e4cfddfa49b6a72c95906c04e8547465e9536575b95c70a4044f856"
|
||||
checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ default-features = false
|
|||
features = ["read", "std", "write"] # We don't need WASM support
|
||||
|
||||
[dependencies.gimli]
|
||||
version = "0.20.0"
|
||||
version = "0.21.0"
|
||||
default-features = false
|
||||
features = ["write"] # We don't need read support
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ use cranelift_codegen::isa::TargetIsa;
|
|||
use cranelift_codegen::ValueLocRange;
|
||||
|
||||
use gimli::write::{
|
||||
self, Address, AttributeValue, DwarfUnit, Expression, LineProgram,
|
||||
LineString, Location, LocationList, Range, RangeList, UnitEntryId, Writer,
|
||||
Address, AttributeValue, DwarfUnit, Expression, LineProgram,
|
||||
LineString, Location, LocationList, Range, RangeList, UnitEntryId,
|
||||
};
|
||||
use gimli::{Encoding, Format, LineEncoding, RunTimeEndian, X86_64};
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ impl<'tcx> DebugContext<'tcx> {
|
|||
let type_entry = self.dwarf.unit.get_mut(type_id);
|
||||
|
||||
//type_entry.set(gimli::DW_AT_mutable, AttributeValue::Flag(mutbl == rustc_hir::Mutability::Mut));
|
||||
type_entry.set(gimli::DW_AT_type, AttributeValue::ThisUnitEntryRef(pointee));
|
||||
type_entry.set(gimli::DW_AT_type, AttributeValue::UnitRef(pointee));
|
||||
|
||||
type_id
|
||||
}
|
||||
|
|
@ -213,7 +213,7 @@ impl<'tcx> DebugContext<'tcx> {
|
|||
|
||||
field_entry.set(gimli::DW_AT_name, AttributeValue::String(field_def.ident.as_str().to_string().into_bytes()));
|
||||
field_entry.set(gimli::DW_AT_data_member_location, AttributeValue::Udata(field_offset.bytes()));
|
||||
field_entry.set(gimli::DW_AT_type, AttributeValue::ThisUnitEntryRef(field_type));
|
||||
field_entry.set(gimli::DW_AT_type, AttributeValue::UnitRef(field_type));
|
||||
}
|
||||
|
||||
type_id
|
||||
|
|
@ -291,7 +291,7 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
|||
let var_entry = self.debug_context.dwarf.unit.get_mut(var_id);
|
||||
|
||||
var_entry.set(gimli::DW_AT_name, AttributeValue::String(name.into_bytes()));
|
||||
var_entry.set(gimli::DW_AT_type, AttributeValue::ThisUnitEntryRef(dw_ty));
|
||||
var_entry.set(gimli::DW_AT_type, AttributeValue::UnitRef(dw_ty));
|
||||
|
||||
var_id
|
||||
}
|
||||
|
|
@ -341,15 +341,13 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
|
|||
let name = format!("{}{}", base_name, i);
|
||||
|
||||
let dw_ty = self.debug_context.dwarf_ty_for_clif_ty(param.value_type);
|
||||
let loc = Expression(
|
||||
translate_loc(isa, context.func.locations[val], &context.func.stack_slots).unwrap(),
|
||||
);
|
||||
let loc = translate_loc(isa, context.func.locations[val], &context.func.stack_slots).unwrap();
|
||||
|
||||
let arg_id = self.debug_context.dwarf.unit.add(self.entry_id, gimli::DW_TAG_formal_parameter);
|
||||
let var_entry = self.debug_context.dwarf.unit.get_mut(arg_id);
|
||||
|
||||
var_entry.set(gimli::DW_AT_name, AttributeValue::String(name.into_bytes()));
|
||||
var_entry.set(gimli::DW_AT_type, AttributeValue::ThisUnitEntryRef(dw_ty));
|
||||
var_entry.set(gimli::DW_AT_type, AttributeValue::UnitRef(dw_ty));
|
||||
var_entry.set(gimli::DW_AT_location, AttributeValue::Exprloc(loc));
|
||||
}
|
||||
|
||||
|
|
@ -413,9 +411,7 @@ fn place_location<'a, 'tcx>(
|
|||
symbol: func_debug_ctx.symbol,
|
||||
addend: i64::from(value_loc_range.end),
|
||||
},
|
||||
data: Expression(
|
||||
translate_loc(isa, value_loc_range.loc, &context.func.stack_slots).unwrap(),
|
||||
),
|
||||
data: translate_loc(isa, value_loc_range.loc, &context.func.stack_slots).unwrap(),
|
||||
})
|
||||
.collect(),
|
||||
);
|
||||
|
|
@ -425,40 +421,37 @@ fn place_location<'a, 'tcx>(
|
|||
} else {
|
||||
// FIXME set value labels for unused locals
|
||||
|
||||
AttributeValue::Exprloc(Expression(vec![]))
|
||||
AttributeValue::Exprloc(Expression::new())
|
||||
}
|
||||
}
|
||||
CPlaceInner::Addr(_, _) => {
|
||||
// FIXME implement this (used by arguments and returns)
|
||||
|
||||
AttributeValue::Exprloc(Expression(vec![]))
|
||||
AttributeValue::Exprloc(Expression::new())
|
||||
|
||||
// For PointerBase::Stack:
|
||||
//AttributeValue::Exprloc(Expression(translate_loc(ValueLoc::Stack(*stack_slot), &context.func.stack_slots).unwrap()))
|
||||
//AttributeValue::Exprloc(translate_loc(ValueLoc::Stack(*stack_slot), &context.func.stack_slots).unwrap())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Adapted from https://github.com/CraneStation/wasmtime/blob/5a1845b4caf7a5dba8eda1fef05213a532ed4259/crates/debug/src/transform/expression.rs#L59-L137
|
||||
fn translate_loc(isa: &dyn TargetIsa, loc: ValueLoc, stack_slots: &StackSlots) -> Option<Vec<u8>> {
|
||||
fn translate_loc(isa: &dyn TargetIsa, loc: ValueLoc, stack_slots: &StackSlots) -> Option<Expression> {
|
||||
match loc {
|
||||
ValueLoc::Reg(reg) => {
|
||||
let machine_reg = isa.map_dwarf_register(reg).unwrap();
|
||||
assert!(machine_reg <= 32); // FIXME
|
||||
Some(vec![gimli::constants::DW_OP_reg0.0 + machine_reg as u8])
|
||||
let mut expr = Expression::new();
|
||||
expr.op_reg(gimli::Register(machine_reg));
|
||||
Some(expr)
|
||||
}
|
||||
ValueLoc::Stack(ss) => {
|
||||
if let Some(ss_offset) = stack_slots[ss].offset {
|
||||
let endian = gimli::RunTimeEndian::Little;
|
||||
let mut writer = write::EndianVec::new(endian);
|
||||
writer
|
||||
.write_u8(gimli::constants::DW_OP_breg0.0 + X86_64::RBP.0 as u8)
|
||||
.expect("bp wr");
|
||||
writer.write_sleb128(ss_offset as i64 + 16).expect("ss wr");
|
||||
let buf = writer.into_vec();
|
||||
return Some(buf);
|
||||
let mut expr = Expression::new();
|
||||
expr.op_breg(X86_64::RBP, ss_offset as i64 + 16);
|
||||
Some(expr)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
None
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue