diff options
| author | Ralf Jung <post@ralfj.de> | 2022-04-17 18:07:19 -0400 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-04-17 20:52:30 -0400 |
| commit | 989e7479d9cbd285c8104a5bbd9159ff2d66188f (patch) | |
| tree | 1fc0e683db2426f19269481f20213639688e328f | |
| parent | 5640304c63c5c77b721424be88791503a0e0ea3d (diff) | |
| download | rust-989e7479d9cbd285c8104a5bbd9159ff2d66188f.tar.gz rust-989e7479d9cbd285c8104a5bbd9159ff2d66188f.zip | |
interpret: more debug logging for read_scalar and write_scalar
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/memory.rs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index a165fa23f30..6504624ad67 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -877,9 +877,17 @@ impl<'tcx, 'a, Tag: Provenance, Extra> AllocRefMut<'a, 'tcx, Tag, Extra> { range: AllocRange, val: ScalarMaybeUninit<Tag>, ) -> InterpResult<'tcx> { + let range = self.range.subrange(range); + debug!( + "write_scalar in {} at {:#x}, size {}: {:?}", + self.alloc_id, + range.start.bytes(), + range.size.bytes(), + val + ); Ok(self .alloc - .write_scalar(&self.tcx, self.range.subrange(range), val) + .write_scalar(&self.tcx, range, val) .map_err(|e| e.to_interp_error(self.alloc_id))?) } @@ -899,10 +907,19 @@ impl<'tcx, 'a, Tag: Provenance, Extra> AllocRefMut<'a, 'tcx, Tag, Extra> { impl<'tcx, 'a, Tag: Provenance, Extra> AllocRef<'a, 'tcx, Tag, Extra> { pub fn read_scalar(&self, range: AllocRange) -> InterpResult<'tcx, ScalarMaybeUninit<Tag>> { - Ok(self + let range = self.range.subrange(range); + let res = self .alloc - .read_scalar(&self.tcx, self.range.subrange(range)) - .map_err(|e| e.to_interp_error(self.alloc_id))?) + .read_scalar(&self.tcx, range) + .map_err(|e| e.to_interp_error(self.alloc_id))?; + debug!( + "read_scalar in {} at {:#x}, size {}: {:?}", + self.alloc_id, + range.start.bytes(), + range.size.bytes(), + res + ); + Ok(res) } pub fn read_ptr_sized(&self, offset: Size) -> InterpResult<'tcx, ScalarMaybeUninit<Tag>> { |
