| 64 | class SpecTestModule : public Runtime::Instance::ModuleInstance { |
| 65 | public: |
| 66 | SpecTestModule() : ModuleInstance("spectest") { |
| 67 | addHostFunc("print", std::make_unique<SpecTestPrint>()); |
| 68 | addHostFunc("print_i32", std::make_unique<SpecTestPrintI32>()); |
| 69 | addHostFunc("print_i64", std::make_unique<SpecTestPrintI64>()); |
| 70 | addHostFunc("print_f32", std::make_unique<SpecTestPrintF32>()); |
| 71 | addHostFunc("print_f64", std::make_unique<SpecTestPrintF64>()); |
| 72 | addHostFunc("print_i32_f32", std::make_unique<SpecTestPrintI32F32>()); |
| 73 | addHostFunc("print_f64_f64", std::make_unique<SpecTestPrintF64F64>()); |
| 74 | |
| 75 | addHostTable("table", std::make_unique<Runtime::Instance::TableInstance>( |
| 76 | AST::TableType(TypeCode::FuncRef, 10, 20), |
| 77 | RefVariant(TypeCode::FuncRef))); |
| 78 | addHostTable("table64", std::make_unique<Runtime::Instance::TableInstance>( |
| 79 | AST::TableType(TypeCode::FuncRef, |
| 80 | AST::Limit(10, 20, true, false)), |
| 81 | RefVariant(TypeCode::FuncRef))); |
| 82 | |
| 83 | addHostMemory("memory", std::make_unique<Runtime::Instance::MemoryInstance>( |
| 84 | AST::MemoryType(1, 2))); |
| 85 | addHostMemory("shared_memory", |
| 86 | std::make_unique<Runtime::Instance::MemoryInstance>( |
| 87 | AST::MemoryType(AST::Limit(1, 2, false, true)))); |
| 88 | |
| 89 | addHostGlobal( |
| 90 | "global_i32", |
| 91 | std::make_unique<Runtime::Instance::GlobalInstance>( |
| 92 | AST::GlobalType(TypeCode::I32, ValMut::Const), uint32_t(666))); |
| 93 | addHostGlobal( |
| 94 | "global_i64", |
| 95 | std::make_unique<Runtime::Instance::GlobalInstance>( |
| 96 | AST::GlobalType(TypeCode::I64, ValMut::Const), uint64_t(666))); |
| 97 | addHostGlobal( |
| 98 | "global_f32", |
| 99 | std::make_unique<Runtime::Instance::GlobalInstance>( |
| 100 | AST::GlobalType(TypeCode::F32, ValMut::Const), float(666.6))); |
| 101 | addHostGlobal( |
| 102 | "global_f64", |
| 103 | std::make_unique<Runtime::Instance::GlobalInstance>( |
| 104 | AST::GlobalType(TypeCode::F64, ValMut::Const), double(666.6))); |
| 105 | } |
| 106 | ~SpecTestModule() noexcept override = default; |
| 107 | }; |
| 108 |
nothing calls this directly
no test coverage detected