@@ -33,23 +33,7 @@ class ISeqAllocator {
3333 }
3434}
3535
36- protocol TranslatorContext {
37- func resolveType( _ index: TypeIndex ) throws -> FunctionType
38- func resolveBlockType( _ blockType: BlockType ) throws -> FunctionType
39- func functionType( _ index: FunctionIndex , interner: Interner < FunctionType > ) throws -> FunctionType
40- func globalType( _ index: GlobalIndex ) throws -> ValueType
41- func isMemory64( memoryIndex index: MemoryIndex ) throws -> Bool
42- func isMemory64( tableIndex index: TableIndex ) throws -> Bool
43- func tableType( _ index: TableIndex ) throws -> TableType
44- func elementType( _ index: ElementIndex ) throws -> ReferenceType
45- func resolveCallee( _ index: FunctionIndex ) -> InternalFunction ?
46- func isSameInstance( _ instance: InternalInstance ) -> Bool
47- func resolveGlobal( _ index: GlobalIndex ) -> InternalGlobal ?
48- func validateFunctionIndex( _ index: FunctionIndex ) throws
49- var dataCount : UInt32 ? { get }
50- }
51-
52- extension TranslatorContext {
36+ extension InternalInstance {
5337 func addressType( memoryIndex: MemoryIndex ) throws -> ValueType {
5438 return ValueType . addressType ( isMemory64: try isMemory64 ( memoryIndex: memoryIndex) )
5539 }
@@ -59,9 +43,7 @@ extension TranslatorContext {
5943 func validateElementSegment( _ index: ElementIndex ) throws {
6044 _ = try elementType ( index)
6145 }
62- }
6346
64- extension InternalInstance : TranslatorContext {
6547 func resolveType( _ index: TypeIndex ) throws -> FunctionType {
6648 guard Int ( index) < self . types. count else {
6749 throw ValidationError ( . indexOutOfBounds( " type " , index, max: UInt32 ( self . types. count) ) )
@@ -311,7 +293,7 @@ struct StackLayout {
311293 }
312294}
313295
314- struct InstructionTranslator < Context : TranslatorContext > : InstructionVisitor {
296+ struct InstructionTranslator : InstructionVisitor {
315297 typealias Output = Void
316298
317299 typealias LabelRef = Int
@@ -828,7 +810,7 @@ struct InstructionTranslator<Context: TranslatorContext>: InstructionVisitor {
828810
829811 let allocator : ISeqAllocator
830812 let funcTypeInterner : Interner < FunctionType >
831- let module : Context
813+ let module : InternalInstance
832814 private var iseqBuilder : ISeqBuilder
833815 var controlStack : ControlStack
834816 var valueStack : ValueStack
@@ -840,13 +822,13 @@ struct InstructionTranslator<Context: TranslatorContext>: InstructionVisitor {
840822 /// Whether a call to this function should be intercepted
841823 let intercepting : Bool
842824 var constantSlots : ConstSlots
843- let validator : InstructionValidator < Context >
825+ let validator : InstructionValidator
844826
845827 init (
846828 allocator: ISeqAllocator ,
847829 engineConfiguration: EngineConfiguration ,
848830 funcTypeInterner: Interner < FunctionType > ,
849- module: Context ,
831+ module: InternalInstance ,
850832 type: FunctionType ,
851833 locals: [ WasmTypes . ValueType ] ,
852834 functionIndex: FunctionIndex ,
0 commit comments