Skip to content

experiment: 32bit eop scaffolding#5916

Draft
alexandru-uta wants to merge 21 commits intomasterfrom
alex/32bit-eop
Draft

experiment: 32bit eop scaffolding#5916
alexandru-uta wants to merge 21 commits intomasterfrom
alex/32bit-eop

Conversation

@alexandru-uta
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 18, 2026

Comparing from c42a9b9 to 2dfb9fc:
In terms of gas, no changes are observed in 5 tests.
In terms of size, 5 tests regressed and the mean change is +0.0%.

Alexandru Uta and others added 12 commits March 18, 2026 11:14
Master added Float32 with inline tagging constants in compile_enhanced.ml,
but the branch moved tagging into B.TaggingScheme (backend_impl.ml).
The merge correctly removed the inline code, but Float32 cases were
never added to the backend modules, causing an assertion failure.

Made-with: Cursor
Address all medium-severity issues found during the audit of the
Backend32 instantiation of the compile_enhanced functor:

- M1: narrow_to_32 is now identity on 32-bit (was ill-typed with i64 ops)
- M2: candid_type_offset_size uses B.word_size_in_bytes instead of 8L
- M3+M4: Float32 boxed via Bits64 F (promote/demote) on 32-bit;
  Backend32.TaggingScheme asserts on Float32 (can't bit-tag in 32 bits)
- M6: EOP metadata string parameterized by B.word_size
- M7: GC instruction counters use i64 globals/arithmetic (matching
  classical backend), avoiding truncation on 32-bit
- M8: buffer_size overflow guard uses i64 accumulator unconditionally,
  matching the classical backend's safety guarantees

None of these affect the active 64-bit backend; they prepare the
dormant 32-bit backend for future activation.

Made-with: Cursor
…ap_with

Raw Wasm i64.eqz test produces i32, but E.else_trap_with expects a
machine word (applies prepare_branch_condition internally). Use
compile_test_i64 which extends the i32 result back to the machine word.

Made-with: Cursor
The compact BigNum fast paths used Word64.compile_* (genuine i64 ops)
which would cause Wasm type mismatches on 32-bit where machine words
are i32. Replace with B.* operations that use the backend's word type.

Also fix missing extend_word_to_i64/extend_sword_to_i64 before RTS
calls (bigint_of_word64/bigint_of_int64 expect I64Type params), and
missing wrap_i64_to_word after Num.truncate_to_word64 before
BitTagged.tag (which expects machine word).

All changes are nops on 64-bit (B.* maps to i64 ops; extend/wrap are
identity), so no behavioral change for the existing backend.

Made-with: Cursor
@alexandru-uta alexandru-uta changed the title experiment: 32bit eop experiment: 32bit eop scaffolding Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant