Repository navigation
Commit 2861ef7
committed
refactor(codegen): extract schema/field-access helpers into schema.rs
Move 44 schema/type-layout methods into src/codegen/schema.rs (~1,503
extracted lines), covering:
- Schema bounds and size checks (emit_loaded_schema_bounds_check,
emit_loaded_schema_exact_size_check)
- Molecule table field helpers (emit_molecule_table_field_bounds_to_t5,
emit_molecule_table_field_span_to_t5_t6)
- Cell metadata/field hash equality (emit_cell_metadata_equality,
emit_cell_field_hash_equality)
- Fixed-field pointer loading (emit_loaded_fixed_field_pointer_to_stack,
emit_dynamic_fixed_field_pointer_to_stack)
- Dynamic table field helpers (emit_dynamic_table_field_equality_check,
emit_dynamic_table_field_span_to_stack,
emit_dynamic_table_fixed_field_pointer_to_stack)
- Loaded field comparison (emit_loaded_field_equals_expected,
emit_loaded_fixed_bytes_against_source, emit_loaded_field_bytes_equals_expected)
- Fixed-byte source/comparison (emit_fixed_byte_source_byte_to,
emit_fixed_byte_comparison, expected_fixed_byte_source,
emit_generic_fixed_byte_comparison, emit_store_fixed_byte_const_to_scratch)
- u128 and prelude value resolution (operand_is_u128,
emit_u128_add_sub_with_u64, emit_prelude_u64_value_source_to_t1,
emit_schema_field_source_to_t1, emit_expected_operand_to_t1)
- Schema field source preparation (emit_prepare_schema_field_source,
emit_schema_field_source_pointer_to)
- Field access dispatch (emit_schema_field_access,
emit_dynamic_schema_field_access, emit_aggregate_field_access,
emit_tuple_call_return_field_access, emit_generic_field_access)
Also includes cargo fmt pass across existing submodules.
Visibility changes in mod.rs:
- Extracted methods: fn -> pub(crate) fn
- Types: SchemaFieldLayout, ExpectedFixedByteSource,
SchemaFieldValueSource, PreludeU64ValueSource, PreludeU64OperandSource,
SourcePointer -> pub(crate)
- Constants: CKB_SOURCE_INPUT, CKB_SOURCE_OUTPUT,
CKB_CELL_FIELD_{CAPACITY,LOCK_HASH,TYPE_HASH},
RUNTIME_SCRATCH_BUFFER_SIZE, RUNTIME_EXPR_TEMP_SLOTS -> pub(crate)
- Free function: fixed_byte_const_bytes -> pub(crate)
File sizes:
- mod.rs: 8,671 -> 7,168 lines (1,503 removed)
- schema.rs: 1,525 lines (new)
- assembler/runtime/abi/collections: fmt-only changes
All green: cargo check 0 warnings, 686/686 tests, clippy clean,
5/5 assembly snapshots unchanged.1 parent da59d95 commit 2861ef7
6 files changed
Lines changed: 1616 additions & 1580 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
661 | | - | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
662 | 668 | | |
663 | 669 | | |
664 | 670 | | |
| |||
1895 | 1901 | | |
1896 | 1902 | | |
1897 | 1903 | | |
1898 | | - | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
0 commit comments