Skip to content

Commit 903dc41

Browse files
committed
remove half-baked TlsKey solution
1 parent bdbfcb2 commit 903dc41

File tree

3 files changed

+2
-21
lines changed

3 files changed

+2
-21
lines changed

src/shims/tls.rs

-13
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,12 @@ impl<'tcx> TlsData<'tcx> {
105105
thread_id: ThreadId,
106106
new_data: Scalar<Provenance>,
107107
cx: &impl HasDataLayout,
108-
static_roots: &mut Vec<AllocId>,
109108
) -> InterpResult<'tcx> {
110109
match self.keys.get_mut(&key) {
111110
Some(TlsEntry { data, .. }) => {
112111
if new_data.to_target_usize(cx)? != 0 {
113112
trace!("TLS key {} for thread {:?} stored: {:?}", key, thread_id, new_data);
114113
data.insert(thread_id, new_data);
115-
if thread_id.to_u32() == 0 {
116-
if let Some(alloc) = (new_data.to_pointer(cx).ok())
117-
.and_then(|ptr| ptr.provenance.and_then(|prov| prov.get_alloc_id()))
118-
{
119-
trace!(
120-
"TLS key {} for main thread stored as static root: {:?}",
121-
key,
122-
alloc,
123-
);
124-
static_roots.push(alloc);
125-
}
126-
}
127114
} else {
128115
trace!("TLS key {} for thread {:?} removed", key, thread_id);
129116
data.remove(&thread_id);

src/shims/unix/foreign_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
305305
let key = this.read_scalar(key)?.to_bits(key.layout.size)?;
306306
let active_thread = this.get_active_thread();
307307
let new_data = this.read_scalar(new_ptr)?;
308-
this.machine.tls.store_tls(key, active_thread, new_data, &*this.tcx, &mut this.machine.static_roots)?;
308+
this.machine.tls.store_tls(key, active_thread, new_data, &*this.tcx)?;
309309

310310
// Return success (`0`).
311311
this.write_null(dest)?;

src/shims/windows/foreign_items.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
260260
let key = u128::from(this.read_scalar(key)?.to_u32()?);
261261
let active_thread = this.get_active_thread();
262262
let new_data = this.read_scalar(new_ptr)?;
263-
this.machine.tls.store_tls(
264-
key,
265-
active_thread,
266-
new_data,
267-
&*this.tcx,
268-
&mut this.machine.static_roots,
269-
)?;
263+
this.machine.tls.store_tls(key, active_thread, new_data, &*this.tcx)?;
270264

271265
// Return success (`1`).
272266
this.write_scalar(Scalar::from_i32(1), dest)?;

0 commit comments

Comments
 (0)