wardite 0.8.2 → 1.0.0
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.
- checksums.yaml +4 -4
- data/LICENSE +191 -0
- data/Makefile +14 -0
- data/README.md +80 -1
- data/Rakefile +5 -0
- data/benchmark/README.md +500 -0
- data/benchmark/build_call_profile.rb +42 -0
- data/benchmark/call_cost_worker.rb +27 -0
- data/benchmark/compare.rb +93 -0
- data/benchmark/compare_call_types.rb +212 -0
- data/benchmark/compare_dispatch.rb +123 -0
- data/benchmark/compare_engines.rb +119 -0
- data/benchmark/compare_optimizations.rb +139 -0
- data/benchmark/engine_phases.rb +30 -0
- data/benchmark/figures/README.md +35 -0
- data/benchmark/figures/plot_spinel_comparison.py +137 -0
- data/benchmark/figures/spinel_new_vm_candlestick.png +0 -0
- data/benchmark/figures/spinel_new_vm_candlestick.svg +7615 -0
- data/benchmark/figures/spinel_new_vm_summary.csv +9 -0
- data/benchmark/figures/spinel_new_vm_summary.json +82 -0
- data/benchmark/float_m5.wat +42 -0
- data/benchmark/i32_call_arities.wat +89 -0
- data/benchmark/i32_calls.wat +174 -0
- data/benchmark/i32_memory.wat +58 -0
- data/benchmark/i32_mix.wat +80 -0
- data/benchmark/i64_m4.wat +55 -0
- data/benchmark/investigate_calls.rb +231 -0
- data/benchmark/investigate_generated_guards.rb +218 -0
- data/benchmark/m3_call_worker.rb +38 -0
- data/benchmark/measure_m1.rb +51 -0
- data/benchmark/measure_m2.rb +55 -0
- data/benchmark/measure_m3_calls.rb +89 -0
- data/benchmark/measure_m4.rb +134 -0
- data/benchmark/measure_m5_boundary.rb +41 -0
- data/benchmark/measure_wasi_write.rb +75 -0
- data/benchmark/optimization_worker.rb +23 -0
- data/benchmark/results/call_arities_exploratory_2026-11-04.json +4320 -0
- data/benchmark/results/call_arities_spinel_2026-11-04.json +1200 -0
- data/benchmark/results/call_cost_spinel_2026-11-04.json +2392 -0
- data/benchmark/results/call_protocol_exploratory_2026-11-04.json +3947 -0
- data/benchmark/results/call_protocol_profile_2026-11-04.json +383 -0
- data/benchmark/results/call_protocol_ruby_2026-11-04.json +1213 -0
- data/benchmark/results/call_protocol_spinel_2026-11-04.json +913 -0
- data/benchmark/results/call_types_ruby_2026-11-04.json +1212 -0
- data/benchmark/results/call_types_spinel_2026-11-04.json +923 -0
- data/benchmark/results/efflorescence-m1-cruby.json +799 -0
- data/benchmark/results/efflorescence-m1-spinel.json +799 -0
- data/benchmark/results/efflorescence-m2-bulk-loop.json +820 -0
- data/benchmark/results/efflorescence-m2-i32-cruby.json +799 -0
- data/benchmark/results/efflorescence-m2-i32-spinel.json +799 -0
- data/benchmark/results/efflorescence-m2-memory.json +408 -0
- data/benchmark/results/generated_guards_exploratory_2026-11-04.json +1225 -0
- data/benchmark/results/generated_guards_profile_2026-11-04.json +592 -0
- data/benchmark/results/generated_guards_spinel_2026-11-04.json +1650 -0
- data/benchmark/results/generated_guards_validation_2026-11-04.json +256 -0
- data/benchmark/results/inlining_engines_2026-11-04.json +241 -0
- data/benchmark/results/inlining_ruby_2026-11-04.json +1213 -0
- data/benchmark/results/inlining_spinel_2026-11-04.json +893 -0
- data/benchmark/results/operand_decode_exploratory_2026-11-04.json +1319 -0
- data/benchmark/results/operand_decode_ruby_2026-11-04.json +1213 -0
- data/benchmark/results/operand_decode_spinel_2026-11-04.json +924 -0
- data/benchmark/results/selective_reset_spinel_2026-11-04.json +454 -0
- data/benchmark/results/selective_reset_spinel_2026-11-04_exploratory.json +2679 -0
- data/benchmark/results/spinel_fetch_root_patch_2026-11-04.json +4523 -0
- data/benchmark/results/while_final_compiler_comparison_2026-11-04.json +324 -0
- data/benchmark/results/while_patched_external_2026-11-04.json +220 -0
- data/benchmark/results/while_user_unpatched_2026-11-04.json +230 -0
- data/benchmark/summarize_call_profile.py +54 -0
- data/benchmark/validate_m1_eh.rb +34 -0
- data/benchmark/validate_m2.rb +119 -0
- data/benchmark/validate_m3.rb +44 -0
- data/benchmark/validate_m4.rb +95 -0
- data/benchmark/validate_m5.rb +108 -0
- data/docs/adr/0001-efflorescence-m1-control-and-eh.md +319 -0
- data/docs/adr/0002-efflorescence-m2-memory-and-globals.md +185 -0
- data/docs/adr/0003-efflorescence-m3-host-and-indirect-calls.md +228 -0
- data/docs/adr/0004-efflorescence-m4-i64.md +202 -0
- data/docs/adr/0005-efflorescence-m5-floating-point.md +127 -0
- data/docs/adr/0006-efflorescence-m6-coverage-parity.md +101 -0
- data/docs/efflorescence-call-arities.md +115 -0
- data/docs/efflorescence-call-investigation.md +155 -0
- data/docs/efflorescence-call-transfer.md +128 -0
- data/docs/efflorescence-call-types.md +102 -0
- data/docs/efflorescence-coverage-ja.md +351 -0
- data/docs/efflorescence-generated-c-guards.md +405 -0
- data/docs/efflorescence-inlining.md +165 -0
- data/docs/efflorescence-ja.md +155 -0
- data/docs/efflorescence-m1.md +160 -0
- data/docs/efflorescence-m2.md +233 -0
- data/docs/efflorescence-m3.md +131 -0
- data/docs/efflorescence-m4.md +88 -0
- data/docs/efflorescence-m5.md +82 -0
- data/docs/efflorescence-m6.md +95 -0
- data/docs/efflorescence-operand-decoding.md +105 -0
- data/docs/efflorescence-phase2-ja.md +225 -0
- data/docs/efflorescence-phase2.md +240 -0
- data/docs/efflorescence-register-initialization.md +75 -0
- data/docs/efflorescence.md +144 -0
- data/docs/spinel-string-aset-inplace-proposal.md +200 -0
- data/examples/load_perf.rb +24 -0
- data/lib/wardite/alu_f32.generated.rb +13 -10
- data/lib/wardite/alu_f64.generated.rb +13 -10
- data/lib/wardite/alu_i32.generated.rb +38 -31
- data/lib/wardite/alu_i64.generated.rb +48 -48
- data/lib/wardite/cli/cli.rb +73 -22
- data/lib/wardite/const.rb +1 -0
- data/lib/wardite/convert.generated.rb +7 -5
- data/lib/wardite/efflorescence/float_arithmetic.rb +216 -0
- data/lib/wardite/efflorescence/i64_arithmetic.rb +257 -0
- data/lib/wardite/efflorescence/inspection.rb +165 -0
- data/lib/wardite/efflorescence/ir.rb +1151 -0
- data/lib/wardite/efflorescence/optimizer.rb +580 -0
- data/lib/wardite/efflorescence/register_validation.rb +290 -0
- data/lib/wardite/efflorescence/store_access.rb +271 -0
- data/lib/wardite/efflorescence/translator.rb +859 -0
- data/lib/wardite/efflorescence/vm.rb +1006 -0
- data/lib/wardite/efflorescence/wasi.rb +108 -0
- data/lib/wardite/efflorescence.rb +11 -0
- data/lib/wardite/errors.rb +20 -0
- data/lib/wardite/float_bits.rb +46 -0
- data/lib/wardite/instruction.rb +460 -69
- data/lib/wardite/leb128.rb +35 -17
- data/lib/wardite/load.rb +260 -159
- data/lib/wardite/revisitor.rb +12 -4
- data/lib/wardite/value.rb +169 -175
- data/lib/wardite/version.rb +1 -1
- data/lib/wardite/wasi/consts.rb +1 -0
- data/lib/wardite/wasm_module.rb +6 -3
- data/lib/wardite.rb +220 -105
- data/rbs_collection.lock.yaml +36 -96
- data/scripts/gen_alu.rb +90 -34
- data/scripts/templates/alu_module.rb.tmpl +7 -5
- data/scripts/templates/conv_module.rb.tmpl +7 -5
- data/sig/generated/wardite/alu_f32.generated.rbs +4 -3
- data/sig/generated/wardite/alu_f64.generated.rbs +4 -3
- data/sig/generated/wardite/alu_i32.generated.rbs +4 -3
- data/sig/generated/wardite/alu_i64.generated.rbs +4 -3
- data/sig/generated/wardite/cli/cli.rbs +13 -6
- data/sig/generated/wardite/const.rbs +2 -0
- data/sig/generated/wardite/convert.generated.rbs +4 -3
- data/sig/generated/wardite/efflorescence/float_arithmetic.rbs +65 -0
- data/sig/generated/wardite/efflorescence/i64_arithmetic.rbs +99 -0
- data/sig/generated/wardite/efflorescence/inspection.rbs +64 -0
- data/sig/generated/wardite/efflorescence/ir.rbs +881 -0
- data/sig/generated/wardite/efflorescence/optimizer.rbs +189 -0
- data/sig/generated/wardite/efflorescence/register_validation.rbs +76 -0
- data/sig/generated/wardite/efflorescence/store_access.rbs +134 -0
- data/sig/generated/wardite/efflorescence/translator.rbs +214 -0
- data/sig/generated/wardite/efflorescence/vm.rbs +179 -0
- data/sig/generated/wardite/efflorescence/wasi.rbs +47 -0
- data/sig/generated/wardite/errors.rbs +12 -0
- data/sig/generated/wardite/float_bits.rbs +30 -0
- data/sig/generated/wardite/instruction.rbs +35 -10
- data/sig/generated/wardite/leb128.rbs +3 -1
- data/sig/generated/wardite/load.rbs +38 -13
- data/sig/generated/wardite/value.rbs +70 -11
- data/sig/generated/wardite/wasi/consts.rbs +2 -0
- data/sig/generated/wardite.rbs +55 -18
- data/sig/vernier.rbs +3 -0
- data/spinel/README.md +30 -0
- data/spinel/bin/wardite.rb +6 -0
- data/spinel/spin.toml +7 -0
- metadata +128 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0d4da4f11b96b8ba754957752182019d0f5e1b398c857ff53aff1dd832976273
|
|
4
|
+
data.tar.gz: 51beb8eca890338b30d724f14625d2f61eaeddf43c541a6a24ba2486207e1d37
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e43c0e691c242623cc3e4acf622286d151e59793b7afcae6eed08d2291088446459ad91728e6f65b1997ee89f8a42753fc942622aea7f7e8b56f2da6b41b40d
|
|
7
|
+
data.tar.gz: 6122649785369333e8f6fc345d2b4717eee2579e56e5df50b76e72fc6dfd20a0bbc9f3332ce06a02c555b21e55e6318d191d2bb10271279045f2f920c62a694d
|
data/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, provided
|
|
115
|
+
that the attribution is reasonably visible to all users that
|
|
116
|
+
use the Derivative Works. You may add Your own attribution
|
|
117
|
+
notices within Derivative Works that You distribute, alongside
|
|
118
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
119
|
+
that such additional attribution notices cannot be construed
|
|
120
|
+
as modifying the License.
|
|
121
|
+
|
|
122
|
+
You may add Your own copyright statement to Your modifications and
|
|
123
|
+
may provide additional or different license terms and conditions
|
|
124
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
125
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
126
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
127
|
+
the conditions stated in this License.
|
|
128
|
+
|
|
129
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
130
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
131
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
132
|
+
this License, without any additional terms or conditions.
|
|
133
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
134
|
+
the terms of any separate license agreement you may have executed
|
|
135
|
+
with Licensor regarding such Contributions.
|
|
136
|
+
|
|
137
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
138
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
139
|
+
except as required for describing the origin of the Work and
|
|
140
|
+
reproducing the content of the NOTICE file.
|
|
141
|
+
|
|
142
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
143
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
144
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
145
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
146
|
+
implied, including, without limitation, any warranties or conditions
|
|
147
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
148
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
149
|
+
appropriateness of using or redistributing the Work and assume any
|
|
150
|
+
risks associated with Your exercise of permissions under this License.
|
|
151
|
+
|
|
152
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
153
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
154
|
+
unless required by applicable law (such as deliberate and grossly
|
|
155
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
156
|
+
liable to You for damages, including any direct, indirect, special,
|
|
157
|
+
incidental, or consequential damages of any character arising as a
|
|
158
|
+
result of this License or out of the use or inability to use the
|
|
159
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
160
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
161
|
+
other commercial damages or losses), even if such Contributor
|
|
162
|
+
has been advised of the possibility of such damages.
|
|
163
|
+
|
|
164
|
+
9. Accepting the License. You accept and agree to be bound by the
|
|
165
|
+
terms of this License by copying, modifying, or distributing the
|
|
166
|
+
Work (or works based on the Work).
|
|
167
|
+
|
|
168
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
169
|
+
|
|
170
|
+
To apply the Apache License to your work, attach the following
|
|
171
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
172
|
+
replaced with your own identifying information. (Don't include
|
|
173
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
174
|
+
comment syntax for the file format. We also recommend that a
|
|
175
|
+
file or class name and description of purpose be included on the
|
|
176
|
+
same "printed page" as the copyright notice for easier
|
|
177
|
+
identification within third-party archives.
|
|
178
|
+
|
|
179
|
+
Copyright 2025 Uchio Kondo
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
data/Makefile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
SPINEL ?= spinel
|
|
2
|
+
SPINELFLAGS ?= -O2
|
|
3
|
+
RUBY ?= ruby
|
|
4
|
+
BUILD_DIR ?= build
|
|
5
|
+
|
|
6
|
+
.PHONY: spinel spinel-test
|
|
7
|
+
|
|
8
|
+
# Keep inline RBS and the compiler's default integer overflow checks enabled.
|
|
9
|
+
spinel:
|
|
10
|
+
mkdir -p $(BUILD_DIR)
|
|
11
|
+
$(SPINEL) -I lib --strict-require $(SPINELFLAGS) exe/wardite -o $(BUILD_DIR)/wardite
|
|
12
|
+
|
|
13
|
+
spinel-test: spinel
|
|
14
|
+
WARDITE_SPINEL_BIN="$(abspath $(BUILD_DIR)/wardite)" $(RUBY) -Ilib:test -e 'Dir["test/e2e/spinel*_test.rb"].each { |path| require_relative path }'
|
data/README.md
CHANGED
|
@@ -58,12 +58,91 @@ $ wardite examples/test.wasm
|
|
|
58
58
|
#=> Test!
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
### Efflorescence register VM (experimental)
|
|
62
|
+
|
|
63
|
+
Use `--new-engine` to select the MIR-based register engine. The stack VM is the
|
|
64
|
+
default. The same option is available in Spinel builds.
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
wardite --new-engine --no-wasi --invoke add test/add.wasm 100 200
|
|
68
|
+
# return value: I32(300)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
In Ruby, pass `engine: :efflorescence` to `Wardite.new` or
|
|
72
|
+
`BinaryLoader.load_from_buffer`. Unsupported instructions raise an explicit
|
|
73
|
+
exception. See the [design, supported subset and tests](docs/efflorescence.md)
|
|
74
|
+
and [engine comparison benchmark](benchmark/README.md).
|
|
75
|
+
|
|
76
|
+
Efflorescence now includes independent COPY/immediate/branch/fusion passes,
|
|
77
|
+
flat integer bytecode and frame reuse. Execution always uses flat bytecode,
|
|
78
|
+
including with `--mir-disable all`; there is no `flat` optimization switch.
|
|
79
|
+
Use `--mir-disable NAME` to compare
|
|
80
|
+
individual features, `--mir-dump` to inspect MIR and `--mir-profile` for counters.
|
|
81
|
+
See [Phase 2](docs/efflorescence-phase2.md) ([日本語](docs/efflorescence-phase2-ja.md)).
|
|
82
|
+
|
|
83
|
+
[M1](docs/efflorescence-m1.md) adds the remaining basic i32 operations,
|
|
84
|
+
if/else/select/br_table, and new exception handling (try_table/throw/throw_ref).
|
|
85
|
+
Tags can carry numeric payloads. Nullable exnref locals and multi-result blocks carry
|
|
86
|
+
caught values. Uncaught exceptions expose their tag and payload through
|
|
87
|
+
`Wardite::UncaughtWasmException`. EH remains exclusive to Efflorescence.
|
|
88
|
+
|
|
89
|
+
[M2](docs/efflorescence-m2.md) adds i32 loads/stores, mutable i32 globals and
|
|
90
|
+
memory.size/grow/init/copy/fill. All state stays in the shared Store, with
|
|
91
|
+
checked byte ranges and instance-local runtime data segments.
|
|
92
|
+
|
|
93
|
+
[M3](docs/efflorescence-m3.md) adds i32 function imports, imported reexports,
|
|
94
|
+
and typed `call_indirect` through funcref table 0. Host callbacks share the
|
|
95
|
+
instance Store and can re-enter the VM. On CRuby, Efflorescence runs built-in
|
|
96
|
+
WASI `fd_write` and `proc_exit` with unboxed i32 arguments. Spinel supports
|
|
97
|
+
regular host callbacks.
|
|
98
|
+
|
|
99
|
+
[M4](docs/efflorescence-m4.md) adds i64 and integer conversions, including
|
|
100
|
+
mixed signatures, memory, globals and exception payloads. For an i64 result,
|
|
101
|
+
`runtime.call` returns a `Wardite::I64` and `runtime.call_unboxed` returns a
|
|
102
|
+
signed 64-bit Integer. The i32 unboxed result remains unsigned.
|
|
103
|
+
|
|
104
|
+
[M5](docs/efflorescence-m5.md) adds f32 and f64 arithmetic, conversions, memory,
|
|
105
|
+
globals, calls and exception payloads. Float arguments accept Ruby Float or the
|
|
106
|
+
matching wrapper. Float results are Ruby Float from `call_unboxed` and
|
|
107
|
+
`Wardite::F32` or `Wardite::F64` from `call`.
|
|
108
|
+
|
|
109
|
+
[M6](docs/efflorescence-m6.md) verifies the 188 opcodes in the M0 legacy coverage
|
|
110
|
+
baseline and three additional EH opcodes on CRuby and Spinel. Run
|
|
111
|
+
`bundle exec rake parity` with Spinel, wasm-tools and Wasmtime installed.
|
|
112
|
+
|
|
61
113
|
## Development
|
|
62
114
|
|
|
63
115
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
64
116
|
|
|
65
117
|
Additionaly, you can run `bundle exec rake check` to generate rbs files from annotations and run `steep check`.
|
|
66
118
|
|
|
119
|
+
### Native executable with Spinel
|
|
120
|
+
|
|
121
|
+
A `spin.toml` application is also available under [`spinel/`](spinel/README.md),
|
|
122
|
+
using `lib/` as a local source dependency and the same CLI as the RubyGem.
|
|
123
|
+
|
|
124
|
+
With `spinel` and a C compiler on your PATH, build the existing CLI:
|
|
125
|
+
|
|
126
|
+
```console
|
|
127
|
+
$ make spinel
|
|
128
|
+
$ build/wardite --no-wasi --invoke add test/add.wasm 100 200
|
|
129
|
+
return value: I32(300)
|
|
130
|
+
$ make spinel-test
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The executable defaults to WASI disabled. This initial integration tests small
|
|
134
|
+
Wasm modules with `i32.const`, `i32.add`, internal calls, and `if`/`else`, comparing
|
|
135
|
+
the native CLI's results with CRuby. WASI and Vernier profiling are excluded from
|
|
136
|
+
the native build. Ruby's dynamic export helpers (`instance.add(...)` and
|
|
137
|
+
`runtime.add(...)`) rely on `method_missing`; use `instance.runtime.call("add",
|
|
138
|
+
[100, 200])` when compiling an application with Spinel.
|
|
139
|
+
|
|
140
|
+
The build leaves inline RBS and Spinel's default integer overflow checks enabled.
|
|
141
|
+
Wasm integer operations bound their intermediate values, so
|
|
142
|
+
`--int-overflow=promote` is not required.
|
|
143
|
+
Tested with Spinel `2026.10.25+1967` (`6e7fc1355`) on macOS
|
|
144
|
+
arm64. Override `SPINEL`, `SPINELFLAGS`, `BUILD_DIR`, or `RUBY` when needed.
|
|
145
|
+
|
|
67
146
|
## Contributing
|
|
68
147
|
|
|
69
148
|
Bug reports and pull requests are welcome on GitHub at https://github.com/udzura/wardite.
|
|
@@ -76,4 +155,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/udzura
|
|
|
76
155
|
- https://github.com/skanehira/chibiwasm
|
|
77
156
|
- Small and consise implementation in Rust
|
|
78
157
|
- Wardite was first built upon [its development tutorial](https://skanehira.github.io/writing-a-wasm-runtime-in-rust/). Thanks!
|
|
79
|
-
- Many of test wat files under [`examples/`](./examples/) are borrowed from chibiwasm project
|
|
158
|
+
- Many of test wat files under [`examples/`](./examples/) are borrowed from chibiwasm project
|
data/Rakefile
CHANGED
|
@@ -9,6 +9,11 @@ Rake::TestTask.new(:test) do |t|
|
|
|
9
9
|
t.test_files = FileList["test/**/*_test.rb"]
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
desc "Verify Efflorescence opcode parity with CRuby, Spinel and Wasmtime"
|
|
13
|
+
task :parity do
|
|
14
|
+
sh "bundle exec ruby -Ilib test/support/run_efflorescence_manifest.rb"
|
|
15
|
+
end
|
|
16
|
+
|
|
12
17
|
desc "Run rbs-inline and steep"
|
|
13
18
|
task :check do
|
|
14
19
|
sh "bundle exec rbs-inline --output lib/"
|