refactor(runtime): share indexed data module loading#781
Conversation
Extract the common indexed-record runtime module loading adapter used by CSV, TSV, and JSONL imports while keeping format-specific parsers, builtins, extension checks, and parse-error wrapping in their existing runtime extension units. Verification: - ./build.pas tests - ./build.pas testrunner - ./build/GocciaTestRunner tests/language/modules/tabular-import.js tests/language/modules/jsonl-import.js - ./format.pas --check - ./build/GocciaTestRunner tests - ./build/GocciaTestRunner tests --mode=bytecode
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA new unit adds ChangesIndexed Data Module Extension Extraction
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Suite TimingTest Runner (interpreted: 10,799 passed; bytecode: 10,799 passed)
MemoryGC rows aggregate the main thread plus all worker thread-local GCs. Test runner worker shutdown frees thread-local heaps in bulk; that shutdown reclamation is not counted as GC collections or collected objects.
Benchmarks (interpreted: 430; bytecode: 430)
MemoryGC rows aggregate the main thread plus all worker thread-local GCs. Benchmark runner performs explicit between-file collections, so collection and collected-object counts can be much higher than the test runner.
Measured on ubuntu-latest x64. |
test262 Conformance
Areas closest to 100%
Per-test deltas (+35 / -3)Newly failing (3):
Newly passing (35):
Steady-state failures are non-blocking; regressions vs the cached main baseline (lower total pass count, or any PASS → non-PASS transition) fail the conformance gate. Measured on ubuntu-latest x64, bytecode mode. Areas grouped by the first two test262 path components; minimum 25 attempted tests, areas already at 100% excluded. Δ vs main compares against the most recent cached |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
source/units/Goccia.RuntimeExtensions.IndexedDataModule.pas (1)
49-52: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winProtect
AModuleimmediately after creation.Line 50 performs work after
AModuleis acquired but before the cleanupfinallystarts. Move that assignment inside the guarded block so future setter/work failures cannot leak the module.♻️ Proposed exception-safety cleanup
- AModule := TGocciaModule.Create(AResolvedPath); - AModule.LastModified := Content.LastModified; LoadSucceeded := False; + AModule := TGocciaModule.Create(AResolvedPath); try + AModule.LastModified := Content.LastModified; for I := 0 to Records.Elements.Count - 1 do AModule.ExportsTable.AddOrSetValue(IntToStr(I), Records.Elements[I]);Based on learnings, this codebase follows the canonical acquire-then-protect pattern: assign the constructor result, immediately open
try..finally, and free infinally.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@source/units/Goccia.RuntimeExtensions.IndexedDataModule.pas` around lines 49 - 52, The module created in the acquisition path is not protected immediately, so failures during the post-construction assignment can leak it. In the code around TGocciaModule.Create and the LoadSucceeded setup, move the AModule.LastModified assignment into the same guarded try..finally block immediately after creation so the canonical acquire-then-protect pattern is preserved and the module is always freed on failure.Source: Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@source/units/Goccia.RuntimeExtensions.IndexedDataModule.pas`:
- Around line 49-52: The module created in the acquisition path is not protected
immediately, so failures during the post-construction assignment can leak it. In
the code around TGocciaModule.Create and the LoadSucceeded setup, move the
AModule.LastModified assignment into the same guarded try..finally block
immediately after creation so the canonical acquire-then-protect pattern is
preserved and the module is always freed on failure.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0c3159dc-1a2e-4014-80b9-5daff3040f69
📒 Files selected for processing (4)
source/units/Goccia.RuntimeExtensions.CSV.passource/units/Goccia.RuntimeExtensions.IndexedDataModule.passource/units/Goccia.RuntimeExtensions.JSONL.passource/units/Goccia.RuntimeExtensions.TSV.pas
Move the LastModified assignment into the guarded module acquisition block so any failure after TGocciaModule.Create frees the partially-created module. Validation: - ./format.pas source/units/Goccia.RuntimeExtensions.IndexedDataModule.pas - ./build.pas testrunner (failed before clean with FPC internal error 200611031) - ./build.pas --clean testrunner - ./build/GocciaTestRunner tests/language/modules/tabular-import.js tests/language/modules/jsonl-import.js - ./build/GocciaTestRunner tests/language/modules/tabular-import.js tests/language/modules/jsonl-import.js --mode=bytecode - ./format.pas --check - git diff --check
Benchmark Results430 benchmarks Interpreted: 🟢 99 improved · 🔴 34 regressed · 🆕 18 new · 279 unchanged · avg +2.5% arraybuffer.js — Interp: 🟢 4, 10 unch. · avg +5.3% · Bytecode: 🟢 1, 🔴 1, 12 unch. · avg -4.2%
arrays.js — Interp: 🟢 4, 15 unch. · avg +3.4% · Bytecode: 🔴 3, 16 unch. · avg -3.3%
async-await.js — Interp: 🟢 1, 5 unch. · avg +5.6% · Bytecode: 🔴 1, 5 unch. · avg -21.0%
async-generators.js — Interp: 🟢 1, 1 unch. · avg +4.5% · Bytecode: 🔴 2 · avg -25.7%
atomics.js — Interp: 🆕 6 · Bytecode: 🆕 6
base64.js — Interp: 🟢 1, 9 unch. · avg +3.1% · Bytecode: 🔴 1, 9 unch. · avg -1.0%
classes.js — Interp: 🟢 11, 20 unch. · avg +5.2% · Bytecode: 🟢 2, 🔴 1, 28 unch. · avg -0.4%
closures.js — Interp: 🟢 4, 7 unch. · avg +4.5% · Bytecode: 11 unch. · avg +0.7%
collections.js — Interp: 🟢 5, 7 unch. · avg +8.3% · Bytecode: 12 unch. · avg -3.0%
csv.js — Interp: 🟢 3, 🔴 1, 9 unch. · avg +3.3% · Bytecode: 🟢 1, 🔴 1, 11 unch. · avg +0.5%
destructuring.js — Interp: 🟢 5, 🔴 3, 14 unch. · avg +0.7% · Bytecode: 🟢 1, 🔴 6, 15 unch. · avg -1.0%
fibonacci.js — Interp: 🟢 3, 5 unch. · avg +4.6% · Bytecode: 🔴 2, 6 unch. · avg -3.0%
float16array.js — Interp: 🟢 9, 🔴 2, 21 unch. · avg +2.8% · Bytecode: 🟢 5, 🔴 1, 26 unch. · avg +2.3%
for-of.js — Interp: 🟢 5, 2 unch. · avg +3.1% · Bytecode: 7 unch. · avg -0.7%
generators.js — Interp: 🟢 1, 🔴 1, 2 unch. · avg +7.2% · Bytecode: 4 unch. · avg -0.8%
intl.js — Interp: 🆕 6 · Bytecode: 🆕 6
iterators.js — Interp: 🟢 1, 🔴 11, 30 unch. · avg -2.4% · Bytecode: 🔴 6, 36 unch. · avg -1.6%
json.js — Interp: 🟢 6, 14 unch. · avg +4.4% · Bytecode: 🔴 3, 17 unch. · avg -1.8%
jsx.jsx — Interp: 🟢 8, 13 unch. · avg +6.2% · Bytecode: 🟢 3, 🔴 1, 17 unch. · avg -1.0%
modules.js — Interp: 🟢 1, 8 unch. · avg +0.5% · Bytecode: 🔴 1, 8 unch. · avg -0.7%
numbers.js — Interp: 🟢 3, 8 unch. · avg +3.6% · Bytecode: 🟢 1, 10 unch. · avg +5.9%
objects.js — Interp: 🟢 1, 6 unch. · avg +0.5% · Bytecode: 7 unch. · avg +5.8%
promises.js — Interp: 🟢 1, 11 unch. · avg +3.8% · Bytecode: 🔴 2, 10 unch. · avg -3.3%
property-access.js — Interp: 🟢 1, 4 unch. · avg +12.2% · Bytecode: 5 unch. · avg -1.6%
regexp.js — Interp: 🔴 2, 9 unch. · avg -2.4% · Bytecode: 🟢 1, 🔴 2, 8 unch. · avg -1.4%
strings.js — Interp: 🟢 4, 15 unch. · avg +2.8% · Bytecode: 🟢 3, 16 unch. · avg +0.0%
temporal.js — Interp: 🆕 6 · Bytecode: 🆕 6
tsv.js — Interp: 🔴 2, 7 unch. · avg -5.8% · Bytecode: 🟢 1, 8 unch. · avg -1.5%
typed-arrays.js — Interp: 🟢 7, 🔴 3, 12 unch. · avg -1.4% · Bytecode: 🟢 2, 🔴 9, 11 unch. · avg -14.5%
uint8array-encoding.js — Interp: 🟢 9, 🔴 1, 8 unch. · avg +7.6% · Bytecode: 🟢 4, 🔴 4, 10 unch. · avg +7.2%
weak-collections.js — Interp: 🔴 8, 7 unch. · avg -5.7% · Bytecode: 🟢 4, 11 unch. · avg +14.7%
Deterministic profile diffatomics
intl
temporal
Measured on ubuntu-latest x64. Benchmark ranges compare cached main-branch min/max ops/sec with the PR run; overlapping ranges are treated as unchanged noise. Percentage deltas are secondary context. |
Summary
TGocciaIndexedDataModuleRuntimeExtensionadapter for indexed-record runtime module imports.Testing
Commands run:
Documentation: not updated because this refactor preserves existing runtime module import behavior and public APIs.