| 175 | } |
| 176 | |
| 177 | Expect<void> VM::unsafeRegisterModule(std::string_view Name, |
| 178 | const std::filesystem::path &Path) { |
| 179 | if (Stage == VMStage::Instantiated) { |
| 180 | // When registering a module, the instantiated module in the store will be |
| 181 | // reset. Therefore the instantiation should restart. |
| 182 | Stage = VMStage::Validated; |
| 183 | } |
| 184 | // Load module. |
| 185 | EXPECTED_TRY(auto Module, LoaderEngine.parseModule(Path)); |
| 186 | return unsafeRegisterModule(Name, *Module.get()); |
| 187 | } |
| 188 | |
| 189 | Expect<void> VM::unsafeRegisterModule(std::string_view Name, |
| 190 | Span<const Byte> Code) { |
nothing calls this directly
no test coverage detected