Skip to content

🧹 Remove unused used field in CodePage - #318

Open
undivisible wants to merge 1 commit into
masterfrom
code-health-jit-runtime-deadcode-16642229359867925454
Open

🧹 Remove unused used field in CodePage#318
undivisible wants to merge 1 commit into
masterfrom
code-health-jit-runtime-deadcode-16642229359867925454

Conversation

@undivisible

@undivisible undivisible commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

🎯 What: Removed the used field and its complex #[cfg_attr(..., allow(dead_code))] from CodePage in in-cli/src/jit_runtime.rs. The required byte count is now passed directly as an argument (_used) to the finalize method.
💡 Why: This simplifies the struct definition, removes an unnecessary and clunky conditional compilation attribute for silencing dead code warnings on unsupported platforms (like x86_64), and cleans up initialization logic by making page immutable when loading JIT code.
Verification: Verified by ensuring the code formats with cargo fmt, passes linting via cargo clippy --all-targets --features extended --locked -- -D warnings, and passes both the jit_runtime specific test and the full test suite (cargo test).
Result: A cleaner CodePage structure with better memory layout and safer, immutable initialization without dead-code allowance hacks.


PR created automatically by Jules for task 16642229359867925454 started by @undivisible


Note

Low Risk
Localized JIT runtime cleanup with no change to when or how much memory is flushed or made executable.

Overview
Refactors how the JIT runtime tracks how many bytes were written into an executable CodePage.

The used field is removed from CodePage, along with the platform-specific allow(dead_code) attribute that existed because used was only read on macOS and AArch64 Linux for instruction-cache invalidation.

finalize now takes the written byte count (code.len() from JitRuntime::load) instead of reading it from the page. load no longer mutates the page after allocation—only copies code, applies relocations, pushes the page, then calls finalize(code.len()).

Behavior for icache flush and mprotect is unchanged; the count is just supplied at finalize time rather than stored on the struct.

Reviewed by Cursor Bugbot for commit 81b3d74. Configure here.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@cursor

cursor Bot commented Sep 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_cad62df8-ae84-452d-a4f9-7b92c2a0112b)

@mergify

mergify Bot commented Sep 10, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant