Skip to content

Commit b8e6566

Browse files
committed
remove half-baked TlsKey solution
1 parent 80f17ca commit b8e6566

File tree

3 files changed

+2
-21
lines changed

3 files changed

+2
-21
lines changed

src/shims/tls.rs

Lines changed: 0 additions & 13 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
342342
let key = this.read_scalar(key)?.to_bits(key.layout.size)?;
343343
let active_thread = this.get_active_thread();
344344
let new_data = this.read_scalar(new_ptr)?;
345-
this.machine.tls.store_tls(key, active_thread, new_data, &*this.tcx, &mut this.machine.static_roots)?;
345+
this.machine.tls.store_tls(key, active_thread, new_data, &*this.tcx)?;
346346

347347
// Return success (`0`).
348348
this.write_null(dest)?;

src/shims/windows/foreign_items.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
230230
let key = u128::from(this.read_scalar(key)?.to_u32()?);
231231
let active_thread = this.get_active_thread();
232232
let new_data = this.read_scalar(new_ptr)?;
233-
this.machine.tls.store_tls(
234-
key,
235-
active_thread,
236-
new_data,
237-
&*this.tcx,
238-
&mut this.machine.static_roots,
239-
)?;
233+
this.machine.tls.store_tls(key, active_thread, new_data, &*this.tcx)?;
240234

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

0 commit comments

Comments
 (0)