Skip to content

Inspect inline helpers in read-only source diagnostics - #28

Merged
Sumaiter merged 2 commits into
mainfrom
fix/review-helper-ast
Nov 14, 2026
Merged

Sumaiter merged 2 commits into
mainfrom
fix/review-helper-ast

Conversation

@Sumaiter

@Sumaiter Sumaiter commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Problem and resulting behavior

Read-only source diagnostics reused the search parser's exactly-one-function guard. A normal translation unit containing three static inline helpers and one emitted function therefore reported that AST analysis was unavailable. Suspicious address expressions inside helpers could also remain uninspected.

Separate guarded translation-unit parsing from the single-function search entry point. Source diagnostics now inspect every supported helper body and declaration. Search mutations and reviewed search seeds retain their existing single-function restriction; diagnostics never grant semantic approval.

Scope

  • Shared improvement, usable across games
  • Game/version-specific logic under GameName_PAL or a separate region folder

This changes read-only diagnostics. It adds no source transformation, compiler profile, address mapping, score adjustment or budget change. Existing preprocessing and compiler-flag guards remain in force.

Evidence and validation

  • Eight real PS2 EE compiler runs with synthetic sources, using SN 1.36 at -O2 -G8 -fopt-stack -mno-check-zero-division and the existing local assembly pipeline. Both int/float/byte* and short/double/void* header contexts are covered. The optional argv-based compiler harness and source/object/text hashes are included.
  • Negative cases: direct nonzero pointer literals and implicit integer-to-pointer expressions inside helpers are diagnosed; their objects have no external address relocation. Positive cases: true external-table pointer arithmetic retains actual R_MIPS_HI16/R_MIPS_LO16 relocations, and ordinary floating helpers remain accepted. The double helper's actual runtime-support call relocations are retained in the evidence.
  • Replayed the motivating immutable 172-byte review source containing three inline helpers: AST diagnostics now run, while its source and object hashes remain unchanged. No game source, object, disassembly, proprietary tool or local path is included.
  • Python after review: 567 tests run, 558 passed and 9 optional skips. JavaScript: all 23 tests passed. Offline VSIX build and archive validation passed. git diff --check passed.
  • Regression coverage includes function-local type scopes, nested helper casts, preprocessing limitations, data-only diagnostic inputs, and rejection of helper-containing inputs by search mutation and reviewed-seed entry points.
  • The motivating function was separately reviewed and included in the local complete PAL C build: 771 translation units passed, with fresh all-placement target audits. This diagnostic change itself recompiles no game source and promotes no function.

Remaining limits

Diagnostics cover the existing narrow source checks and supported parser input. They do not preprocess arbitrary headers/macros or establish types, ABI, ownership, initialization, boundaries, relocations or runtime semantics. A clean diagnostic report is not match approval. Multi-function search mutations remain unsupported.

Review corrections: direct literal-pointer diagnostics now resolve typedefs in lexical scopes and capture each alias at declaration time. This diagnoses helper-local pointer aliases, avoids treating a shadowing scalar alias as a pointer, and prevents helper aliases leaking into another function. Two new regressions cover these cases. Combined with PR #29, all 580 Python tests (9 optional skips), 23 JavaScript tests and offline packaging pass. The single-function search and reviewed-seed guards still reject helper-containing input. No additional native game or proprietary compiler runs were performed in this review.

@Sumaiter
Sumaiter merged commit 876590b into main Nov 14, 2026
4 checks passed
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