Skip to content

Commit

Permalink
add environ scalar to MemoryExtra
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdrz committed Jan 9, 2020
1 parent a91f379 commit dfb4369
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
StdRng::seed_from_u64(config.seed.unwrap_or(0)),
config.validate,
config.tracked_pointer_tag,
Scalar::from_int(0, tcx.data_layout.pointer_size),
),
);
// Complete initialization.
Expand Down
10 changes: 9 additions & 1 deletion src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,22 @@ pub struct MemoryExtra {

/// Whether to enforce the validity invariant.
pub(crate) validate: bool,

environ: Scalar<Tag>,
}

impl MemoryExtra {
pub fn new(rng: StdRng, validate: bool, tracked_pointer_tag: Option<PtrId>) -> Self {
pub fn new(
rng: StdRng, validate: bool,
tracked_pointer_tag: Option<PtrId>,
environ: Scalar<Tag>
) -> Self {
MemoryExtra {
stacked_borrows: Rc::new(RefCell::new(GlobalState::new(tracked_pointer_tag))),
intptrcast: Default::default(),
rng: RefCell::new(rng),
validate,
environ,
}
}
}
Expand Down Expand Up @@ -266,6 +273,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
fn find_foreign_static(
tcx: TyCtxt<'tcx>,
def_id: DefId,
_memory_extra: &MemoryExtra,
) -> InterpResult<'tcx, Cow<'tcx, Allocation>> {
let attrs = tcx.get_attrs(def_id);
let link_name = match attr::first_attr_value_str_by_name(&attrs, sym::link_name) {
Expand Down

0 comments on commit dfb4369

Please sign in to comment.