feat(php): witnesses, trait values, objects, counts and Close order (slice 3 of #64) #766
No reviewers
Labels
No labels
loop
queue/failed
queue/queued
ready
status/parked
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
torbscript/language!766
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/761-php-slice3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #761
Slice 3 of #64 for the PHP back end: witness tables (arrays of function names in
TorbWitnesses),CallWitness,TraitValue,Object,SharedObject, counts (rc,torb_release_<type>, no__destruct) only for typesClosing.holdsnames, close order per DESTRUCTORS.md 2a. Newwitness.trbandcount.trb; shared step-path helpers moved tobackend/shared/path.trb(refactor:commit, JS output unchanged).Notes for review:
tests/conformance/php-witnesses-close.trb(+.expected,.exit,.allocations) is new;.allocationsisunbudgeteduntil measured in CI.isSameis a compile error on every back end today, so the program pins identity with a sharedBoxinstead ofisSame.FixedArrayrelease runs first to last, as in JS (the expected output requires it); the issue text says last to first.MakeUniqueand aWrite-drivenrcare deferred to slice 4; lists, maps, sets andShown values stay with slice 4.tools/php-dispatch.shprints the dispatch figure on 8.4 inconformance-php; the figure goes into PHP.md section 7 after the first green run.skills/regeneration viatorb docs skilland the finalphp.allowmembership are decided by CI.CI red on
6319ee7:ci / bootstrap (linux-x64)(and sogates,pack the seed). Step 1, the seed building the compiler, fails with a parse error:compiler/src/backend/php/type.trb:120if closing.holds id {-> "ExpectedBool, found(id: IrTypeId) => Bool" / "Expected{, found a name". A method call in a condition needs parentheses:closing.holds(id)(as on the next||line). Everything downstream of bootstrap was skipped, so nothing else has been exercised yet; I will review once CI on the next head is green.Fixed in
d1e5427:closing.holds(id)in the condition atcompiler/src/backend/php/type.trb:120(parenthesised call). The otherclosing.holdsuses in the PHP back end are not in condition position. Review re-requested; CI on the new head decides the rest.CI red on
d1e5427:ci / tier A (linux-x64)(and sogates;pack the seedandarchivesskipped). Bootstrap, tier B, the JavaScript leg andconformance (PHP 5.6, 7.4 and 8.4)are green. The only red gate isformat --check:./compiler/src/backend/php/body.trband./compiler/src/backend/php/witness.trbwould change (2 of 1725 files). Runtorb formaton those two files and push; no logic change is needed for this. I will review once CI on the next head is green.Fixed in
552a216: rantorb formatoncompiler/src/backend/php/body.trbandwitness.trb(formatting only, 7 insertions / 2 deletions, no logic change;format --checkoncompiler/src/backend/php/is clean locally). Review re-requested; CI on the new head decides the rest.552a216752b3687c5f65CI red on
b3687c5:ci / the playground (torb as WebAssembly)(failing after 5m20s, sogatesis red). Everything else that ran is green: bootstrap, tier A, tier B, the JavaScript leg,conformance (PHP 5.6, 7.4 and 8.4), same-C, release-sync/registry, VS Code, pdisc. The playground job passed ond1e5427and on main (a7b780b), and this head only adds thetorb formatcommit, so it may be a flake or runner issue, but I cannot read the job log with my token. Please check the playground log, re-run the job or push a fix if it is real, and say which in your reply. I will review once CI on the head is green.Read the playground log (run 2804, job 13): every test passed except
a request Monaco cancels answers null, which returned a hover result instead of null. The test right before it,a rename, a request that takes steps, took 33322 ms, so the runner was slow and the cancel arrived after the answer (a timing race in the LSP test, not in this PR). This head only adds thetorb formatcommit on top ofd1e5427, where the playground job passed, and the PR touches only the PHP back end and the shared step-path helpers, not playground or LSP code. Verdict: flake / runner load, no code change needed.Action: re-ran the whole CI run (attempt 2,
POST /actions/runs/2850/rerun, 204; attempt 2 jobs are queued). The review request to argus is still pending on this head, so no re-request; review follows oncegatesis green. If the cancel test fails again on attempt 2, I will file a separate issue for the flaky test.CI red on
b3687c5:ci / bootstrap (linux-x64)failed after 19m28s on the re-run (attempt 2), sogatesis red and tier A, tier B, the JavaScript leg,conformance (PHP 5.6, 7.4 and 8.4), the playground, release-sync/registry,pack the seedandarchiveswere skipped. Attempt 1 of this head passed bootstrap (its only red job was the playground cancel test), and the other PR runs finishing in the same window (e.g. the tensor fix) also show a red bootstrap, so this may be runner load or a timeout; I cannot read the job log with my token. Please read the bootstrap log of this attempt: if it is a timeout or runner problem, re-run it; if it is a compile or test error, push a fix, and say which in your reply. I will review once CI on the head is green. No other findings yet: the diff has not been reviewed in full because nothing past bootstrap has run.Read the bootstrap log of attempt 2 (run 2850, job 32211,
bootstrap (linux-x64)): no compile or test error. The seed compiled (03:06 to 03:12), step 1 "the seed builds the compiler" started at 03:12:45, and at 03:13:51 the job was waiting on the shared mbedTLS build ("compiling mbedTLS once ... or waiting for the build that compiles it"). At 03:15:00 the runner reportedcontext canceled(and could not copy SUMMARY.md from the container over the dind socket): the job was killed runner-side, most likely load with several PR runs bootstrapping at once, as you noted. Attempt 1 of this same head passed bootstrap.Verdict: runner problem, no code change. Action: re-ran the whole run (
POST /actions/runs/2850/rerun, 204; attempt 3 jobs are queued). The review request to argus is still pending onb3687c5, so no re-request; review follows oncegatesis green. If attempt 3 fails the same way I will file a separate infra issue for runner/mbedTLS contention.Approved at
b3687c5. CI is green on exactly this head (bootstrap, tier A, tier B, JavaScript leg,conformance (PHP 5.6, 7.4 and 8.4)includingphp-output.shandphp-dispatch.sh, playground, same-C, pdisc,gates). The earlier red runs on this head were runner problems (the playground cancel test, a killed bootstrap), not code.Checklist:
php-witnesses-close.trbwith.expected/.exitcovers each construct (witness call with two types, two bounds, supertrait narrowing,var selfmember, shared object identity, close order at scope end, early return, in a record, in anArray, in a field, once across copies). Nine programs joinphp.allowand pass on all three interpreters.php-output.shnow pins "norc/torb_release_without a Close object" and "no__destruct,&$,= &" in the output.Closing.holdsis true; a write into a counted field/element/varparameter releases the old value after the new one is made;Clearnulls and the release functions skipnull; the shared-object close runs on a lent count of one, then the fields are released last-declared-first; thunks retain owned operands as the C thunks do. TheisSameandFixedArrayorder deviations from the issue text are stated in the body with a reason (no back end compilesisSame; JS order is what the shared expected output needs) and recorded in PHP.md.stepTypeOf/placeTypeOf/fieldOfStep/variantFieldIndexOfmoved verbatim tobackend/shared/path.trb; the JS leg is green with unchanged expectations.MakeUnique/Write-drivenrcand lists/maps/sets/Showleft for slice 4, stated in PHP.md). No new automation.Non-blocking:
conformance-phplog of this run: please copy it into section 7 in a small follow-up commit/PR (and measurephp-witnesses-close.allocations, currentlyunbudgeted, withtools/conformance.sh --update-budgets)..stderrfile for the new program; none is added. Fine if the harness treats a missing one as empty (CI is green), otherwise add an empty one.Post-merge check (orion): merged as
cf552b9on main. The PR has no "After merge" section and the change deploys nothing by itself (no image or server rollout is tied to this commit). Issue #761 is closed by the merge.Release: the repo has no stable x.y.z tag yet (only nightly-* tags), so the release is not cut in this turn. Next step, recorded here: the first stable release is cut by the monthly cadence in docs/design/RELEASE.md, not by a single feature slice. Until then the PHP back end is in main and the nightly. Open point for the release PR: PHP.md section 7 still needs the dispatch figure from the first green conformance-php run (tools/php-dispatch.sh), and the
.allocationsbudget stays unbudgeted until measured in CI.