@calcit/procs 0.12.56 → 0.12.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/build.rs +36 -2
  3. package/editing-history/202608011759-issue-routing-in-agent-guide.md +17 -0
  4. package/editing-history/202608011833-schema-type-symbols.md +20 -0
  5. package/editing-history/202608011852-wasm-dynamic-string-tag.md +7 -0
  6. package/editing-history/202608011908-consolidate-history.md +6 -0
  7. package/editing-history/202608012022-consolidate-cli-and-test-duplication.md +28 -0
  8. package/editing-history/202608012123-review-follow-up.md +18 -0
  9. package/editing-history/202608012320-release-0.12.57.md +5 -0
  10. package/editing-history/ARCHIVE.md +15 -0
  11. package/editing-history/README.md +21 -0
  12. package/lib/package.json +1 -1
  13. package/package.json +1 -1
  14. package/editing-history/2026-02-13-1841-trait-origin-structural-eq.md +0 -91
  15. package/editing-history/2026-02-14-2050-js-codegen-recursion-tag-migration.md +0 -39
  16. package/editing-history/2026-02-14-2358-emit-js-modularization-shift-left.md +0 -63
  17. package/editing-history/2026-02-15-0000-diagnostics-consolidated.md +0 -35
  18. package/editing-history/2026-02-15-1941-macro-diagnostics-refinement.md +0 -39
  19. package/editing-history/2026-02-16-2043-core-api-docs-cleanup.md +0 -40
  20. package/editing-history/2026-02-23-0834-migrate-to-defstruct.md +0 -91
  21. package/editing-history/2026-02-23-2321-ns-imports-code-fixes.md +0 -42
  22. package/editing-history/2026-02-25-0002-language-behavior-eval-mode.md +0 -93
  23. package/editing-history/2026-02-25-0111-guidebook-no-check-block-upgrades.md +0 -52
  24. package/editing-history/2026-02-25-0113-runtime-type-validation-and-macro-quoting.md +0 -41
  25. package/editing-history/2026-02-25-1131-check-md-eval-improvements.md +0 -13
  26. package/editing-history/2026-02-26-1324-check-md-inprocess-cache-and-path-labels.md +0 -7
  27. package/editing-history/2026-02-27-1640-unify-markdown-readers.md +0 -16
  28. package/editing-history/2026-02-27-1958-tree-rewrite-command-and-reference-model.md +0 -18
  29. package/editing-history/2026-02-27-2200-split-def-command.md +0 -29
  30. package/editing-history/2026-02-27-2212-tree-raise-wrap.md +0 -33
  31. package/editing-history/2026-02-27-2223-calcit-agent-docs-optimize.md +0 -41
  32. package/editing-history/2026-03-01-0212-query-search-entry-and-ffi-warning.md +0 -53
  33. package/editing-history/2026-03-03-1934-check-types-and-core-annotations.md +0 -17
  34. package/editing-history/2026-03-04-0000-generics-fn-typevar-identity.md +0 -30
  35. package/editing-history/2026-03-04-1331-tag-call-warning-and-dot-access-migration.md +0 -28
  36. package/editing-history/2026-03-04-1548-impl-new-dot-method-input-and-doc-hints.md +0 -33
  37. package/editing-history/2026-03-04-1645-calcit-eq-contract-refactor-and-macro-tests.md +0 -28
  38. package/editing-history/2026-03-04-2200-assert-type-assert-traits-composable-runtime-checks.md +0 -18
  39. package/editing-history/2026-03-05-0042-type-inference-argtypes-and-core-hints.md +0 -54
  40. package/editing-history/2026-03-05-0115-calcit-core-generic-refinements.md +0 -57
  41. package/editing-history/2026-03-05-1930-schema-migration-cr-edit.md +0 -30
  42. package/editing-history/2026-03-05-1939-query-schema-adaptation.md +0 -42
  43. package/editing-history/2026-03-06-0120-schema-hint-migration-batch.md +0 -38
  44. package/editing-history/2026-03-06-1416-core-macro-schema-migration.md +0 -20
  45. package/editing-history/2026-03-06-1552-core-schema-and-hintfn-migration.md +0 -63
  46. package/editing-history/2026-03-06-1936-schema-normalization-and-preprocess-preload.md +0 -12
  47. package/editing-history/2026-03-07-0000-migrate-hint-fn-to-schema.md +0 -29
  48. package/editing-history/2026-03-07-0000-remove-enum-prototype-field.md +0 -43
  49. package/editing-history/2026-03-07-0000-schema-args-type-enforcement.md +0 -66
  50. package/editing-history/2026-03-07-0142-unit-type-and-builtin-schemas.md +0 -82
  51. package/editing-history/2026-03-07-1652-decouple-snapshot-schema-to-calcit-type.md +0 -112
  52. package/editing-history/2026-03-07-1821-snapshot-schema-validation.md +0 -6
  53. package/editing-history/2026-03-07-1959-schema-def-kind-arity-validation.md +0 -96
  54. package/editing-history/2026-03-08-0031-schema-generics-quote-normalization.md +0 -35
  55. package/editing-history/2026-03-08-1905-schema-typeref-and-assert-migration.md +0 -34
  56. package/editing-history/2026-03-08-2033-schema-wrapper-migration.md +0 -45
  57. package/editing-history/2026-03-08-2315-late-schema-cleanup-and-warning-compat.md +0 -27
  58. package/editing-history/2026-03-09-1753-schema-type-fail-tests.md +0 -17
  59. package/editing-history/2026-03-10-1040-edit-schema-primitive-tag-support.md +0 -42
  60. package/editing-history/2026-03-10-1754-ns-entry-snapshot-migration.md +0 -66
  61. package/editing-history/2026-03-13-2216-validate-struct-type-arg-arity.md +0 -24
  62. package/editing-history/2026-03-16-2353-runtime-boundary-cleanup.md +0 -14
  63. package/editing-history/2026-03-17-0150-runtime-boundary-lookup-cleanup.md +0 -28
  64. package/editing-history/2026-03-20-0116-json-builtins-and-runtime-docs.md +0 -48
  65. package/editing-history/2026-03-26-2013-docs-frontmatter-and-module-search.md +0 -58
  66. package/editing-history/2026-04-07-1550-path-format-at-prefix-migration.md +0 -46
  67. package/editing-history/2026-04-12-1524-js-codegen-map-to-record.md +0 -26
  68. package/editing-history/2026-04-12-1549-map-to-record-field-validation.md +0 -29
  69. package/editing-history/2026-04-13-1600-tuple-to-enum-rewrite.md +0 -13
  70. package/editing-history/2026-04-13-2309-typeslot-enum-compile-safety.md +0 -45
  71. package/editing-history/2026-04-14-1500-loose-record-syntax.md +0 -32
  72. package/editing-history/2026-04-14-2259-bidir-type-check-refactor.md +0 -63
  73. package/editing-history/2026-04-15-0120-match-syntax-exhaustiveness.md +0 -20
  74. package/editing-history/2026-04-15-1211-record-nth-optimization.md +0 -44
  75. package/editing-history/2026-04-16-1936-predicate-narrowing-expansion.md +0 -31
  76. package/editing-history/2026-04-17-0132-monomorphize-map-filter.md +0 -50
  77. package/editing-history/2026-04-17-0135-monomorphize-includes-reverse.md +0 -31
  78. package/editing-history/2026-04-17-0140-fold-type-predicates.md +0 -44
  79. package/editing-history/2026-04-17-0154-generic-dispatch-records-tuples.md +0 -52
  80. package/editing-history/2026-04-17-0520-simplify-generic-defns-via-method-dispatch.md +0 -49
  81. package/editing-history/2026-05-21-0055-tree-show-cr-config-and-edit-cleanup.md +0 -81
  82. package/editing-history/2026-05-31-2052-macro-schema-roundtrip-and-weak-types.md +0 -6
  83. package/editing-history/2026-05-31-2105-map-generic-weak-types-followup.md +0 -15
  84. package/editing-history/2026-06-01-0003-update-callback-field-specialization.md +0 -19
  85. package/editing-history/2026-06-01-2317-data-definition-where-bounds.md +0 -6
  86. package/editing-history/2026-06-02-0114-data-definition-where-macro-followup.md +0 -21
  87. package/editing-history/2026-06-03-0000-check-md-edn-errors.md +0 -5
  88. package/editing-history/2026-06-03-1600-check-md-entry-modules.md +0 -6
  89. package/editing-history/2026-06-04-0000-check-md-app-main-init.md +0 -6
  90. package/editing-history/2026-06-04-2218-compiled-executable-runtime-backfill.md +0 -6
  91. package/editing-history/2026-06-09-0000-with-type-slot-scoped-binding.md +0 -83
  92. package/editing-history/2026-06-09-1241-remove-bind-type.md +0 -64
  93. package/editing-history/2026-06-09-1800-core-effect-tags.md +0 -57
  94. package/editing-history/2026-06-10-1200-get-def-doc-schema-builtin.md +0 -7
  95. package/editing-history/2026-06-15-1500-effects-graph-mvp.md +0 -30
  96. package/editing-history/2026-06-16-1700-effects-graph-ste-tree.md +0 -84
  97. package/editing-history/2026-06-27-0052-cli-improvements.md +0 -41
  98. package/editing-history/2026-06-27-0202-docs-indexing-improvements.md +0 -22
  99. package/editing-history/2026-06-27-0315-file-splits.md +0 -17
  100. package/editing-history/2026-06-27-0416-agent-advanced-split.md +0 -15
  101. package/editing-history/archived/2025-04-12-1453-map-to-record-rewrite.md +0 -33
  102. package/editing-history/archived/2025-04-16-0117-wasm-codegen-and-catalog-update.md +0 -40
  103. package/editing-history/archived/2025-07-16-0207-wasm-encoder-migration.md +0 -48
  104. package/editing-history/archived/2025-07-16-1633-wasm-data-structures.md +0 -61
  105. package/editing-history/archived/2026-02-13-1926-docs-tests-followup.md +0 -33
  106. package/editing-history/archived/2026-02-16-2128-docs-smoke-and-trait-errors.md +0 -20
  107. package/editing-history/archived/2026-02-25-1234-watch-mode-default-once.md +0 -5
  108. package/editing-history/archived/2026-03-07-1302-calcit-agent-docs-update.md +0 -32
  109. package/editing-history/archived/2026-03-09-1819-add-test-fail-script.md +0 -5
  110. package/editing-history/archived/2026-03-09-1944-split-type-fail-tests.md +0 -8
  111. package/editing-history/archived/2026-03-16-1449-profiling-tools-reorg.md +0 -13
  112. package/editing-history/archived/2026-03-17-2026-afternoon-runtime-boundary-optimization-summary.md +0 -87
  113. package/editing-history/archived/2026-03-18-1802-tips-level-and-overwrite-schema-preservation.md +0 -26
  114. package/editing-history/archived/2026-03-20-1229-query-window-3-with-parent-preview.md +0 -72
  115. package/editing-history/archived/2026-03-23-1137-command-echo-tool-output-cleanup.md +0 -71
  116. package/editing-history/archived/2026-04-10-0011-snapshot-empty-version-pipe-marker.md +0 -23
  117. package/editing-history/archived/2026-04-16-0131-wasm-math-and-test-integration.md +0 -28
  118. package/editing-history/archived/2026-04-16-1507-wasm-data-structures-and-rfc-rename.md +0 -27
  119. package/editing-history/archived/2026-04-16-1520-wasm-bitwise-and-match.md +0 -21
  120. package/editing-history/archived/2026-04-16-1542-wasm-cross-ns-host-imports.md +0 -38
  121. package/editing-history/archived/2026-04-17-0026-wasm-rest-args.md +0 -62
  122. package/editing-history/archived/2026-04-17-0048-wasm-type-of.md +0 -70
  123. package/editing-history/archived/2026-04-17-0051-wasm-derived-predicates.md +0 -34
  124. package/editing-history/archived/2026-04-17-2316-wasm-do-println-fixes.md +0 -41
  125. package/editing-history/archived/2026-04-18-1208-split-emit-wasm-and-bump-version.md +0 -15
  126. package/editing-history/archived/2026-04-18-1430-wasm-list-match-and-method-dispatch.md +0 -5
  127. package/editing-history/archived/2026-04-18-2041-cr-wasm-split-and-runtime-stability.md +0 -18
  128. package/editing-history/archived/2026-04-18-2045-v0.12.23-ci-wasm-fix.md +0 -13
  129. package/editing-history/archived/2026-04-21-1818-wasm-string-ops-v2.md +0 -57
  130. package/editing-history/archived/2026-04-21-2332-split-emit-wasm.md +0 -45
  131. package/editing-history/archived/2026-04-22-0114-wasm-hof-intercepts-and-set-intersection.md +0 -82
  132. package/editing-history/archived/2026-04-22-0136-wasm-enum-tuple-bool-str-fixes.md +0 -68
  133. package/editing-history/archived/2026-04-22-1340-wasm-map-diff-new-and-let-intercept.md +0 -53
  134. package/editing-history/archived/2026-04-23-1419-v0.12.26-wasm-bisection-fixes.md +0 -7
  135. package/editing-history/archived/2026-04-23-1645-release-conventions.md +0 -14
  136. package/editing-history/archived/2026-04-25-1940-wasm-suite-multi-module-entry.md +0 -53
  137. package/editing-history/archived/2026-04-25-2003-wasm-method-includes-string-and-set-refactor.md +0 -71
  138. package/editing-history/archived/2026-04-25-2010-wasm-suite-add-fn-lens-edn.md +0 -43
  139. package/editing-history/archived/2026-04-25-2051-display-by.md +0 -39
  140. package/editing-history/archived/2026-04-28-1728-fix-gensym-stable.md +0 -31
  141. package/editing-history/archived/2026-04-29-1400-fix-bind-type-precompile.md +0 -38
  142. package/editing-history/archived/2026-05-26-0957-match-docs-check-md.md +0 -24
  143. package/editing-history/archived/2026-05-31-2059-ci-docs-test-and-fn-helper-tightening.md +0 -3
  144. package/editing-history/archived/2026-06-01-0005-release-0.12.36.md +0 -16
  145. package/editing-history/archived/2026-06-01-2230-enum-struct-payload-docs.md +0 -4
  146. package/editing-history/archived/2026-06-03-1620-release-0.12.38.md +0 -6
  147. package/editing-history/archived/2026-06-04-0000-release-0.12.39.md +0 -4
  148. package/editing-history/archived/2026-06-04-2230-release-0.12.40.md +0 -5
  149. package/editing-history/archived/2026-06-12-1525-weak-types-dots-format.md +0 -15
  150. package/editing-history/archived/2026-06-13-1200-primitive_schema_tags.md +0 -9
  151. package/editing-history/archived/2026-06-20-1142-ts-declaration-d-mts.md +0 -5
  152. package/editing-history/archived/2026-06-29-0117-upgrade-doc-snapshot-migration.md +0 -2
  153. package/editing-history/archived/2026-06-29-calcit-cli.md +0 -80
  154. package/editing-history/archived/2026-06-29-typed-calcit-cli-schemas.md +0 -23
  155. package/editing-history/archived/20260630-duplication-analysis.md +0 -116
@@ -1,70 +0,0 @@
1
- # WASM codegen: implement `type-of` via heap type headers
2
-
3
- ## 背景
4
-
5
- 在 WASM 子集里实现 `type-of` 是解锁 ~20 个核心函数(`list?`、`map?`、`set?`、
6
- `number?` 等)的前置。所有值统一用 f64 表示,堆对象是“整数值 f64”的指针
7
- (byte offset);没有 NaN-boxing,无法仅凭位模式区分类型。
8
-
9
- ## 方案
10
-
11
- 每一次堆分配前置 8 字节类型头:
12
-
13
- ```
14
- raw_base + 0 : i32 MAGIC (0xCA1C17A9)
15
- raw_base + 4 : i32 tag_id (BUILTIN_TYPE_TAGS 里的下标对应的 tag_index 值)
16
- raw_base + 8 : 原本的 payload
17
- ```
18
-
19
- `emit_bump_alloc` / `emit_bump_alloc_dynamic` 实际申请 `byte_size + 8` 字节,
20
- 返回的 **logical pointer** 仍然是 `raw_base + 8`,所以所有既有 offset 算术
21
- (count at offset 0、fields at offset 8/16/…)无需改动。
22
-
23
- ### 11 个内建 type tag
24
-
25
- `BUILTIN_TYPE_TAGS = ["nil","bool","number","tag","string","list","map","set",
26
- "record","tuple","fn"]`。在 `collect_all_tags_from` 第一步 seed,确保
27
- `:list` / `:map` 等关键字字面量和 `type-of` 返回值落到同一个 tag id。
28
-
29
- ### `type-of` 运行时判定
30
-
31
- ```
32
- if v == trunc(v) // 整数
33
- && v >= (HEAP_START + 8) // 在堆范围内
34
- && v < current_heap_ptr {
35
- raw_base = trunc(v) - 8
36
- if load_i32(raw_base, 0) == MAGIC { // 魔数校验,排除纯数字误判
37
- return f64(load_i32(raw_base, 4)) // 返回 tag id
38
- }
39
- }
40
- return f64(number_tag)
41
- ```
42
-
43
- 之前只用“整数 + 在堆范围”做判定时,`42` 这类数字会被错误识别成指针 →
44
- 读到垃圾 tag;加上 `MAGIC` 校验后 `test-type-of-number` 通过。
45
-
46
- ## 踩坑
47
-
48
- 1. **签名顺序**:`emit_bump_alloc` 的参数顺序从
49
- `(ctx, byte_size, type_tag, ptr_local)` 调整为
50
- `(ctx, byte_size, ptr_local, type_tag)`,以匹配 21 处调用点的脚本化改写。
51
- 2. **Magic 必须**:只有“指针范围 + 整数值”不足以区分指针和裸数字,必须加
52
- 唯一性较高的 magic(这里用 `0xCA1C17A9`)。
53
- 3. **f64 ↔ i32**:`tag_id` 是小整数,用 i32 存取更便宜;新增
54
- `mem_arg_i32` 辅助函数(align=2)。
55
- 4. **If/Else 嵌套返回 f64**:`type-of` 用两层 `BlockType::Result(ValType::F64)`
56
- 实现短路,避免在非指针情况下去读内存。
57
-
58
- ## 测试
59
-
60
- `calcit/test-wasm.cirru` + `scripts/test-wasm.mjs` 新增 5 个用例:
61
- `test-type-of-list/map/set/number/tuple`。全部返回 1(`&= (type-of x) :list`
62
- 之类比较)。已执行 `cargo fmt && cargo clippy --release -- -D warnings &&
63
- cargo test --release && yarn check-all`,全部通过。
64
-
65
- ## 后续
66
-
67
- 解锁后可以把 `list?` / `map?` / `set?` / `number?` / `tuple?` / `record?`
68
- 等 proc 映射成 `(&= (type-of x) :xxx)` 或直接基于 tag 比较。下一轮挑战:
69
- 字符串支持 (24 个 skip)、nested defn/闭包 (19 个 skip)、`foldl` /
70
- `foldl-shortcut` (13 个 skip)。
@@ -1,34 +0,0 @@
1
- # WASM codegen: test derived type predicates on top of `type-of`
2
-
3
- ## 背景
4
-
5
- 刚在上一条 commit 里把 `type-of` 跑通了,语料里 `calcit.core` 的几个核心
6
- predicates (`list?` / `map?` / `number?` / `set?` / `tuple?` / ...) 都是
7
- `(defn pred? (x) (&= (type-of x) :tag))` 这种薄包装。既然 `type-of`、`&=`、
8
- keyword 字面量都已经支持,这些 predicate 本来就会被 WASM 编译器吐出来,
9
- 只是一直缺少验证。
10
-
11
- ## 改动
12
-
13
- `calcit/test-wasm.cirru` + `scripts/test-wasm.mjs` 增加 4 个样例:
14
-
15
- - `test-list?-true` : `(list? ([] 1 2))` → 1
16
- - `test-list?-false` : `(list? 42)` → 0 (验证魔数检查能挡住整数伪装)
17
- - `test-number?-true` : `(number? 42)` → 1
18
- - `test-map?-true` : `(map? (&{} :a 1))` → 1
19
-
20
- `yarn check-all` 全部通过,81 个 WASM 检查全绿。
21
-
22
- ## 当前 WASM skip 分类(跑 `cr wasm` 的 stderr)
23
-
24
- 总计 123 条 skipping,主要集中在:
25
-
26
- - 24 String values not yet supported
27
- - 19 nested defn not supported
28
- - 13 foldl / foldl-shortcut / foldr-shortcut
29
- - 7 `&call-spread`
30
- - 4 `Tuple operation %:: not yet supported`
31
- - 3 `&set:destruct`
32
- - 少量其它(`sort`, `range`, `println`, `deref`, `turn-string` 等)
33
-
34
- 下一轮切入点优先级:字符串 → nested defn/闭包 → 高阶函数 (`call_indirect`)。
@@ -1,41 +0,0 @@
1
- # 202604172316 — WASM `do` body 与 println host import 修复
2
-
3
- ## 修复内容
4
-
5
- ### 1. `do` 在 defn body 中的 WASM 编译问题
6
-
7
- **现象**:`defn test-println () do (println 42) 1` 编译后生成 `f64.const 0`(函数体为空)。
8
-
9
- **根因**:Cirru 语法中 `defn f () do expr1 expr2` 解析为 `(defn f () do expr1 expr2)`,body 数组为 `[do, expr1, expr2]` 三个独立元素(不是 `[(do expr1 expr2)]`)。`do` 作为裸 Import 节点出现在 `emit_expr` 时,触发 "unsupported WASM expression" 错误,导致函数被跳过并 fallback 为 `f64.const 0`。
10
-
11
- **修复**:在 `emit_expr` 中为 `Calcit::Import { def: "do" }` 添加特例,将其视为 no-op(emit 0.0 后由 `emit_body` 的 Drop 消耗掉)。
12
-
13
- ```rust
14
- // `do` as bare body expression is a no-op sequencer
15
- Calcit::Import(import) if import.def.as_ref() == "do" => {
16
- ctx.emit(f64_const(0.0));
17
- }
18
- ```
19
-
20
- ### 2. io.log_value host import(WASM println)
21
-
22
- - WASM codegen 对 `println`/`eprintln`/`echo` 调用 host import `io.log_value`。
23
- - `test-wasm.mjs` 提供 `io.log_value` 实现:读取堆内存判断类型,字符串解码 UTF-8,数字直接输出。
24
- - 添加 `test-println` 测试用例验证功能。
25
-
26
- ### 3. TypeScript 运行时 BufList 修复
27
-
28
- `_$n_buf_list_$o_concat` 中 `CalcitSliceList` 的 `items` 是方法而非属性,需调用 `xs.items()` 并手动迭代 Generator(TS 配置不支持 `for...of` Generator)。
29
-
30
- ## 受影响文件
31
-
32
- - `src/codegen/emit_wasm.rs`:`emit_expr` 新增 `do` no-op 特例;`emit_call_expr` Import 分支也保留 `do` 处理(用于 `(do ...)` 调用形式)
33
- - `ts-src/calcit.procs.mts`:修正 `_$n_buf_list_$o_concat` 迭代逻辑
34
- - `calcit/test-wasm.cirru`:新增 `test-println`
35
- - `scripts/test-wasm.mjs`:新增 `io.log_value` 实现与 `test-println` 断言
36
-
37
- ## 关键经验
38
-
39
- - `do` 在 Calcit defn body 中是语法糖/占位符,预处理后展开为多个独立 body 表达式,不是 `(do ...)` 调用形式。WASM codegen 需将其视为 no-op。
40
- - WASM 编译错误时 fallback 为 `f64.const 0`(静默),调试时需检查 stderr 中的 `[wasm] skipping` 日志。
41
- - TS 的 Generator 不能直接 `for...of`,需手动调用 `.next()`。
@@ -1,15 +0,0 @@
1
- ## Summary
2
-
3
- - Split the WASM code generator so `src/codegen/emit_wasm.rs` keeps orchestration while runtime helpers, method dispatch, and record/tuple emitters live in dedicated submodules.
4
- - Bumped the Calcit patch version from `0.12.20` to `0.12.21` for the next release.
5
-
6
- ## Module Layout
7
-
8
- - `src/codegen/emit_wasm/runtime.rs` now owns host import definitions, module assembly, and internal runtime helper builders.
9
- - `src/codegen/emit_wasm/methods.rs` now owns dynamic method dispatch and rest-arg call argument packing.
10
- - `src/codegen/emit_wasm/records.rs` now owns record and tuple emission helpers.
11
-
12
- ## Notes
13
-
14
- - The split is intended to be behavior-preserving; no WASM semantics were changed as part of this refactor.
15
- - Version strings were updated in `Cargo.toml`, `package.json`, and `lib/package.json`, while generated JS version text will be refreshed by the validation build.
@@ -1,5 +0,0 @@
1
- - WASM export names now stay unique by qualifying only colliding defs with `ns/def`.
2
- - `list-match` macro now uses `&list:empty?` after the existing list guard, avoiding the unsupported generic `empty?` invoke path in WASM.
3
- - Added minimal `Calcit::Method` handling in WASM for dynamic `.empty?`, `.count`, `.nth`, and `.get` calls.
4
- - `&tuple:nth` in WASM now accepts dynamic indices instead of literal-only indices.
5
- - Verified `yarn try-all` still passes in calcit after the WASM changes.
@@ -1,18 +0,0 @@
1
- # 2026-04-18 20:41 CR WASM Split and Runtime Stability
2
-
3
- ## 关键修改
4
-
5
- - 将 `cr wasm` 拆分为独立二进制 `cr-wasm`,避免主 `cr` 命令体积和职责继续膨胀。
6
- - `calcit` 的 WASM 相关验证脚本和 CI 调整为优先走 `cr-wasm`。
7
- - 修复 `emit_wasm` 中 map/set/tuple 相关回归点,恢复 `yarn check-all` 的可通过性。
8
- - 修复 `recollect` 在 Rust 运行时下的 `patch-map` 路径,避免本地变量解析异常导致测试阻断。
9
- - 将 `recollect` 的 wasm 测试分为核心 smoke(阻断)与扩展 probes(非阻断),保证 wasm 独立验证但不影响 rust/js 主链路。
10
- - 版本提升到 patch:`0.12.22`。
11
-
12
- ## 经验与注意事项
13
-
14
- - 对运行时快照文件(`calcit.cirru` / legacy `compact.cirru`)的修改必须通过 `cr edit`/`cr tree` 完成,避免文本直接编辑破坏结构。
15
- - 在多项目联动(calcit + recollect)场景下,发布前验证至少应覆盖:
16
- - calcit: `yarn check-all`
17
- - recollect: `yarn test:cr`、`yarn test:js`、`yarn test:wasm`
18
- - macOS 上遇到 `iconv` 链接问题时,需带 `SDKROOT` 执行构建命令进行最终回归确认。
@@ -1,13 +0,0 @@
1
- # 2026-04-18 20:45 v0.12.23 CI WASM Fix
2
-
3
- ## 变更摘要
4
-
5
- - 解决 GitHub Actions `try wasm` 步骤失败(exit 127)的问题。
6
- - 原因:workflow 直接调用 `./target/debug/cr-wasm`,但未提前构建二进制。
7
- - 修复:在 `.github/workflows/test.yaml` 的 wasm 步骤中先执行 `cargo build --bin cr-wasm`,再运行 `scripts/test-wasm.sh`。
8
- - 版本升级:`0.12.22` -> `0.12.23`(`Cargo.toml` 与 `package.json` 同步)。
9
-
10
- ## 验证
11
-
12
- - 本地 `cargo check` 通过。
13
- - 后续以推送后的 Actions `Test` 工作流成功作为发布门禁,再创建 GitHub Release。
@@ -1,57 +0,0 @@
1
- # WASM String Ops 扩展 v2
2
-
3
- ## 本次修改概要
4
-
5
- 继上一轮字符串实现(count/nth/first/rest/slice/concat/compare)之后,补充剩余实用 API。
6
-
7
- ## 新增 API
8
-
9
- | Proc | 实现位置 | 说明 |
10
- |------|----------|------|
11
- | `&str:contains?` | `emit_str_contains` | 字节索引范围检查:`byte_len > idx` |
12
- | `&str:find-index` | `__rt_str_find_index` (runtime.rs) | 朴素 O(n·m) 字节子串搜索,返回偏移或 -1 |
13
- | `&str:includes?` | `emit_str_includes` | 调用 `find-index`,判断 `>= 0` |
14
- | `&str:pad-left` | `__rt_str_pad_left` (emit_wasm.rs) | 循环填充 pattern 字节于左侧 |
15
- | `&str:pad-right` | `__rt_str_pad_right` (emit_wasm.rs) | 循环填充 pattern 字节于右侧 |
16
-
17
- ## 关键实现细节
18
-
19
- ### `__rt_str_find_index`
20
-
21
- - 放在 `runtime.rs`,不需要 `str_tag_id`(只读不分配)
22
- - 使用双层嵌套 Loop/Block 结构,WASM 控制流通过 `Br(N)` 跳出多层
23
- - 空 needle 返回 0.0;needle 长于 haystack 返回 -1.0
24
- - `Br(5)` 从内层 If 跳出到 `$outer` Block 返回找到的索引
25
-
26
- ### `__rt_str_pad_left` / `__rt_str_pad_right`
27
-
28
- - 放在 `emit_wasm.rs`,接受 `str_tag_id: i32` 参数(需分配 tagged 堆内存)
29
- - 早退条件:`str_len >= target_size` 直接返回原指针
30
- - 使用 j 变量追踪 pattern 偏移,超出 pat_len 时归零,避免 modulo 除法
31
- - 注册在 `build_runtime_fns` 之后(与 `__str_new` 同一阶段)
32
-
33
- ### `emit_str_contains` 修复
34
-
35
- 初始版本使用 `I32LtU`(`byte_len < idx`)导致逻辑反转,修正为 `I32GtU`(`byte_len > idx`)。
36
-
37
- ## 测试
38
-
39
- 新增 8 个测试函数(`test-wasm.main`):
40
- - `test-str-contains-true` → 1
41
- - `test-str-contains-false` → 0
42
- - `test-str-find-index-found` → 1("ell" 在 "hello" 偏移 1)
43
- - `test-str-find-index-not-found` → -1
44
- - `test-str-includes-true` → 1
45
- - `test-str-includes-false` → 0
46
- - `test-str-pad-left` → 5(`pad-left "hi" 5 "-"` → "---hi",count=5)
47
- - `test-str-pad-right` → 5(`pad-right "hi" 5 "-"` → "hi---",count=5)
48
-
49
- `yarn try-wasm` 全部通过(release build)。
50
-
51
- ## 文件变更
52
-
53
- - `src/codegen/emit_wasm/runtime.rs`:新增 `build_rt_str_find_index`,在 `build_runtime_fns` 中注册
54
- - `src/codegen/emit_wasm.rs`:新增 `build_str_pad_left_fn`、`build_str_pad_right_fn`、`emit_str_contains`、`emit_str_find_index`、`emit_str_includes`、`emit_str_pad_left`、`emit_str_pad_right`;修复 contains 比较方向
55
- - `calcit/test-wasm.cirru`:通过 `cr edit def` 添加 8 个测试定义
56
- - `scripts/test-wasm.mjs`:新增 8 个 `check()` 调用
57
- - `docs/wasm-codegen.md`:更新支持表格,移除已实现项
@@ -1,45 +0,0 @@
1
- # 202604212332 - Split emit_wasm.rs into focused submodules
2
-
3
- ## 背景
4
-
5
- `src/codegen/emit_wasm.rs` 原来有 6353 行,包含 WASM codegen 的所有逻辑,难以维护。
6
-
7
- ## 拆分方案
8
-
9
- 将文件按数据结构类别拆分为 6 个新子模块(位于 `src/codegen/emit_wasm/`):
10
-
11
- | 文件 | 行数 | 内容 |
12
- |------|------|------|
13
- | `heap.rs` | 266 | 内存管理:bump allocator、类型标签查找、哈希辅助函数 |
14
- | `lists.rs` | 1130 | 列表操作 + BufList + `emit_range` + `emit_list_distinct` |
15
- | `maps.rs` | 1157 | Map 基础操作 + merge/diff + `&map:destruct` + `&merge-non-nil` |
16
- | `sets.rs` | 828 | Set 操作 + `&set:destruct` |
17
- | `strings.rs` | 925 | 字符串操作 + pad + `build_str_*` runtime 函数 |
18
- | `hof.rs` | 423 | `resolve_callee_fn_idx`、`foldl`、`foldl-shortcut`、`foldr-shortcut` |
19
-
20
- 父文件 `emit_wasm.rs` 精简到 1656 行,保留:
21
- - 模块级 doc、import、常量、基础 helpers
22
- - `emit_wasm()` 公开入口函数
23
- - 所有结构体和 impl(`CompiledFn`、`WasmCompileEnv`、`WasmGenCtx`)
24
- - 编译管道函数(`extract_fn_parts`、`compile_fn`、`emit_body`)
25
- - 表达式 emitter(`emit_expr`、`emit_call_expr`、`emit_proc_call` 等)
26
- - Tag/String pool 收集
27
-
28
- ## 模块间可见性
29
-
30
- - 各子模块顶部均有 `use super::*;`(继承父模块 imports)
31
- - 所有导出函数使用 `pub(super) fn`(通过 Python 正则批量转换)
32
- - 父模块通过 `pub(super) use heap::*` 将 heap 辅助函数传播给兄弟模块
33
- - 父模块通过 `use lists::*; use maps::*; ...` 将各域函数引入 `emit_proc_call` 的作用域
34
-
35
- ## 实现技术
36
-
37
- 使用 Python 脚本(`scripts/split_emit_wasm.py`)自动化提取:
38
- - 精确定位每段的起止行(避免孤立的 doc comment)
39
- - 对非连续段(如 maps.rs 包含 4 段原文)进行拼接
40
- - `make_pub_super()` 批量将 `^fn ` 替换为 `pub(super) fn`
41
-
42
- ## 验证
43
-
44
- - `cargo check`:无错误,仅 1 个 `pub(super) use heap::*` 可见性警告(已用 `#[allow(unused_imports)]` 消除)
45
- - `./target/release/cr calcit/test-record.cirru`:测试全部通过
@@ -1,82 +0,0 @@
1
- # WASM HOF Intercepts & Set Intersection
2
-
3
- ## 修改概要
4
-
5
- 将 WASM codegen 的不支持 proc 数量从 72 减少到 68(减少 4 个)。
6
-
7
- ## 核心问题
8
-
9
- calcit.core 内部定义了 `map/filter/each/any?/every?/find/find-index` 等 HOF,其实现体使用 `f` 参数作为调用头——在 WASM codegen 中无法静态解析局部变量作为调用目标。解决方案:在**调用点拦截**(call-site intercept),在 `emit_call_expr` 中直接 emit 内联循环。
10
-
11
- ## 文件修改
12
-
13
- ### `src/codegen/emit_wasm/hof.rs`
14
-
15
- 新增以下函数(通过 `cat >>` 追加到文件末尾):
16
-
17
- - **`emit_unary_step`** — 对单参数 HOF callee 发出调用(支持 Static/Inline/Proc 三种 callee 类型)
18
- - **`emit_binary_step_ei`** — 对 `(elem, idx)` 双参数 callee 发出调用(用于 map-indexed)
19
- - **`resolve_unary_callee`** — 解析单参数 HOF callee,返回 `FoldlCallKind`
20
- - **`emit_map`** — `map xs f`:对每个元素调用 f,返回等长新列表
21
- - **`emit_map_indexed`** — `map-indexed xs f`:对每个 (elem, idx) 调用 f
22
- - **`emit_each`** — `each xs f`:对每个元素调用 f(副作用),返回 nil
23
- - **`emit_filter`** — `filter xs f`:过滤满足 f 的元素,返回新列表
24
- - **`emit_any`** — `any? xs f`:任意元素满足 f 返回 1.0,否则 0.0
25
- - **`emit_every`** — `every? xs f`:全部元素满足 f 返回 1.0,否则 0.0
26
- - **`emit_find`** — `find xs f`:返回第一个满足 f 的元素,否则 nil
27
- - **`emit_find_index`** — `find-index xs f`:返回第一个满足 f 的元素索引,否则 -1.0
28
-
29
- ### `src/codegen/emit_wasm/sets.rs`
30
-
31
- 新增:
32
- - **`emit_set_intersection`** — `&set:intersection a b`:返回两集合共有元素。逻辑与 `emit_set_difference` 对称,条件取反(`I32Ne` 代替 `I32Eq`)。
33
-
34
- ### `src/codegen/emit_wasm/lists.rs`
35
-
36
- 修改 **`emit_list_concat`**:从只支持 2-arg 改为支持任意数量 args(通过左折叠依次合并)。新增私有辅助函数 **`emit_list_concat_two`** 处理 2-arg 快速路径。
37
-
38
- ### `src/codegen/emit_wasm.rs`
39
-
40
- **`emit_call_expr` 的 `calcit.core` 拦截块** 新增:
41
- ```rust
42
- "map" if args_list.len() == 2 => return emit_map(ctx, &args_list),
43
- "map-indexed" if args_list.len() == 2 => return emit_map_indexed(ctx, &args_list),
44
- "each" if args_list.len() == 2 => return emit_each(ctx, &args_list),
45
- "filter" if args_list.len() == 2 => return emit_filter(ctx, &args_list),
46
- "any?" if args_list.len() == 2 => return emit_any(ctx, &args_list),
47
- "every?" if args_list.len() == 2 => return emit_every(ctx, &args_list),
48
- "find" if args_list.len() == 2 => return emit_find(ctx, &args_list),
49
- "find-index" if args_list.len() == 2 => return emit_find_index(ctx, &args_list),
50
- "concat" if args_list.len() >= 2 => return emit_list_concat(ctx, &args_list),
51
- "deref" if args_list.len() == 1 => return emit_expr(ctx, &args_list[0]),
52
- ```
53
-
54
- **`emit_proc_call`** 新增:
55
- ```rust
56
- CalcitProc::NativeSetIntersection => emit_set_intersection(ctx, args),
57
- ```
58
-
59
- **`emit_call_spread`** 新增 `Calcit::Proc` arm:
60
- ```rust
61
- Calcit::Proc(proc) => emit_call_spread_args_as_regular(ctx, proc, call_args),
62
- ```
63
-
64
- 新增辅助函数 **`emit_call_spread_args_as_regular`**:收集 spread 调用中的真实参数,跳过 ArgSpread 标记,转交 `emit_proc_call` 处理。
65
-
66
- ## 关键设计理解
67
-
68
- ### 调用点拦截 vs 定义编译
69
-
70
- - calcit.core 的 HOF 定义(如 `calcit.core/map`)内部使用 `f` 参数作为调用头,**定义本身无法编译**(会 skip)。
71
- - 拦截在 `emit_call_expr` 的 `Calcit::Import` arm,当用户代码调用 `(map my-list my-fn)` 时触发,直接 emit 内联循环,**无需编译 calcit.core/map 的定义体**。
72
- - 因此 skip 列表中仍可见 `calcit.core/map`(定义 skip),但用户代码的调用点正常生成 WASM。
73
-
74
- ### 剩余 68 个 skip 的分布
75
-
76
- - **核心库定义失败**(~66 个):使用运行时 spread(`& args`)、方法调用(`.deref`)、嵌套 defn、'f' 作为调用头等无法在 WASM 编译时静态解析的特性。
77
- - **用户代码 skip**(2 个):`recollect.app.comp.panel/on-click` 和 `recollect.test/test-diff-funcs`,均因内部使用了嵌套 defn(nested lambda)。
78
-
79
- ## 测试结果
80
-
81
- - `yarn test:wasm`:**全部通过**(=== Recollect WASM checks passed ===)
82
- - skip 数量:72 → 68(减少 4 个)
@@ -1,68 +0,0 @@
1
- # WASM Codegen: Enum Tuple, Bool Tag, and Str Fixes
2
-
3
- **Date**: 2026-04-22 01:36
4
- **Skip count**: 68 → 62 (6 fewer)
5
-
6
- ## Changes Made
7
-
8
- ### 1. `NativeEnumTupleNew` (`%::`) — New Dedicated Emitter
9
-
10
- **File**: `src/codegen/emit_wasm/records.rs`, `src/codegen/emit_wasm.rs`
11
-
12
- Added `emit_enum_tuple_new` for the `%::` proc (enum variant constructor).
13
-
14
- Key insight: `%::` always has the form `(%:: enum_class tag payload...)` where:
15
- - `enum_class` (args[0]) is for type-checking only — **ignored in WASM**
16
- - `tag` (args[1]) is the actual variant tag (Calcit::Tag)
17
- - `payload` (args[2..]) are the values
18
-
19
- This is distinct from `::` (`NativeTuple`) which uses `args[0]` as the tag directly.
20
-
21
- **Fixed functions**: `%ok`, `%err`, `%some`, `%none` — now compile correctly.
22
-
23
- Memory layout is identical to `::` tuples: `[count:f64][tag_id:f64][payload...]`.
24
-
25
- ### 2. Bool Support in `emit_tuple_new`
26
-
27
- **File**: `src/codegen/emit_wasm/records.rs`
28
-
29
- Extended `emit_tuple_new` to accept `Calcit::Bool` as the tag field:
30
- - `true` → `1.0`
31
- - `false` → `0.0`
32
-
33
- **Purpose**: The `foldl-shortcut` pattern uses `(:: true value)` and `(:: false value)` as tagged pairs for early-exit signaling. The `foldl-shortcut` implementation reads the tag at offset +8 and compares with `1.0`.
34
-
35
- **Fixed functions**: `calcit.core/index-of`, `calcit.core/&list:last-index-of` — these use `foldl-shortcut` with an inline `%index-of` defn that calls `(:: true idx)` / `(:: false ...)`.
36
-
37
- ### 3. Variadic `str` / `str-spaced` Call-Site Intercepts
38
-
39
- **File**: `src/codegen/emit_wasm/strings.rs`, `src/codegen/emit_wasm.rs`
40
-
41
- Added two new pub functions:
42
- - `emit_str_variadic(ctx, args)`: `(str a b c ...)` → left-fold of string concat
43
- - `emit_str_spaced(ctx, args)`: `(str-spaced a b c ...)` → join with space separator
44
-
45
- Private helper:
46
- - `concat_two_i32_ptrs(ctx, ptr_a, ptr_b)`: concatenates two strings from i32 ptr locals
47
-
48
- **Key technique**: `emit_turn_string` converts any f64 value to a string, then `concat_two_i32_ptrs` combines them without re-emitting expressions.
49
-
50
- For `str-spaced`, the space character is allocated dynamically (1-byte string with 0x20 written via `I32Store8`) to avoid depending on the string pool.
51
-
52
- **Intercept added in `emit_call_expr`** for `calcit.core` namespace:
53
- ```rust
54
- "str" if !args_list.is_empty() => return emit_str_variadic(ctx, &args_list),
55
- "str-spaced" if !args_list.is_empty() => return emit_str_spaced(ctx, &args_list),
56
- ```
57
-
58
- These intercepts help user code calling `str`/`str-spaced`; the core library definitions still fail because they use `(&syntax &)` variadic syntax.
59
-
60
- ## Remaining 62 Skips (Categorized)
61
-
62
- - **14 'f callee** (HOF defs): map, filter, each, find, foldl', update, etc.
63
- - **~9 nested defn**: &fn:apply, &fn:bind, &list:filter-pair, on-click, etc.
64
- - **~7 complex defn callee**: group-by, frequencies, repeat, zipmap, etc.
65
- - **3 `(&syntax &)`**: str, str-spaced, &str-spaced (definitions; call sites intercepted)
66
- - **3 method calls**: .slice, .filter, .deref (definition level)
67
- - **~4 variadic spread**: concat, mapcat, &list:flatten, &list:apply
68
- - **Others**: dissoc, conj, contains-in?, tagging-edn, impl-traits, etc.
@@ -1,53 +0,0 @@
1
- # 202604221340 - WASM map diff-new fix & let intercept
2
-
3
- ## 问题与修复
4
-
5
- ### 1. `&map:diff-new` 参数顺序错误 (`maps.rs`)
6
-
7
- **问题**: `emit_map_diff_new` 中 `args[0]` (b) 和 `args[1]` (a) 搞反,导致"b 中不在 a 里的条目"变成"a 中不在 b 里的条目"。结果 `patch-map` 的 map-splice 分支从来不添加新键,`recollect` API roundtrip 测试 `summary=41` 而不是预期的 44。
8
-
9
- **修复**: 交换 a/b 的加载顺序——先加载 `args[0]` 为 `b`,`args[1]` 为 `a`,迭代 b 检查每个 key 是否在 a 中缺失。
10
-
11
- ### 2. `calcit.core/let` WASM 拦截 (`emit_wasm.rs`)
12
-
13
- **问题**: `calcit.core/let` 以宏形式存在,正常编译会由预处理器展开为 `&let`,但作为 Import 出现在 call position 时 WASM codegen 找不到对应函数而报错。
14
-
15
- **修复**:
16
- - 在 `emit_call_expr` 的 `calcit.core` 拦截块中新增 `"let"` case
17
- - 新增 `emit_let_multi` + `emit_let_pairs` 辅助函数,将 `(let ((name val)...) body...)` 格式转换为逐层绑定
18
-
19
- ### 3. `{}` 空 map 字面量 WASM 支持 (`emit_wasm.rs`)
20
-
21
- **问题**: `{}` 作为裸表达式(非 call head)时,出现为 `calcit.core/{}` 的 Import 或 `CalcitProc::NativeMap`,WASM codegen 报 "unsupported WASM expression"。
22
-
23
- **修复**:
24
- - 在 `emit_expr` 的 `Calcit::Import` 分支加入 `def == "{}"` 的检查,调用 `emit_map_new(ctx, &[])`
25
- - 在 `emit_expr` 新增 `Calcit::Proc(CalcitProc::NativeMap)` case,调用 `emit_map_new`
26
-
27
- ### 4. recollect probe 函数 Cirru 语法修复
28
-
29
- **问题**: 7 个调试用 probe 函数缺少 `$` 运算符,导致 `let`/`&map:count`/`if` 等出现为裸表达式而非调用头:
30
- - `probe-nested-*` (4 个): `let ...` → `$ let ...`
31
- - `probe-*-map*` (3 个): `&map:count ...` → `$ &map:count ...`
32
- - `probe-nested-changes-count`: fn 内部 `if` → `$ if`
33
-
34
- **修复**: 用 `cr edit def --overwrite` 重写全部 7 个函数的 Cirru 语法。
35
-
36
- ## 测试结果
37
-
38
- - `yarn run:wasm:api` (recollect): `api-roundtrip summary=44 expected=44 OK` ✓
39
- - probe 函数全部通过 WASM 编译并返回正确结果:
40
- `probe-empty-map=0, probe-map-count-1=1, probe-assoc-simple=2`
41
- `probe-nested-bonus=3, probe-nested-count=10, probe-nested-map-count=2`
42
- - WASM skip 数量: 62 → 51(recollect namespace 中全部消除,仅剩 calcit.core HOF/closure/variadic 等已知不支持项)
43
-
44
- ## 剩余已知 skip 分类 (51 个)
45
-
46
- | 原因 | 数量 | 说明 |
47
- |------|------|------|
48
- | `'f` (动态调用头) | 26 | HOF 参数作函数调用,需函数表支持 |
49
- | nested defn | 9 | 函数内部嵌套 defn(闭包),不支持 |
50
- | `(&syntax &)` | 3 | 可变参数 `&`,str/str-spaced 已有拦截 |
51
- | sort | 1 | `&list:sort-by` 需要比较函数回调 |
52
- | recur arity | 1 | `conj` 内部尾递归 arity 不匹配 |
53
- | 特殊 proc | 2 | tagging-edn、&core-number-impls |
@@ -1,7 +0,0 @@
1
- - Fixed WASM `&str:nth` to return a one-character string or nil, matching native Calcit semantics.
2
- - Added string-content-aware `=` handling in WASM while keeping `identical?` as raw-value equality.
3
- - Inlined imported top-level value defs in WASM so string constants like `dictionary` are usable at runtime.
4
- - Fixed `nil?` lowering in WASM to match the backend's nil representation.
5
- - Corrected `&map:diff-new` argument semantics in WASM codegen.
6
- - Updated WASM tests/docs to match current `&str:nth` semantics.
7
- - Validated with `cargo clippy -- -D warnings`, `yarn compile`, `cargo test`, and `yarn check-all` before bumping version to `0.12.26`.
@@ -1,14 +0,0 @@
1
- # 发布流程规范与加速
2
-
3
- ## 本次改动
4
-
5
- - 更新 `Agents.md`:新增"发布流程规范"章节,记录版本升级、PR/tag 习惯、crates.io 加速措施
6
- - 更新 `.github/workflows/publish.yaml`:加入两项加速
7
- 1. `CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse`:加速 crates.io index 查找(分钟级 → 秒级)
8
- 2. `cargo publish --no-verify`:跳过发布前重复的编译验证,因为本地和 PR CI 已跑过
9
-
10
- ## 关键规范
11
-
12
- - 版本升级:`Cargo.toml` 和 `package.json` 两边同步改,再更新 `Cargo.lock`/`yarn.lock`
13
- - Tag 格式:`0.12.27`(无 `v` 前缀),与 commit 一起打,message 注明版本号
14
- - 分支开发,不自动合并;本地测试全过 → push PR → Actions 全过 → 手动合并
@@ -1,53 +0,0 @@
1
- # 202604251940 — wasm: 新增 test-wasm-suite 多模块入口
2
-
3
- ## 背景
4
-
5
- `test-wasm.cirru` 是手写的小型 WASM 测试用例集,已经通过;但
6
- `yarn check-all` 还会运行 `calcit/test-X.cirru` 一系列测试模块
7
- (test-cond / test-math / test-set / ...),目前 WASM target
8
- 还没有专门的入口把这些测试统一跑起来。
9
-
10
- ## 改动
11
-
12
- 1. 新增 `calcit/test-wasm-suite.cirru`:手写的 snapshot 文件,
13
- 通过 `:modules` 引入 `util.cirru` 与若干测试模块,自身定义
14
- `test-wasm-suite.main/main!` 依次调用各测试模块的 `main!`。
15
- - 当前包含:`util` + `test-cond` + `test-math` + `test-set` + `test-tuple`
16
- - `test-tuple/main!` 因 `&tuple:enum` 未实现,被 codegen 标为
17
- skip,main! 会以 `f64 0.0` 占位返回,对整体不产生副作用。
18
- 2. 新增 `scripts/test-wasm-suite-extended.sh`:编译并运行新入口的
19
- 一键脚本,输出 `[wasm] skipping ...` 的列表,便于后续逐步补齐
20
- proc 实现。
21
-
22
- ## 已知阻塞(短期不放进新入口)
23
-
24
- - `test-recursion`:`emit_bump_alloc` 与 closure-as-value 的交互产生
25
- 无效 WAT(`global.set __heap_ptr` 收到 f64),独立编译也会触发;
26
- 与目前 in-progress refactor(emit_set_find_structural / hash_list_or_set)
27
- 联动后表现尤其明显。
28
- - `test-list`:`local.set f64` 收到 i32(function 35 体内),bytes 模式
29
- 形如 `local.get a (i32) ; local.get b (i32) ; local.set c (f64)`。
30
- - `test-string`:`includes?` / `.find-index` / `starts-with?` /
31
- `strip-prefix` / `strip-suffix` 等字符串过程 WASM 未实现;
32
- `trim` / `blank?` / `parse-float` / `&str:replace` / `format-to-cirru` /
33
- `&cirru-quote:to-list` / `get-char-code` 同上。
34
- - `test-fn`:`(let f2 &+)` 把过程作为值放进局部变量,
35
- 当前 WASM 不支持 first-class proc,整个 `main!` 会被 skip。
36
- - `test-algebra`、`test-map`:旧的 `unreachable` 失败,与本次改动无关。
37
-
38
- ## 用法
39
-
40
- ```bash
41
- bash scripts/test-wasm-suite-extended.sh
42
- # 期望最后一行: [test-wasm-suite] PASS
43
- ```
44
-
45
- ## 后续步骤
46
-
47
- 1. 修 test-recursion 的 closure-as-value / bump_alloc 类型不一致
48
- (定位 `f64.const 0; local.tee Xf64; global.set __heap_ptr` 来源)。
49
- 2. 修 test-list 的 i32 ↔ f64 binding bug。
50
- 3. 实现 `includes?` / `starts-with?` / `ends-with?` / `strip-prefix` /
51
- `strip-suffix` / `.find-index` 等 string proc,把 test-string 的
52
- `test-includes` 子集放进新入口。
53
- 4. 实现 `&tuple:enum` 等 tuple 操作,让 test-tuple/main! 不再被 skip。