wardite 1.1.0 → 1.2.1
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/Makefile +9 -1
- data/README.md +36 -4
- data/benchmark/README.md +8 -0
- data/benchmark/compare_mir_generation_builds.rb +66 -0
- data/benchmark/count_ruby_wasm_functions.rb +37 -0
- data/benchmark/generate_mir_generation_fixtures.rb +44 -0
- data/benchmark/measure_mir_cache_restore.rb +59 -0
- data/benchmark/measure_mir_generation.rb +52 -0
- data/benchmark/mir_copy_worker.rb +29 -0
- data/benchmark/mir_generation_worker.rb +50 -0
- data/benchmark/prepare_mir_generation_profile.rb +80 -0
- data/benchmark/profile_inline_snapshots.rb +63 -0
- data/benchmark/profile_mir_generation_allocations.rb +73 -0
- data/benchmark/results/efflorescence-mir2-function-restore.json +480 -0
- data/benchmark/results/mir-generation-adr0014.json +1779 -0
- data/benchmark/results/mir-generation-adr0015.json +3132 -0
- data/benchmark/results/mir-generation-allocations.json +236 -0
- data/benchmark/results/mir-generation-coarse.json +909 -0
- data/benchmark/results/mir-generation-control.json +463 -0
- data/benchmark/results/mir-generation-detail.json +387 -0
- data/benchmark/results/mir-generation-scaling.json +2945 -0
- data/docs/adr/0009-efflorescence-mir2-cache-integrity-modes.md +1 -1
- data/docs/adr/0010-efflorescence-mir2-cache-function-restore.md +1 -1
- data/docs/adr/0014-efflorescence-mir-build-validation-and-decoding.md +136 -0
- data/docs/adr/0015-efflorescence-selective-inline-snapshots.md +150 -0
- data/docs/adr/0016-efflorescence-generation-tagged-copy-propagation.md +163 -0
- data/docs/efflorescence-mir-build-validation-and-decoding-results.md +93 -0
- data/docs/efflorescence-mir-generation-implementation.md +77 -0
- data/docs/efflorescence-mir-generation-performance.md +184 -0
- data/docs/efflorescence-mir2-cache.md +31 -2
- data/docs/efflorescence-selective-inline-snapshots-results.md +92 -0
- data/docs/efflorescence-spinel-linear-memory.md +6 -4
- data/lib/wardite/cli/cli.rb +3 -1
- data/lib/wardite/efflorescence/ir.rb +131 -40
- data/lib/wardite/efflorescence/mir_cache.rb +165 -73
- data/lib/wardite/efflorescence/optimizer.rb +65 -15
- data/lib/wardite/efflorescence/register_validation.rb +162 -32
- data/lib/wardite/efflorescence/snapshot.rb +5 -2
- data/lib/wardite/efflorescence/vm.rb +4 -3
- data/lib/wardite/instruction.rb +42 -1
- data/lib/wardite/leb128.rb +2 -5
- data/lib/wardite/load.rb +154 -75
- data/lib/wardite/version.rb +1 -1
- data/lib/wardite.rb +1 -1
- data/scripts/build_spinel_zig.rb +121 -0
- data/sig/generated/wardite/efflorescence/ir.rbs +34 -3
- data/sig/generated/wardite/efflorescence/mir_cache.rbs +41 -14
- data/sig/generated/wardite/efflorescence/optimizer.rbs +27 -3
- data/sig/generated/wardite/efflorescence/register_validation.rbs +45 -4
- data/sig/generated/wardite/efflorescence/snapshot.rbs +2 -1
- data/sig/generated/wardite/instruction.rbs +23 -0
- data/sig/generated/wardite/load.rbs +63 -9
- data/sig/io_buffer.rbs +7 -0
- metadata +28 -3
- data/spinel/patches/0001-io-buffer-string-view.patch +0 -699
- data/spinel/patches/0002-io-buffer-allocation-error.patch +0 -47
|
@@ -51,8 +51,12 @@ module Wardite
|
|
|
51
51
|
# All records are little-endian. Vectors carry a nonnegative 32-bit element count.
|
|
52
52
|
# A record count is bounded by the bytes still available to decode it.
|
|
53
53
|
class Reader
|
|
54
|
+
attr_reader offset: Integer
|
|
55
|
+
|
|
54
56
|
# @rbs bytes: String
|
|
55
|
-
|
|
57
|
+
# @rbs offset: Integer
|
|
58
|
+
# @rbs length: Integer?
|
|
59
|
+
def initialize: (String bytes, ?offset: Integer, ?length: Integer?) -> untyped
|
|
56
60
|
|
|
57
61
|
# @rbs length: Integer
|
|
58
62
|
# @rbs return: String
|
|
@@ -70,6 +74,12 @@ module Wardite
|
|
|
70
74
|
# @rbs return: Array[Integer]
|
|
71
75
|
def vector: (String format, Integer width) -> Array[Integer]
|
|
72
76
|
|
|
77
|
+
# @rbs target: Array[Integer]
|
|
78
|
+
# @rbs format: String
|
|
79
|
+
# @rbs width: Integer
|
|
80
|
+
# @rbs return: void
|
|
81
|
+
def read_into: (Array[Integer] target, String format, Integer width) -> void
|
|
82
|
+
|
|
73
83
|
# @rbs return: Array[Symbol]
|
|
74
84
|
def types: () -> Array[Symbol]
|
|
75
85
|
|
|
@@ -109,6 +119,8 @@ module Wardite
|
|
|
109
119
|
class Decoder
|
|
110
120
|
include Opcode
|
|
111
121
|
|
|
122
|
+
attr_reader functions: Array[Function]
|
|
123
|
+
|
|
112
124
|
# Reuse the semantic register roles for fixed operands. Lowering
|
|
113
125
|
# moves direct call arguments into a side table and leaves optional
|
|
114
126
|
# destinations and return operands to be checked against signatures.
|
|
@@ -116,25 +128,32 @@ module Wardite
|
|
|
116
128
|
|
|
117
129
|
EXTRA_OPERANDS: Array[Symbol?]
|
|
118
130
|
|
|
119
|
-
# @rbs
|
|
131
|
+
# @rbs payload: String
|
|
120
132
|
# @rbs instance: Wardite::Instance
|
|
121
133
|
# @rbs entries: Array[FunctionEntry]
|
|
122
|
-
def initialize: (
|
|
134
|
+
def initialize: (String payload, Wardite::Instance instance, Array[FunctionEntry] entries) -> untyped
|
|
123
135
|
|
|
124
|
-
# @rbs
|
|
125
|
-
|
|
136
|
+
# @rbs layout: String
|
|
137
|
+
# @rbs return: void
|
|
138
|
+
def declare: (String layout) -> void
|
|
139
|
+
|
|
140
|
+
# A failed decode must never expose a partially filled function. Keep
|
|
141
|
+
# the slot unavailable even if a Ruby caller catches the error.
|
|
142
|
+
# @rbs function: Function
|
|
143
|
+
# @rbs return: void
|
|
144
|
+
def restore: (Function function) -> void
|
|
126
145
|
|
|
127
146
|
private
|
|
128
147
|
|
|
129
148
|
# @rbs body: Wardite::CodeSection::CodeBody
|
|
130
|
-
# @rbs
|
|
131
|
-
# @rbs
|
|
132
|
-
|
|
133
|
-
def read_function: (Wardite::CodeSection::CodeBody body, FunctionEntry entry, Integer index) -> Function
|
|
149
|
+
# @rbs function: Function
|
|
150
|
+
# @rbs return: void
|
|
151
|
+
def read_function: (Wardite::CodeSection::CodeBody body, Function function) -> void
|
|
134
152
|
|
|
135
153
|
# @rbs function: Function
|
|
136
|
-
# @rbs
|
|
137
|
-
|
|
154
|
+
# @rbs functions: Array[Function]
|
|
155
|
+
# @rbs return: void
|
|
156
|
+
def read_sites: (Function function, Array[Function] functions) -> void
|
|
138
157
|
|
|
139
158
|
# @rbs function: Function
|
|
140
159
|
# @rbs return: DynamicCallSite
|
|
@@ -182,18 +201,26 @@ module Wardite
|
|
|
182
201
|
# @rbs wasm: String
|
|
183
202
|
# @rbs configuration: Configuration
|
|
184
203
|
# @rbs verify: Symbol
|
|
185
|
-
|
|
204
|
+
# @rbs eager: bool
|
|
205
|
+
def initialize: (String directory, String wasm, Configuration configuration, ?verify: Symbol, ?eager: bool) -> untyped
|
|
186
206
|
|
|
187
207
|
# Restore against module declarations so a miss can decode and check the
|
|
188
208
|
# Wasm bodies before Store initialization or any host lookup.
|
|
189
209
|
# @rbs instance: Wardite::Instance
|
|
190
210
|
# @rbs return: Array[Function]?
|
|
191
|
-
def
|
|
211
|
+
def read_functions: (Wardite::Instance instance) -> Array[Function]?
|
|
212
|
+
|
|
213
|
+
# @rbs function: Function
|
|
214
|
+
# @rbs return: void
|
|
215
|
+
def restore_function: (Function function) -> void
|
|
216
|
+
|
|
217
|
+
# @rbs return: void
|
|
218
|
+
def restore_all: () -> void
|
|
192
219
|
|
|
193
220
|
# @rbs instance: Wardite::Instance
|
|
194
221
|
# @rbs ir: IR
|
|
195
222
|
# @rbs return: void
|
|
196
|
-
def
|
|
223
|
+
def write_ir: (Wardite::Instance instance, IR ir) -> void
|
|
197
224
|
|
|
198
225
|
private
|
|
199
226
|
|
|
@@ -73,7 +73,7 @@ module Wardite
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
module Passes
|
|
76
|
-
# Expand only small, straight-line leaves from
|
|
76
|
+
# Expand only small, straight-line leaves from pre-rewrite snapshots.
|
|
77
77
|
# One round avoids transitive/exponential expansion and keeps recursion
|
|
78
78
|
# on the ordinary CALL path. Existing local passes clean up the copies.
|
|
79
79
|
class Inlining
|
|
@@ -98,9 +98,33 @@ module Wardite
|
|
|
98
98
|
def eligible?: (Wardite::Efflorescence::Function function) -> bool
|
|
99
99
|
|
|
100
100
|
# @rbs function: Wardite::Efflorescence::Function
|
|
101
|
-
# @rbs
|
|
101
|
+
# @rbs ir: Wardite::Efflorescence::IR
|
|
102
|
+
# @rbs callees: Hash[Integer, Wardite::Efflorescence::Function]
|
|
102
103
|
# @rbs return: bool
|
|
103
|
-
def expand_calls: (Wardite::Efflorescence::Function function, Wardite::Efflorescence::IR callees) -> bool
|
|
104
|
+
def expand_calls: (Wardite::Efflorescence::Function function, Wardite::Efflorescence::IR ir, Hash[Integer, Wardite::Efflorescence::Function] callees) -> bool
|
|
105
|
+
|
|
106
|
+
# @rbs function: Wardite::Efflorescence::Function
|
|
107
|
+
# @rbs ir: Wardite::Efflorescence::IR
|
|
108
|
+
# @rbs callees: Hash[Integer, Wardite::Efflorescence::Function]
|
|
109
|
+
# @rbs return: bool
|
|
110
|
+
def expandable_call?: (Wardite::Efflorescence::Function function, Wardite::Efflorescence::IR ir, Hash[Integer, Wardite::Efflorescence::Function] callees) -> bool
|
|
111
|
+
|
|
112
|
+
# Count the expansion before copy cleanup, conservatively.
|
|
113
|
+
# @rbs callee: Wardite::Efflorescence::Function
|
|
114
|
+
# @rbs call: Wardite::Efflorescence::Instruction
|
|
115
|
+
# @rbs return: Integer
|
|
116
|
+
def instruction_growth: (Wardite::Efflorescence::Function callee, Wardite::Efflorescence::Instruction call) -> Integer
|
|
117
|
+
|
|
118
|
+
# @rbs callee: Wardite::Efflorescence::Function
|
|
119
|
+
# @rbs return: Integer
|
|
120
|
+
def register_growth: (Wardite::Efflorescence::Function callee) -> Integer
|
|
121
|
+
|
|
122
|
+
# Check the module index even when there are no inline candidates.
|
|
123
|
+
# @rbs ir: Wardite::Efflorescence::IR
|
|
124
|
+
# @rbs callees: Hash[Integer, Wardite::Efflorescence::Function]
|
|
125
|
+
# @rbs call: Wardite::Efflorescence::Instruction
|
|
126
|
+
# @rbs return: Wardite::Efflorescence::Function?
|
|
127
|
+
def callee_for: (Wardite::Efflorescence::IR ir, Hash[Integer, Wardite::Efflorescence::Function] callees, Wardite::Efflorescence::Instruction call) -> Wardite::Efflorescence::Function?
|
|
104
128
|
|
|
105
129
|
# @rbs caller: Wardite::Efflorescence::Function
|
|
106
130
|
# @rbs callee: Wardite::Efflorescence::Function
|
|
@@ -43,14 +43,39 @@ module Wardite
|
|
|
43
43
|
|
|
44
44
|
private
|
|
45
45
|
|
|
46
|
-
#
|
|
47
|
-
#
|
|
46
|
+
# @rbs instructions: Array[Wardite::Efflorescence::Instruction]
|
|
47
|
+
# @rbs return: Array[Integer]?
|
|
48
|
+
def plain_leaders: (Array[Wardite::Efflorescence::Instruction] instructions) -> Array[Integer]?
|
|
49
|
+
|
|
50
|
+
# @rbs leaders: Array[Integer]
|
|
51
|
+
# @rbs return: [Array[Wardite::Efflorescence::RegisterValidation::Block], Array[Integer]]
|
|
52
|
+
def build_blocks: (Array[Integer] leaders) -> [ Array[Wardite::Efflorescence::RegisterValidation::Block], Array[Integer] ]
|
|
53
|
+
|
|
54
|
+
# @rbs function: Wardite::Efflorescence::Function
|
|
55
|
+
# @rbs leaders: Array[Integer]
|
|
56
|
+
# @rbs return: void
|
|
57
|
+
def validate_plain: (Wardite::Efflorescence::Function function, Array[Integer] leaders) -> void
|
|
58
|
+
|
|
59
|
+
# @rbs function: Wardite::Efflorescence::Function
|
|
60
|
+
# @rbs blocks: Array[Wardite::Efflorescence::RegisterValidation::Block]
|
|
61
|
+
# @rbs order: Array[Integer]
|
|
62
|
+
# @rbs block_for_pc: Array[Integer]
|
|
63
|
+
# @rbs flow: Wardite::Efflorescence::FlowGraph?
|
|
64
|
+
# @rbs return: void
|
|
65
|
+
def validate_blocks: (Wardite::Efflorescence::Function function, Array[Wardite::Efflorescence::RegisterValidation::Block] blocks, Array[Integer] order, Array[Integer] block_for_pc, Wardite::Efflorescence::FlowGraph? flow) -> void
|
|
66
|
+
|
|
48
67
|
# @rbs blocks: Array[Wardite::Efflorescence::RegisterValidation::Block]
|
|
49
68
|
# @rbs block_for_pc: Array[Integer]
|
|
50
69
|
# @rbs flow: Wardite::Efflorescence::FlowGraph
|
|
51
70
|
# @rbs return: Array[Integer]
|
|
52
71
|
def reverse_postorder: (Array[Wardite::Efflorescence::RegisterValidation::Block] blocks, Array[Integer] block_for_pc, Wardite::Efflorescence::FlowGraph flow) -> Array[Integer]
|
|
53
72
|
|
|
73
|
+
# Visit predecessors before joins where possible, then revisit changed
|
|
74
|
+
# states across backedges until the worklist is empty.
|
|
75
|
+
# @rbs blocks: Array[Wardite::Efflorescence::RegisterValidation::Block]
|
|
76
|
+
# @rbs return: Array[Integer]
|
|
77
|
+
def block_reverse_postorder: (Array[Wardite::Efflorescence::RegisterValidation::Block] blocks) -> Array[Integer]
|
|
78
|
+
|
|
54
79
|
# @rbs words: Array[Integer]
|
|
55
80
|
# @rbs register: Integer
|
|
56
81
|
# @rbs return: void
|
|
@@ -71,10 +96,26 @@ module Wardite
|
|
|
71
96
|
|
|
72
97
|
# @rbs function: Wardite::Efflorescence::Function
|
|
73
98
|
# @rbs instruction: Wardite::Efflorescence::Instruction
|
|
74
|
-
# @rbs
|
|
99
|
+
# @rbs read_count: Integer
|
|
75
100
|
# @rbs destination: Integer
|
|
76
101
|
# @rbs return: void
|
|
77
|
-
def validate_extended_instruction: (Wardite::Efflorescence::Function function, Wardite::Efflorescence::Instruction instruction,
|
|
102
|
+
def validate_extended_instruction: (Wardite::Efflorescence::Function function, Wardite::Efflorescence::Instruction instruction, Integer read_count, Integer destination) -> void
|
|
103
|
+
|
|
104
|
+
# @rbs function: Wardite::Efflorescence::Function
|
|
105
|
+
# @rbs instruction: Wardite::Efflorescence::Instruction
|
|
106
|
+
# @rbs types: Array[Symbol]
|
|
107
|
+
# @rbs first: Integer
|
|
108
|
+
# @rbs limit: Integer
|
|
109
|
+
# @rbs type_offset: Integer
|
|
110
|
+
# @rbs return: void
|
|
111
|
+
def check_reads: (Wardite::Efflorescence::Function function, Wardite::Efflorescence::Instruction instruction, Array[Symbol] types, Integer first, Integer limit, ?Integer type_offset) -> void
|
|
112
|
+
|
|
113
|
+
# @rbs function: Wardite::Efflorescence::Function
|
|
114
|
+
# @rbs instruction: Wardite::Efflorescence::Instruction
|
|
115
|
+
# @rbs type: Symbol
|
|
116
|
+
# @rbs limit: Integer
|
|
117
|
+
# @rbs return: void
|
|
118
|
+
def check_reads_of_type: (Wardite::Efflorescence::Function function, Wardite::Efflorescence::Instruction instruction, Symbol type, Integer limit) -> void
|
|
78
119
|
|
|
79
120
|
# @rbs tags: Array[Wardite::Efflorescence::Tag]?
|
|
80
121
|
# @rbs index: Integer
|
|
@@ -71,8 +71,9 @@ module Wardite
|
|
|
71
71
|
# @rbs functions: Array[Wardite::Efflorescence::Function]
|
|
72
72
|
# @rbs frames: Array[Wardite::Efflorescence::SavedFrame]
|
|
73
73
|
# @rbs index: Integer
|
|
74
|
+
# @rbs cache: Wardite::Efflorescence::MIRCache
|
|
74
75
|
# @rbs return: void
|
|
75
|
-
def check_frame: (Array[Wardite::Efflorescence::Function] functions, Array[Wardite::Efflorescence::SavedFrame] frames, Integer index) -> void
|
|
76
|
+
def check_frame: (Array[Wardite::Efflorescence::Function] functions, Array[Wardite::Efflorescence::SavedFrame] frames, Integer index, Wardite::Efflorescence::MIRCache cache) -> void
|
|
76
77
|
|
|
77
78
|
# @rbs message: String
|
|
78
79
|
# @rbs started: Float
|
|
@@ -62,6 +62,29 @@ module Wardite
|
|
|
62
62
|
# @rbs return: Symbol
|
|
63
63
|
def self.resolve_fc_sym: (Integer lower) -> Symbol
|
|
64
64
|
|
|
65
|
+
# @rbs code: Symbol
|
|
66
|
+
# @rbs return: Array[Symbol]
|
|
67
|
+
def self.build_operand_types: (Symbol code) -> Array[Symbol]
|
|
68
|
+
|
|
69
|
+
class DecodeSpec
|
|
70
|
+
attr_reader namespace: Symbol
|
|
71
|
+
|
|
72
|
+
attr_reader code: Symbol
|
|
73
|
+
|
|
74
|
+
attr_reader operand_types: Array[Symbol]
|
|
75
|
+
|
|
76
|
+
# @rbs namespace: Symbol
|
|
77
|
+
# @rbs code: Symbol
|
|
78
|
+
# @rbs operand_types: Array[Symbol]
|
|
79
|
+
def initialize: (Symbol namespace, Symbol code, Array[Symbol] operand_types) -> untyped
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
OPERAND_TYPES_BY_CODE: Hash[Symbol, Array[Symbol]]
|
|
83
|
+
|
|
84
|
+
OPCODE_SPECS: Array[DecodeSpec]
|
|
85
|
+
|
|
86
|
+
FC_SPECS: Array[DecodeSpec]
|
|
87
|
+
|
|
65
88
|
# @rbs code: Symbol
|
|
66
89
|
# @rbs return: Array[Symbol]
|
|
67
90
|
def self.operand_of: (Symbol code) -> Array[Symbol]
|
|
@@ -91,14 +91,26 @@ module Wardite
|
|
|
91
91
|
def initialize: () -> void
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
+
# The loader owns this result until a CodeBody exposes its mutable instructions.
|
|
95
|
+
class DecodedBody
|
|
96
|
+
attr_reader instructions: Array[[ Symbol, Symbol, Array[operandItem], Integer?, Integer? ]]
|
|
97
|
+
|
|
98
|
+
attr_reader blocks: Array[Block]
|
|
99
|
+
|
|
100
|
+
attr_reader has_eh_instructions: bool
|
|
101
|
+
|
|
102
|
+
# @rbs instructions: Array[[Symbol, Symbol, Array[operandItem], Integer?, Integer?]]
|
|
103
|
+
# @rbs blocks: Array[Block]
|
|
104
|
+
# @rbs has_eh_instructions: bool
|
|
105
|
+
def initialize: (Array[[ Symbol, Symbol, Array[operandItem], Integer?, Integer? ]] instructions, Array[Block] blocks, bool has_eh_instructions) -> untyped
|
|
106
|
+
end
|
|
107
|
+
|
|
94
108
|
class CodeSection < Section
|
|
95
109
|
class CodeBody
|
|
96
110
|
attr_accessor locals_count: Array[Integer]
|
|
97
111
|
|
|
98
112
|
attr_accessor locals_type: Array[Symbol]
|
|
99
113
|
|
|
100
|
-
attr_writer instruction_bytes: String?
|
|
101
|
-
|
|
102
114
|
attr_writer type_section: TypeSection?
|
|
103
115
|
|
|
104
116
|
# @rbs &blk: (CodeBody) -> void
|
|
@@ -112,6 +124,14 @@ module Wardite
|
|
|
112
124
|
# @rbs return: void
|
|
113
125
|
def body=: (Array[[ Symbol, Symbol, Array[operandItem], Integer?, Integer? ]] instructions) -> void
|
|
114
126
|
|
|
127
|
+
# @rbs bytes: String?
|
|
128
|
+
# @rbs return: void
|
|
129
|
+
def instruction_bytes=: (String? bytes) -> void
|
|
130
|
+
|
|
131
|
+
# @rbs buf: File|StringIO
|
|
132
|
+
# @rbs return: void
|
|
133
|
+
def decode_from: (File | StringIO buf) -> void
|
|
134
|
+
|
|
115
135
|
# @rbs types: TypeSection?
|
|
116
136
|
# @rbs stack: bool
|
|
117
137
|
# @rbs return: void
|
|
@@ -119,11 +139,27 @@ module Wardite
|
|
|
119
139
|
|
|
120
140
|
private
|
|
121
141
|
|
|
142
|
+
# @rbs decoded: DecodedBody
|
|
143
|
+
# @rbs return: void
|
|
144
|
+
def install_decoded: (DecodedBody decoded) -> void
|
|
145
|
+
|
|
146
|
+
# @rbs decoded: DecodedBody
|
|
147
|
+
# @rbs types: TypeSection?
|
|
148
|
+
# @rbs stack: bool
|
|
149
|
+
# @rbs return: void
|
|
150
|
+
def check_decoded: (DecodedBody decoded, TypeSection? types, bool stack) -> void
|
|
151
|
+
|
|
122
152
|
# @rbs instructions: Array[[Symbol, Symbol, Array[operandItem], Integer?, Integer?]]
|
|
123
153
|
# @rbs types: TypeSection?
|
|
124
154
|
# @rbs stack: bool
|
|
125
155
|
# @rbs return: void
|
|
126
156
|
def check_instructions: (Array[[ Symbol, Symbol, Array[operandItem], Integer?, Integer? ]] instructions, TypeSection? types, bool stack) -> void
|
|
157
|
+
|
|
158
|
+
# @rbs block: Block
|
|
159
|
+
# @rbs types: TypeSection?
|
|
160
|
+
# @rbs stack: bool
|
|
161
|
+
# @rbs return: void
|
|
162
|
+
def check_block: (Block block, TypeSection? types, bool stack) -> void
|
|
127
163
|
end
|
|
128
164
|
|
|
129
165
|
attr_accessor func_codes: Array[CodeBody]
|
|
@@ -212,8 +248,9 @@ module Wardite
|
|
|
212
248
|
# @rbs mir_profile: bool
|
|
213
249
|
# @rbs mir_cache: String?
|
|
214
250
|
# @rbs mir_cache_verify: Symbol
|
|
251
|
+
# @rbs mir_cache_eager: bool
|
|
215
252
|
# @rbs return: Instance
|
|
216
|
-
def self.load_from_buffer: (File | StringIO buf, ?import_object: Hash[Symbol, wasmModuleSrc], ?enable_wasi: boolish, ?engine: Symbol, ?disabled_optimizations: Array[Symbol], ?mir_profile: bool, ?mir_cache: String?, ?mir_cache_verify: Symbol) -> Instance
|
|
253
|
+
def self.load_from_buffer: (File | StringIO buf, ?import_object: Hash[Symbol, wasmModuleSrc], ?enable_wasi: boolish, ?engine: Symbol, ?disabled_optimizations: Array[Symbol], ?mir_profile: bool, ?mir_cache: String?, ?mir_cache_verify: Symbol, ?mir_cache_eager: bool) -> Instance
|
|
217
254
|
|
|
218
255
|
# @rbs return: Integer
|
|
219
256
|
def self.preamble: () -> Integer
|
|
@@ -258,19 +295,32 @@ module Wardite
|
|
|
258
295
|
# @rbs return: CodeSection::CodeBody
|
|
259
296
|
def self.read_function_body: (StringIO sbuf, ?bool defer_code) -> CodeSection::CodeBody
|
|
260
297
|
|
|
261
|
-
# @rbs buf: StringIO
|
|
298
|
+
# @rbs buf: File|StringIO
|
|
262
299
|
# @rbs return: Array[[Symbol, Symbol, Array[operandItem], Integer?, Integer?]]
|
|
263
|
-
def self.code_body: (StringIO buf) -> Array[[ Symbol, Symbol, Array[operandItem], Integer?, Integer? ]]
|
|
300
|
+
def self.code_body: (File | StringIO buf) -> Array[[ Symbol, Symbol, Array[operandItem], Integer?, Integer? ]]
|
|
301
|
+
|
|
302
|
+
# @rbs buf: File|StringIO
|
|
303
|
+
# @rbs return: DecodedBody
|
|
304
|
+
def self.decode_body: (File | StringIO buf) -> DecodedBody
|
|
305
|
+
|
|
306
|
+
# @rbs code: Symbol
|
|
307
|
+
# @rbs return: bool
|
|
308
|
+
def self.eh_instruction?: (Symbol code) -> bool
|
|
264
309
|
|
|
265
310
|
# Decode s33, distinguishing the one-byte value/void forms from indices.
|
|
266
|
-
# @rbs buf: StringIO
|
|
311
|
+
# @rbs buf: File|StringIO
|
|
267
312
|
# @rbs return: Block
|
|
268
|
-
def self.read_blocktype: (StringIO buf) -> Block
|
|
313
|
+
def self.read_blocktype: (File | StringIO buf) -> Block
|
|
269
314
|
|
|
270
315
|
# @rbs c: String
|
|
271
|
-
# @rbs buf: StringIO
|
|
316
|
+
# @rbs buf: File|StringIO
|
|
272
317
|
# @rbs return: [Symbol, Symbol, Array[Symbol]]
|
|
273
|
-
def self.resolve_code: (String c, StringIO buf) -> [ Symbol, Symbol, Array[Symbol] ]
|
|
318
|
+
def self.resolve_code: (String c, File | StringIO buf) -> [ Symbol, Symbol, Array[Symbol] ]
|
|
319
|
+
|
|
320
|
+
# @rbs opcode: Integer
|
|
321
|
+
# @rbs buf: File|StringIO
|
|
322
|
+
# @rbs return: Op::DecodeSpec
|
|
323
|
+
def self.resolve_spec: (Integer opcode, File | StringIO buf) -> Op::DecodeSpec
|
|
274
324
|
|
|
275
325
|
# @rbs return: DataSection
|
|
276
326
|
def self.data_section: () -> DataSection
|
|
@@ -297,6 +347,10 @@ module Wardite
|
|
|
297
347
|
# @rbs return: nil
|
|
298
348
|
def self.unimplemented_skip_section: (Integer code) -> nil
|
|
299
349
|
|
|
350
|
+
# @rbs sbuf: File|StringIO
|
|
351
|
+
# @rbs return: Integer
|
|
352
|
+
def self.assert_byte: (File | StringIO sbuf) -> Integer
|
|
353
|
+
|
|
300
354
|
# @rbs sbuf: File|StringIO
|
|
301
355
|
# @rbs n: Integer
|
|
302
356
|
# @rbs return: String
|
data/sig/io_buffer.rbs
ADDED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wardite
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Uchio Kondo
|
|
@@ -30,7 +30,9 @@ files:
|
|
|
30
30
|
- benchmark/compare_call_types.rb
|
|
31
31
|
- benchmark/compare_dispatch.rb
|
|
32
32
|
- benchmark/compare_engines.rb
|
|
33
|
+
- benchmark/compare_mir_generation_builds.rb
|
|
33
34
|
- benchmark/compare_optimizations.rb
|
|
35
|
+
- benchmark/count_ruby_wasm_functions.rb
|
|
34
36
|
- benchmark/engine_phases.rb
|
|
35
37
|
- benchmark/figures/README.md
|
|
36
38
|
- benchmark/figures/plot_spinel_comparison.py
|
|
@@ -39,6 +41,7 @@ files:
|
|
|
39
41
|
- benchmark/figures/spinel_new_vm_summary.csv
|
|
40
42
|
- benchmark/figures/spinel_new_vm_summary.json
|
|
41
43
|
- benchmark/float_m5.wat
|
|
44
|
+
- benchmark/generate_mir_generation_fixtures.rb
|
|
42
45
|
- benchmark/i32_call_arities.wat
|
|
43
46
|
- benchmark/i32_calls.wat
|
|
44
47
|
- benchmark/i32_memory.wat
|
|
@@ -52,11 +55,18 @@ files:
|
|
|
52
55
|
- benchmark/measure_m3_calls.rb
|
|
53
56
|
- benchmark/measure_m4.rb
|
|
54
57
|
- benchmark/measure_m5_boundary.rb
|
|
58
|
+
- benchmark/measure_mir_cache_restore.rb
|
|
55
59
|
- benchmark/measure_mir_cache_verify.rb
|
|
60
|
+
- benchmark/measure_mir_generation.rb
|
|
56
61
|
- benchmark/measure_ruby_wasm_cache_hit.rb
|
|
57
62
|
- benchmark/measure_ruby_wasm_startup.rb
|
|
58
63
|
- benchmark/measure_wasi_write.rb
|
|
64
|
+
- benchmark/mir_copy_worker.rb
|
|
65
|
+
- benchmark/mir_generation_worker.rb
|
|
59
66
|
- benchmark/optimization_worker.rb
|
|
67
|
+
- benchmark/prepare_mir_generation_profile.rb
|
|
68
|
+
- benchmark/profile_inline_snapshots.rb
|
|
69
|
+
- benchmark/profile_mir_generation_allocations.rb
|
|
60
70
|
- benchmark/results/call_arities_exploratory_2026-11-04.json
|
|
61
71
|
- benchmark/results/call_arities_spinel_2026-11-04.json
|
|
62
72
|
- benchmark/results/call_cost_spinel_2026-11-04.json
|
|
@@ -73,6 +83,7 @@ files:
|
|
|
73
83
|
- benchmark/results/efflorescence-m2-i32-spinel.json
|
|
74
84
|
- benchmark/results/efflorescence-m2-memory.json
|
|
75
85
|
- benchmark/results/efflorescence-mir2-cache-integrity.json
|
|
86
|
+
- benchmark/results/efflorescence-mir2-function-restore.json
|
|
76
87
|
- benchmark/results/efflorescence-unboxed-globals.json
|
|
77
88
|
- benchmark/results/generated_guards_exploratory_2026-11-04.json
|
|
78
89
|
- benchmark/results/generated_guards_profile_2026-11-04.json
|
|
@@ -81,6 +92,13 @@ files:
|
|
|
81
92
|
- benchmark/results/inlining_engines_2026-11-04.json
|
|
82
93
|
- benchmark/results/inlining_ruby_2026-11-04.json
|
|
83
94
|
- benchmark/results/inlining_spinel_2026-11-04.json
|
|
95
|
+
- benchmark/results/mir-generation-adr0014.json
|
|
96
|
+
- benchmark/results/mir-generation-adr0015.json
|
|
97
|
+
- benchmark/results/mir-generation-allocations.json
|
|
98
|
+
- benchmark/results/mir-generation-coarse.json
|
|
99
|
+
- benchmark/results/mir-generation-control.json
|
|
100
|
+
- benchmark/results/mir-generation-detail.json
|
|
101
|
+
- benchmark/results/mir-generation-scaling.json
|
|
84
102
|
- benchmark/results/operand_decode_exploratory_2026-11-04.json
|
|
85
103
|
- benchmark/results/operand_decode_ruby_2026-11-04.json
|
|
86
104
|
- benchmark/results/operand_decode_spinel_2026-11-04.json
|
|
@@ -109,6 +127,9 @@ files:
|
|
|
109
127
|
- docs/adr/0011-efflorescence-unboxed-globals.md
|
|
110
128
|
- docs/adr/0012-efflorescence-startup-snapshot.md
|
|
111
129
|
- docs/adr/0013-efflorescence-frame-acquisition.md
|
|
130
|
+
- docs/adr/0014-efflorescence-mir-build-validation-and-decoding.md
|
|
131
|
+
- docs/adr/0015-efflorescence-selective-inline-snapshots.md
|
|
132
|
+
- docs/adr/0016-efflorescence-generation-tagged-copy-propagation.md
|
|
112
133
|
- docs/efflorescence-call-arities.md
|
|
113
134
|
- docs/efflorescence-call-investigation.md
|
|
114
135
|
- docs/efflorescence-call-transfer.md
|
|
@@ -123,12 +144,16 @@ files:
|
|
|
123
144
|
- docs/efflorescence-m4.md
|
|
124
145
|
- docs/efflorescence-m5.md
|
|
125
146
|
- docs/efflorescence-m6.md
|
|
147
|
+
- docs/efflorescence-mir-build-validation-and-decoding-results.md
|
|
148
|
+
- docs/efflorescence-mir-generation-implementation.md
|
|
149
|
+
- docs/efflorescence-mir-generation-performance.md
|
|
126
150
|
- docs/efflorescence-mir2-cache.md
|
|
127
151
|
- docs/efflorescence-operand-decoding.md
|
|
128
152
|
- docs/efflorescence-phase2-ja.md
|
|
129
153
|
- docs/efflorescence-phase2.md
|
|
130
154
|
- docs/efflorescence-register-initialization.md
|
|
131
155
|
- docs/efflorescence-ruby-wasm-phase1.md
|
|
156
|
+
- docs/efflorescence-selective-inline-snapshots-results.md
|
|
132
157
|
- docs/efflorescence-spinel-linear-memory.md
|
|
133
158
|
- docs/efflorescence-startup-snapshot.md
|
|
134
159
|
- docs/efflorescence-unboxed-globals.md
|
|
@@ -204,6 +229,7 @@ files:
|
|
|
204
229
|
- misc/slides/tokyo12.md
|
|
205
230
|
- rbs_collection.lock.yaml
|
|
206
231
|
- rbs_collection.yaml
|
|
232
|
+
- scripts/build_spinel_zig.rb
|
|
207
233
|
- scripts/gen_alu.rb
|
|
208
234
|
- scripts/gen_conv.rb
|
|
209
235
|
- scripts/templates/alu_module.rb.tmpl
|
|
@@ -245,13 +271,12 @@ files:
|
|
|
245
271
|
- sig/generated/wardite/wasi/preopens.rbs
|
|
246
272
|
- sig/generated/wardite/wasi/spinel.rbs
|
|
247
273
|
- sig/generated/wardite/wasm_module.rbs
|
|
274
|
+
- sig/io_buffer.rbs
|
|
248
275
|
- sig/mir_cache_stdlib.rbs
|
|
249
276
|
- sig/vernier.rbs
|
|
250
277
|
- sig/wardite.rbs
|
|
251
278
|
- spinel/README.md
|
|
252
279
|
- spinel/bin/wardite.rb
|
|
253
|
-
- spinel/patches/0001-io-buffer-string-view.patch
|
|
254
|
-
- spinel/patches/0002-io-buffer-allocation-error.patch
|
|
255
280
|
- spinel/spin.toml
|
|
256
281
|
homepage: https://github.com/udzura/wardite
|
|
257
282
|
licenses:
|