Skip to content

script: Wave 5 decompiler source-likeness and Roslyn bind improvements - #119

Merged
leonidarider merged 1 commit into
mainfrom
agent/gta6-near-source-w5
Dec 3, 2026
Merged

leonidarider merged 1 commit into
mainfrom
agent/gta6-near-source-w5

Conversation

@leonidarider

Copy link
Copy Markdown
Contributor

Summary

Wave 5 of the GTA VI script decompiler source-likeness and Roslyn bind improvements:

  • Multi-cell parameter coalescing & post-async local naming (passes/aggregates, passes/interproc, passes/values/locals):
    • Coalesces multi-cell arguments across signatures, slot_params, virtual override ancestors, natives (Ped/Vector3/Handle), Expr::Cells, LoadBytes, copy_row, and stored_field_row (CS7036 84,895 → 26,993, pN uses -19.9% vs Stage B).
    • Runs locals::named inside apart_in_place after async/iterator rewrites (v_ temp uses 3,972 → 477, stack_ uses 1,885 → 0).
  • Visibility & async safety (emit/access.rs, emit/mod.rs):
    • Marks StoreBytes, StoreF32Slots, StepI32, ZeroBytes, LoadBytes, ByteOffset, Group::Field, Group::Construct, ExprSugar::Field, inherited fields, masked FunctionRef, and in-place lambdas internal (CS0122 → 0).
    • Emits per-member unsafe on pointer-using classes/programs containing async/await (CS4004 → 0).
  • Runtime sugar & managed typing (passes/sugar_runtime, passes/types):
    • Rewrites Object/ValueType.GetHashCode/ToString/Equals on box_at<T>(&p1) (CS1501 -34k), unsubclassed builtin virtuals (System.Random.Next/NextDouble), Around::common_script_base, alloc_managed vs hard_raw, and System.Collections.IEnumerator promotion.
  • C# emission & Roslyn prelude (print/mod.rs, print/constructs, print/enums, print/prelude, reparse/mod.rs):
    • Concrete-type null-coalescing, zero_bytes(addr(ref ...)) & lambda addr(ref local), try_cast<ValueStruct> helper, bool virtual/local zero-test folding, uint/Hash casts, two-step enum casts, element_ptr deref fixes, Cell.MoveNext/Current, mixed bitwise/operator disambiguation, Vector3 field dedup, System.Rage.CompareExchange, and split-vector overloads.

Verification (Full 745-Program Corpus + Roslyn Bind)

All 6 corpus checks passed (index, oracle 0 diffs, reread 19,601, export 745/745 0 failed, compiled 0 diffs, reread-project 19,612):

Metric Stage B Wave 4 (#110) Wave 5 (this PR)
Roslyn bind rate 27.272% 36.911% 39.401% (+2.49 pts, +13,138 funcs)
Roslyn bind-or-missing ~40.9% 61.090% 67.748% (+6.66 pts, +35,085 funcs)
Total Roslyn errors 2,986,265 2,114,010 2,050,587
Non-missing errors ~1,505,000 759,433 737,656
v_ temp uses 69,531 3,972 477 (−99.3%)
stack_ uses 1,903 1,885 0 (−100.0%)
->f_N arrows 239,361 158,838 152,247 (−36.4%)
pN uses 2,610,854 2,223,218 2,091,659 (−19.9%)

Merge gates passed: or-io lib tests (1,656/1,656), or-cli lib tests, clippy -p or-io -p or-cli --all-targets -- -D warnings, cargo test --bin openrage doc_, just self-check (140/140), pre-commit hook (fmt, encoding, provenance).

- Multi-cell caller/callee parameter coalescing across signatures, overrides, natives, LoadBytes/copy_row/stored_field_row, and post-async locals::named (CS7036 84.9k -> 27.0k, v_ temps 3,972 -> 477, stack_ 1,885 -> 0)
- Emit visibility for StoreBytes/LoadBytes/ZeroBytes/StepI32/Construct/inherited fields (CS0122 -> 0) and per-member unsafe for async classes/programs (CS4004 -> 0)
- Boxed receiver method sugar (box_at<T>(&p1).GetHashCode()), unsubclassed builtin virtuals (System.Random.Next/NextDouble), alloc_managed/hard_raw separation, and IEnumerator promotion
- Concrete-type null-coalescing, lambda/zero_bytes addr(ref ...), value-type try_cast<T>, bool virtual/local zero-test folding, uint/Hash casts, two-step enum casts, and element_ptr deref fixes
- Prelude Cell.MoveNext/Current, mixed bitwise/operator disambiguation, Vector3 field dedup, System.Rage.CompareExchange, split-vector overloads, and try_cast<T> helpers
@leonidarider
leonidarider merged commit fd46e7a into main Dec 3, 2026
@leonidarider
leonidarider deleted the agent/gta6-near-source-w5 branch December 3, 2026 08:35
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