test: declare the harness ArrayList in the std shape over Buffer #843
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!843
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/837-harness-arraylist-prelude"
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 #837
What and why
Follow-up of #565 (R1 to R6 of #837). The harness prelude declared
ArrayListas a native type, so every test of the std shape had to splice the real shape in as extra files. Nowharness.trbholds exactly onepublic type ArrayList<Item>declaration, the std shape: recorditems: Buffer<Item>,start,count, and a privatevar fn own()thatset,appendandremoveAtcall first. The prelude exportsBufferandBufferIterator(R2). Members the suite reaches use the bodies ofstd/collections/src/list.trb;sliceandreplacekeep a one-linepanic.windowedList, thedeclaredListoflower-collections,declaredListFiles,stdShapedList,stdListFilesandbufferSourceare gone. The twoelementstests that mutateown()away use the small helperwithPreludeChange(original, replacement), which puts a modified copy of the one shape text in its place.partial.test.trband the generic-instance test ofexplain-copiesmoved toArrayList. Native-row tests stay onTrieListwith a comment:lower-natives,crossing, thesetwrite oflower-collections, the slice places oflower-placesandlower, the fourTrieListelement tests ofelements, the runtime-list twin ofexplain-copies. Two pure duplicates inexplain-copieswere dropped.collections.test.trbkeepsTrieListas the "any other implementation ofList" case.compiler/src, noseed/;ir-instances.test.trbkeeps its own mini prelude.Changed counts and expectations (R6), each by hand
lower-natives:types.trb:400totypes.trb:489in theTrieMap.entryAftersnapshot. Reason: the prelude now carries the std-shapedArrayList,BufferandBufferIterator(89 more lines) beforeTrieMap.:273and:139lie before the insertion and are unchanged.lower.test"every construct of a later sub-milestone is named...": the old probe was a list literal, which only blocked because the native preludeArrayListhad noappendrow. It lowers now (next item), so the test probes a still-unsupported construct, avarparameter that takes its default. Same stub shape (b0: # not supported yet,unreachable) onrun.lower.test"a list literal says which construct it is" andlower-textvariadicjoin 1, 2: expected[]instead of the missing-appendmessage. Reason:ArrayList.withCapacityandappendare TorbScript overBuffer, which has manifest rows.explain-copies: twoTrieListduplicates of theArrayListtests removed; the generic-body test usesArrayList, and the first test is kept as theTrieListruntime-list twin.partial: the first test is onArrayList, message`ArrayList<Item>.at` can panic hereinstead ofTrieList, same site. The loop test (last) stays onTrieListwith a comment:ir/bounds.trbproves only anatwhose first parameter is the runtime's list (listMembersOfinlower.trb), so the read through the std-shaped record stays partial. A limit of the compiler's proof, not of the harness; teachingbounds.trbthe record'satis a follow-up.lower-calls"a stub is still a well typed callee":[value]lowers now, sobrokenwas no stub.brokencalls a function whosevarparameter takes its default, which the native back end still does not lower.elements"a container two implementations meet in":firstisRecord(T_std_x2f_prelude_types_ArrayList__T_acme_x2f_app_main_Point)in the header and in slot%1, no longerList(...). The body is identical (checked against the IR printed by a local run).lower-collections"a literal is made through the declaredwithCapacity": the two appends areArrayList_append__Int64_x24_site(, the record'sappend, so the filter names that instance.emit-c"The size of a small program": budget 7 228 to 20 850. Reason: the native list had no C of its own; the record'swithCapacity,append,own,makeUniqueandlengthare C of the program now, as understd/. Measured 20 441 bytes plus 2 %; thunks stay 0.format --check:lower.test.trbwraps one 125-columnassert;harness.trbwriteswithPreludeChange'sreplaceas a command.debugger: thelistFiles()splice is gone, the harness prelude already has the shape.Relation to #841 (#566, inlineSizeLimit 32 to 48)
#841 is still a draft and this PR does not wait for it. Case applied: neither PR touches the other's files (
compiler/src/ir/layout.trbversuscompiler/tests), so there is no textual conflict. The stdArrayListis a 32-byte record, within the current limit of 32, so layout-dependent IR and C expectations here are written for the limit of 32; if #841 merges first, the affected expectations get reviewed again.Test
The forge CI (gates a and b) is the check; its result follows in a comment. The expectations changed after the first red run (run 3257) were checked locally by running the affected test files once each in the VM (
emit-c,elements,lower-calls,lower-collections,partial,lower: all green) andtorb format --checkon the touched files.Task: orion/tasks.
CI red on
b900b7b:ci / tier A (linux-x64)failed after 37m43s (ci / gatesfollows from it). All other run checks that ran are green (bootstrap linux-x64, every host emits the same C, conformance Node.js/PHP, playground, release-sync/registry). The job log is not readable with the reviewer token, so I cannot name the failing test; the PR body says nothing ran locally, so the changed expectations (R6) are the likely suspects. Fix and push; the next CI run brings me back for the review.7a3083c3662d5141d4d7Further expectations changed for the std-shaped
ArrayList(the PR body's "listed in a comment below"), all in2d5141d4:lower.test.trb:532: the 125-columnassertbreaks into one argument per line;harness.trbwithPreludeChange:preludeSource.replace original, replacementas a command (canon K2).lower-calls.test.trb"a stub is still a well typed callee":[value]lowers now, sobrokenwas no stub (counts.1 >= 1failed).brokennow calls a function whosevarparameter takes its default, which the native back end still does not lower (lower.test.trb, "What the back end does not lower yet").elements.test.trb"a container two implementations meet in":firstisRecord(T_std_x2f_prelude_types_ArrayList__T_acme_x2f_app_main_Point)in the header and slot%1; the body is unchanged, because the coercion toList<Point>happens insidechosen. Deduced: the log truncates the actual IR.emit-c.test.trb"The size of a small program": the budget 7 228 measured the native list. The new size is not in the log (the C text is truncated), so the budget is provisionally 12 816 = the program's 12 565 bytes under the realstd(PERFORMANCE.md finding 12) + 2 %. The size is now a binding (size), so a failing run prints the number; it should be re-pinned to measured + 2 %.lower-collections.test.trb:529: the two appends areArrayList_append__Int64_x24_site((the record'sappend, afterwithCapacitywith 2), so the filter matches that name.partial.test.trb"a read a loop proves inside the list": back toTrieList<Int>with a comment.ir/bounds.trbproves only anatwhose first parameter is the runtime'sListStorage(listMembersOfinlower.trb), so the std-shapedArrayListread stays partial. That is a limit of the compiler's proof, not a harness bug. A follow-up could teachbounds.trbthe record'sat.Not run locally (CI only). Tier B and other shards were skipped on
b900b7b, so they may still turn up expectations.2d5141d4d73fbf036177Approved at
3fbf036.compiler/tests); CI green on this head (tier A, tier B, gates, conformance, every host emits the same C).harness.trbnow declares oneArrayList<Item>in the std shape overBufferwithown(); the three duplicate declarations and the extra-files helpers are removed;withPreludeChangeasserts the replacement took effect. Changed expectations (line shift 400 to 489,[]instead of the missing-appendmessage, theArrayListrecord type inelements, theemit-cbudget 20 850 = 20 441 measured + 2 %) each have a stated reason in the body.compiler/src, noseed/. Native-row tests stay onTrieListwith comments.Non-blocking: the
bounds.trbfollow-up for the record'satis worth its own issue; re-check layout-dependent expectations if #841 merges first.