| 212 | } |
| 213 | |
| 214 | Expect<void> Loader::loadUniversalWASM(AST::Module &Mod) { |
| 215 | if (Conf.getRuntimeConfigure().getRunMode() == RunMode::AOT) { |
| 216 | auto Exec = std::make_shared<AOTSection>(); |
| 217 | if (auto Res = Exec->load(Mod.getAOTSection()); unlikely(!Res)) { |
| 218 | spdlog::warn("AOT was requested but loading the AOT section failed: " |
| 219 | "{}, falling back to interpreter."sv, |
| 220 | Res.error()); |
| 221 | } else { |
| 222 | if (loadExecutable(Mod, Exec)) { |
| 223 | return {}; |
| 224 | } |
| 225 | spdlog::warn("AOT was requested but linking the AOT executable failed, " |
| 226 | "falling back to interpreter."sv); |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | // Fallback to the interpreter mode case: Re-read the code section. |
| 231 | WASMType = InputType::WASM; |
| 232 | FMgr.seek(Mod.getCodeSection().getStartOffset()); |
| 233 | return loadSection(Mod.getCodeSection()).map_error([](auto E) { |
| 234 | spdlog::error(ErrInfo::InfoAST(ASTNodeAttr::Module)); |
| 235 | return E; |
| 236 | }); |
| 237 | } |
| 238 | |
| 239 | Expect<void> Loader::loadModuleAOT(AST::AOTSection &AOTSection) { |
| 240 | // Find and read the AOT custom section first. Jump over the others. |
nothing calls this directly
no test coverage detected