feat: IDNA, joining and bidi data and natives (commit 1 of 2 for UTS #46) #376
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/364-idna-data"
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 #364
Task
Commit 1 of 2 for UTS #46 (issue #364): the IDNA, joining-type and bidi data in the generated Unicode tables, the natives that read them, and the compiler teaching for them. The use in
std/dnsis #365 and waits for a published seed.What
feat(text):tools/unicode/generate.trbandtools/fetch-unicode.shread IdnaMappingTable.txt, extracted/DerivedJoiningType.txt, extracted/DerivedBidiClass.txt and Scripts.txt (plus UnicodeData.txt as before) and writeruntime/idna_data.cwithinclude/torb_idna_data.h. Every input is pinned intools/unicode/SHA256SUMS; IdnaTestV2.txt is pinned too, for the conformance test of #365 (nothing here reads it).feat(runtime):runtime/idna.cwith seven natives, allIntin and a smallIntout, no allocation:idnaStatus,idnaMapping(appends to the caller'sArrayList<Int>, answers the count),idnaGeneralCategory,idnaJoiningType,idnaBidiClass,idnaCombiningClass(a virama is 9),idnaScript(Greek, Hebrew, Hiragana, Katakana, Han, else Other). They are ready rows incompiler/src/backend/c/natives.trbunder a newidnapart, so the tables are linked only into a program whose C names one of them (or that hosts the VM):TORB_WITHOUT_IDNA, guarded VM thunks,callsIdna/idnaSources, the driver and the docs runner updated like the normalization part.torb_natives.handmachine_natives.care regenerated withtorb natives --header.Notes for the review:
idnaprefix, likenetworkNameServers; no private type instd/textwas needed, so nothing is declared instd/(the manifest names them, #365 declares them).disallowed_STD3_*statuses (the table saysvalidfor ASCII; STD3 is applied outside it). The generator accepts exactly the five statuses disallowed, ignored, mapped, deviation and valid, and fails on anything else. That differs from the wording of #364, which listed the STD3 ones.std/,seed/ortests/conformance/. Publishing the seed is not part of this PR.Test
compiler/tests/natives.test.trb: each of the seven rows exists, is ready, names its symbol and prototype, is in the VM's list, and the part is separate from the Unicode and normalization parts.runtime/tests/idna_test.c: status, mapping, general category, combining class, joining type, bidi class and script of every code point U+0000..U+10FFFF against the pinned files whentools/fetch-unicode.shhas them (the CI does);runtime/tests/idna-excerpt.txtotherwise, and in a test of its own always: every status, category, joining type, bidi class and script, the longest mapping and one of each shorter length, the deviation characters (ß ς ZWJ ZWNJ), the CONTEXTO code points, Arabic, Hebrew, Latin and number code points, the edges of the mapping runs. Plus out-of-range input and the append behaviour ofidnaMapping.Size
.rodata(budget 61,440): top 2,176, middle 6,976, leaves 14,160, records 1,536, mapping runs 30,016, pool 5,140. The generator fails above the budget.tools/size-cost.shin tier B (bound 4,096 bytes); the result follows below once CI has run.Approved. Checklist for head
ab769db:Non-blocking: the size result of tools/size-cost.sh for a program that uses no IDNA data is promised in the PR body "once CI has run". It is a measurement and not a gate, so please add it as a follow-up note.