mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Fix layout of simd types and respect align in mir interpreter
This commit is contained in:
parent
15a0da6f30
commit
6f7452882a
6 changed files with 189 additions and 22 deletions
|
@ -180,9 +180,16 @@ impl MemoryMap {
|
|||
/// allocator function as `f` and it will return a mapping of old addresses to new addresses.
|
||||
fn transform_addresses(
|
||||
&self,
|
||||
mut f: impl FnMut(&[u8]) -> Result<usize, MirEvalError>,
|
||||
mut f: impl FnMut(&[u8], usize) -> Result<usize, MirEvalError>,
|
||||
) -> Result<HashMap<usize, usize>, MirEvalError> {
|
||||
self.memory.iter().map(|x| Ok((*x.0, f(x.1)?))).collect()
|
||||
self.memory
|
||||
.iter()
|
||||
.map(|x| {
|
||||
let addr = *x.0;
|
||||
let align = if addr == 0 { 64 } else { (addr - (addr & (addr - 1))).min(64) };
|
||||
Ok((addr, f(x.1, align)?))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get<'a>(&'a self, addr: usize, size: usize) -> Option<&'a [u8]> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue