@@ -125,39 +125,19 @@ func parseModule<Stream: ByteStream>(stream: Stream, features: WasmFeatureSet =
125125 memoryTypes: module. memories. map { $0. type } ,
126126 tables: module. tables
127127 )
128+ let allocator = module. allocator
128129 let functions = codes. enumerated ( ) . map { [ hasDataCount = parser. hasDataCount, features] index, code in
129130 let funcTypeIndex = typeIndices [ index]
130131 let funcType = module. types [ Int ( funcTypeIndex) ]
131132 return GuestFunction (
132- type: typeIndices [ index] , locals: code. locals, allocator: module . allocator,
133+ type: typeIndices [ index] , locals: code. locals, allocator: allocator,
133134 body: {
134- let enableAssert : Bool
135- #if ASSERT
136- enableAssert = true
137- #else
138- enableAssert = false
139- #endif
140-
141135 var translator = InstructionTranslator (
142- allocator: module . allocator,
136+ allocator: allocator,
143137 module: translatorContext,
144138 type: funcType, locals: code. locals
145139 )
146140
147- if enableAssert && !_isFastAssertConfiguration( ) {
148- let globalFuncIndex = module. imports. count + index
149- print ( " 🚀 Starting Translation for code[ \( globalFuncIndex) ] ( \( funcType) ) " )
150- var tracing = InstructionTracingVisitor ( trace: {
151- print ( " 🍵 code[ \( globalFuncIndex) ] Translating \( $0) " )
152- } , visitor: translator)
153- try WasmParser . parseExpression (
154- bytes: Array ( code. expression) ,
155- features: features, hasDataCount: hasDataCount,
156- visitor: & tracing
157- )
158- let newISeq = tracing. visitor. finalize ( )
159- return newISeq
160- }
161141 try WasmParser . parseExpression (
162142 bytes: Array ( code. expression) ,
163143 features: features, hasDataCount: hasDataCount,
0 commit comments