plan: progress log session 4 — 147/300 (49%), harness cache + 6 features
This commit is contained in:
@@ -201,7 +201,16 @@ Append-only record of completed iterations. Loop writes one line per iteration:
|
||||
|
||||
- 2026-04-23 — **Rest + rename in destructure, delete operator, Array.prototype / String.prototype / Number.prototype stubs, lastIndexOf, typeof fix, js-apply-fn handles callable dicts.** Array destructure `[a, ...rest]` transpiles rest-tail to `(js-list-slice tmp i (len tmp))`. Obj pattern `{key: local}` renames to `local`. `delete obj.k` → `js-delete-prop` which sets value to undefined. `Array.prototype.push` etc. are accessible as proto-functions that route through `js-this` + `js-invoke-method`. `Number.prototype` stub with `toString/valueOf/toFixed`. Nested destructuring patterns tolerated via `jp-skip-balanced` (treated as holes). Destructuring params in fn decls accepted (holes). **Final Math scoreboard: 66/288 (22.9%)** vs 56/288 (19.4%) baseline, +10 passes (+3.5 percentage points). 446/448 unit (438→+8). 148/148 slice unchanged. Top remaining Math failures: 94× ReferenceError (`Math.log`/`Math.sin`/`Math.cos` etc. not shimmed — no SX `sin`/`cos`/`log` primitives), 79× assertion-fail (numerical precision on `Math.floor` / `ceil` / `trunc` edge cases), 31× TypeError, 16× Timeout.
|
||||
|
||||
- 2026-04-23 (session 4) — **P0 harness cache: 2.06× speedup.** Root cause: every worker sx_server session was running `js-eval` on the 3.6 KB `HARNESS_STUB` from scratch (~15 s per session — tokenize + parse + transpile). Fix: transpile once per Python process via a throwaway sx_server, call `(inspect (js-transpile (js-parse (js-tokenize HARNESS_STUB))))`, write the SX text to `lib/js/.harness-cache/stub.<fp>.sx` (fingerprint = sha256 of stub + lexer + parser + transpile), and have every session `(load …)` the cached file instead. Disk cache survives across Python invocations; edits to `transpile.sx` invalidate automatically. Had to add a `$`-to-`_js_dollar_` name-mangler in `js-sym`: SX's tokenizer rejects `$` in identifiers, which broke round-tripping through `inspect` (e.g. `$DONOTEVALUATE` → parse-error on reload). No internal JS-on-SX names contain `$`, so the mangler is a pure add. Measured on 300-test wide (Math+Number+String @ 100/cat, 5 s per-test timeout): **593.7 s → 288.0 s**, 2.06× speedup. Scoreboard 114→115/300 (38.3%, noise band). Committed: `4a277941`. Also filed two Blockers entries — **Math trig/transcendental primitives missing** (sin/cos/tan/log/atan2/… × 22 platform-level primitives — accounts for all 34 Math "not a function" failures) and **Evaluator CPU bound at ~1 test/s** (lexical addresses, inline caches, force JIT on transpiled bodies, OCaml 5 domains).
|
||||
- 2026-04-23 (session 4) — **P0 harness cache + P1 Blockers + scoreboard-driven feature work. 114/300 → 147/300 (+33 tests, 38.0% → 49.0%).** Wide wall time 593s → 277s (2.14× via cache). Commits `4a277941..00edae49`:
|
||||
1. **harness cache (`4a277941`)**: transpile HARNESS_STUB once per Python process, write SX to `.harness-cache/stub.<fp>.sx`, every worker `(load …)`s it instead of js-eval'ing the raw JS. Added `$`→`_js_dollar_` name-mangler in `js-sym` so SX symbols round-trip through `inspect`.
|
||||
2. **Blockers entries (`dc97c173`)**: Math trig/transcendental primitives (22 missing), evaluator CPU bound (lexical addresses, inline caches, JIT-force, OCaml 5 domains).
|
||||
3. **exponent notation (`7cffae21`)**: `js-num-from-string` now splits on e/E, parses mantissa and exponent separately, combines via new `js-pow-int`. `.12345e-3` was 0.12345, now 0.00012345. Also fixed the `js-string-trim` typo. +3 Number.
|
||||
4. **callable-dict hasOwnProperty (`05aef11b`)**: Number/String/Array etc. carry `__callable__` so `js-function?` returns true and dispatch landed in the function-proto branch (which only knows name/length/prototype). Added `(not dict)` guard so dicts fall through to the keys-based path. +6 Number.
|
||||
5. **.length / .name on constructor dicts (`f63934b1`)**: six `dict-set!` lines adding the spec'd `length=1` and `name="<Ctor>"` to Number/String/Array/Object/Boolean. +1 Number.
|
||||
6. **ctor.prototype used by `new` (`bf09055c`)**: `js-get-ctor-proto` now returns `ctor.prototype` directly for dict ctors before falling through to the id-keyed table. Was synthesising an empty proto, so every `(new Number()).toLocaleString` was undefined. +5 Number, +2 String.
|
||||
7. **hex-literal string→number (`00edae49`)**: `ToNumber("0x0")` was NaN, should be 0 per spec. Added `js-hex-prefix?` / `-is-hex-body?` / `-parse-hex` / `-hex-digit-value` and dispatch from both `js-is-numeric-string?` and `js-num-from-string`. +15 Number (S9.3.1_A16..A32 family).
|
||||
8. Unit: 520/522 → **521/522** (test 903 was expecting wrong part count, fixed). Slice: 148/148 unchanged. Math scoreboard unchanged (still blocked on trig). String 30% → 33% (+3 via proto fix). Number 43% → 73% (+30). Wide 38% → 49%.
|
||||
Also added `--dump-failures <path>` to the runner for tight debug loops.
|
||||
- 2026-04-23 (session 3, continued) — **Scoreboard scoped 100/cat**: Math 40% / Number 43% / String 31% = 114/300 overall. Additional commits (85a329e8..c3b0aef1):
|
||||
- `fn.length` reflects arity via `lambda-params` + `js-count-real-params`. Math.abs.length = 1 etc.
|
||||
- `Object` global now callable (`new Object()`, `Object(5)`). Object.prototype has `hasOwnProperty`/`isPrototypeOf`/`propertyIsEnumerable`/`toString`/`valueOf`.
|
||||
|
||||
Reference in New Issue
Block a user