Skip to content

Commit

Permalink
tenp
Browse files Browse the repository at this point in the history
  • Loading branch information
carbotaniuman committed Jun 15, 2022
1 parent 81a99a5 commit ee68602
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 149 deletions.
18 changes: 7 additions & 11 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,12 @@ pub struct ConcreteTag {
pub sb: SbTag,
}

// TODO: fix these by changing what gets stored in Pointer / removing transmutes as casts
// we can also make TagExtra Option<SbTag>, which lets us not have to store one enum variant

// #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
// static_assert_size!(Pointer<Tag>, 24);
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(Pointer<Tag>, 24);
// #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
// static_assert_size!(Pointer<Option<Tag>>, 24);
// #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
// static_assert_size!(ScalarMaybeUninit<Tag>, 32);
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(ScalarMaybeUninit<Tag>, 32);

impl Provenance for Tag {
/// We use absolute addresses in the `offset` of a `Pointer<Tag>`.
Expand Down Expand Up @@ -477,7 +474,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
type AllocExtra = AllocExtra;

type PointerTag = Tag;
type TagExtra = SbTag;
type TagExtra = Option<SbTag>;

type MemoryMap =
MonoHashMap<AllocId, (MemoryKind<MiriMemoryKind>, Allocation<Tag, Self::AllocExtra>)>;
Expand Down Expand Up @@ -688,7 +685,6 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
sb,
alloc_range(Size::from_bytes(0), size),
ecx.machine.stacked_borrows.as_ref().unwrap(),
ecx.machine.current_span(),
)?;
}
}
Expand All @@ -711,8 +707,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {

rel.map(|(alloc_id, size)| {
let sb = match ptr.provenance {
Tag::Concrete(ConcreteTag { sb, .. }) => sb,
Tag::Wildcard => SbTag::Unknown,
Tag::Concrete(ConcreteTag { sb, .. }) => Some(sb),
Tag::Wildcard => None,
};
(alloc_id, size, sb)
})
Expand Down
Loading

0 comments on commit ee68602

Please sign in to comment.