miri icon indicating copy to clipboard operation
miri copied to clipboard

Replace 'this' by 'ecx'

Open RalfJung opened this issue 1 month ago • 19 comments

We've long used a mix of variable names for MiriInterpCx references: on free functions, they'd be called ecx, but in methods on extension traits, they'd be called this. That causes awkward renames when moving code between helpers, and generally just does not seem consistent.

So, we're going to rename all the this. This issue is about all the let this = self.eval_context_ref(); and let this = self.eval_context_mut();; the others (if any) will be dealt with separately. The fix is easy: rename this to ecx, ideally with an IDE auto-rename assist.

The following files have at least one such function that needs to be fixed (some files have been removed to avoid conflicts with ongoing work):

  • [x] src/alloc_addresses/mod.rs
  • [x] src/borrow_tracker/mod.rs
  • [x] src/borrow_tracker/stacked_borrows/mod.rs
  • [x] src/borrow_tracker/tree_borrows/mod.rs
  • [x] src/concurrency/genmc/global_allocations.rs
  • [x] src/concurrency/genmc/shims.rs
  • [x] src/concurrency/sync.rs
  • [x] src/diagnostics.rs
  • [x] src/helpers.rs
  • [x] src/intrinsics/aarch64.rs
  • [x] src/intrinsics/loongarch.rs
  • [x] src/intrinsics/math.rs
  • [x] src/intrinsics/mod.rs
  • [x] src/intrinsics/simd.rs
  • [x] src/intrinsics/x86/aesni.rs
  • [x] src/intrinsics/x86/avx.rs
  • [x] src/intrinsics/x86/avx2.rs
  • [x] src/intrinsics/x86/bmi.rs
  • [x] src/intrinsics/x86/gfni.rs
  • [x] src/intrinsics/x86/mod.rs
  • [x] src/intrinsics/x86/sha.rs
  • [x] src/intrinsics/x86/sse.rs
  • [x] src/intrinsics/x86/sse2.rs
  • [x] src/intrinsics/x86/sse3.rs
  • [x] src/intrinsics/x86/sse41.rs
  • [x] src/intrinsics/x86/sse42.rs
  • [x] src/intrinsics/x86/ssse3.rs
  • [x] src/operator.rs
  • [x] src/provenance_gc.rs
  • [x] src/shims/alloc.rs
  • [x] src/shims/backtrace.rs
  • [x] src/shims/cpu_affinity.rs
  • [x] src/shims/env.rs
  • [x] src/shims/files.rs
  • [x] src/shims/io_error.rs
  • [x] src/shims/math.rs
  • [x] src/shims/native_lib/mod.rs
  • [x] src/shims/os_str.rs
  • [x] src/shims/panic.rs
  • [x] src/shims/readiness.rs
  • [x] src/shims/sig.rs
  • [x] src/shims/time.rs
  • [x] src/shims/unix/env.rs
  • [x] src/shims/unix/fd.rs
  • [x] src/shims/unix/freebsd/sync.rs
  • [x] src/shims/unix/macos/sync.rs
  • [x] src/shims/unix/mem.rs
  • [x] src/shims/unix/poll.rs
  • [x] src/shims/unix/sync.rs
  • [x] src/shims/unix/thread.rs
  • [x] src/shims/unwind.rs

You may take some files by posting here, and then make a PR. Do not grab more than 5 files at a time.

RalfJung avatar Nov 05 '26 20:11 RalfJung

I will take the first 5 files. I will take the second 5 files.

I will take the third 5 batch :)

hlsxx avatar Nov 06 '26 16:11 hlsxx

@programskillforverification please don't edit your comments to add new information. Make a new comment instead. Edits do not generate notifications so I will not see them.

RalfJung avatar Nov 06 '26 16:11 RalfJung

@programskillforverification please don't edit your comments to add new information. Make a new comment instead. Edits do not generate notifications so I will not see them.

got it

I'd like to take sse3.rs, bmi.rs, ssse3.rs, gfni.rs, and sha.rs from src/intrinsics/x86/ .

darkraider01 avatar Nov 07 '26 10:11 darkraider01

Id like to take these five files:

  • src/shims/cpu_affinity.rs
  • src/shims/io_error.rs
  • src/shims/os_str.rs
  • src/shims/panic.rs
  • src/shims/sig.rs

Kaileshwar16 avatar Nov 07 '26 11:11 Kaileshwar16

In the future, please pick files that are adjacent in the list, it's kind of a pain to hunt for their checkboxes otherwise. ;)

RalfJung avatar Nov 07 '26 12:11 RalfJung

I'd like to take:

  • src/intrinsics/x86/avx.rs
  • src/intrinsics/x86/avx2.rs
  • src/intrinsics/x86/mod.rs
  • src/intrinsics/x86/sse.rs
  • src/intrinsics/x86/sse2.rs

I'd like to take env.rs, fd.rs, freebsd/sync.rs, macos/sync.rs, and mem.rs from src/shims/unix/.

darkraider01 avatar Nov 07 '26 22:11 darkraider01

I'd like to take the last four:

  • src/shims/unix/poll.rs
  • src/shims/unix/sync.rs
  • src/shims/unix/thread.rs
  • src/shims/unwind.rs

Enfey avatar Nov 07 '26 23:11 Enfey

i will claim these,

src/operator.rs src/provenance_gc.rs src/shims/alloc.rs src/shims/backtrace.rs

Kaileshwar16 avatar Nov 08 '26 10:11 Kaileshwar16

I'd like to take these five next:

  • src/shims/env.rs
  • src/shims/files.rs
  • src/shims/math.rs
  • src/shims/native_lib/mod.rs
  • src/shims/readiness.rs

darkraider01 avatar Nov 09 '26 08:11 darkraider01

I'd like to pick up the rest

That's

  • src/intrinsics/x86/sse41.rs
  • src/intrinsics/x86/sse42.rs
  • src/shims/time.rs

Go for it :)

RalfJung avatar Nov 10 '26 08:11 RalfJung

There are two files left, where I am waiting for PRs to land to avoid conflicts:

  • https://github.com/rust-lang/miri/pull/5604
  • https://github.com/rust-lang/miri/pull/5414

RalfJung avatar Nov 15 '26 15:11 RalfJung

There are two files left, where I am waiting for PRs to land to avoid conflicts:

#5414 has renamed

Indeed, so feel free to make a PR for src/shims/unix/fs.rs which should be the last remaining file. :)

RalfJung avatar Nov 25 '26 20:11 RalfJung

Indeed, so feel free to make a PR for src/shims/unix/fs.rs which should be the last remaining file. :)

I can take it

All this have been replaced -- thanks a lot to everyone involved. :)

RalfJung avatar Nov 26 '26 20:11 RalfJung