From eb671c83e55d527524923b26490c64a2ab97f19a Mon Sep 17 00:00:00 2001 From: dm4 Date: Wed, 16 Nov 2022 03:53:01 +0000 Subject: [PATCH 01/18] Fix epel8 build Signed-off-by: dm4 --- wasmedge.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wasmedge.spec b/wasmedge.spec index 92ac324..28e5350 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -5,7 +5,7 @@ Name: wasmedge Version: %{version} -Release: %autorelease +Release: 1%{?dist} Summary: High performance WebAssembly Virtual Machine # The entire source code is ASL 2.0 except LICENSE.spdx which is CC0 License: ASL 2.0 and CC0 @@ -14,6 +14,7 @@ Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz BuildRequires: boost-devel BuildRequires: cmake BuildRequires: gcc-c++ +BuildRequires: gcc-toolset-10-toolchain BuildRequires: git BuildRequires: lld-devel BuildRequires: llvm-devel @@ -45,6 +46,7 @@ This package contains necessary header files for %{reponame} development. [ -f VERSION ] || echo -n %{version} > VERSION %build +source /opt/rh/gcc-toolset-10/enable %cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DWASMEDGE_BUILD_TESTS=OFF %cmake_build @@ -77,4 +79,5 @@ ln -s lib%{name}Plugin%{reponame}Process.so.%{version} %{buildroot}%{_libdir}/%{ %{_libdir}/%{name}/lib%{name}Plugin%{reponame}Process.so %changelog -%autochangelog +* Wed Nov 16 2022 dm4 0.11.2-1 +- Release 0.11.2 From 1f64ab02e218cda73e04e90878db364cfeb55eb9 Mon Sep 17 00:00:00 2001 From: dm4 Date: Thu, 27 Apr 2023 16:22:36 +0000 Subject: [PATCH 02/18] Release 0.12.0 Signed-off-by: dm4 --- wasmedge.spec | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wasmedge.spec b/wasmedge.spec index 90fea48..ba7c604 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -5,7 +5,7 @@ Name: wasmedge Version: %{version} -Release: 1%{?dist} +Release: %autorelease Summary: High performance WebAssembly Virtual Machine # The entire source code is ASL 2.0 except LICENSE.spdx which is CC0 License: ASL 2.0 and CC0 @@ -107,5 +107,4 @@ cd .. %{_libdir}/lib%{name}.so %changelog -* Wed Nov 16 2022 dm4 0.11.2-1 -- Release 0.11.2 +%autochangelog From 80d7caa07ee3e3912990cf7f7720443e5eb47852 Mon Sep 17 00:00:00 2001 From: dm4 Date: Fri, 28 Apr 2023 02:47:20 +0000 Subject: [PATCH 03/18] Update release and changelog Signed-off-by: dm4 --- wasmedge.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wasmedge.spec b/wasmedge.spec index ba7c604..6da5656 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -5,7 +5,7 @@ Name: wasmedge Version: %{version} -Release: %autorelease +Release: 1%{?dist} Summary: High performance WebAssembly Virtual Machine # The entire source code is ASL 2.0 except LICENSE.spdx which is CC0 License: ASL 2.0 and CC0 @@ -107,4 +107,5 @@ cd .. %{_libdir}/lib%{name}.so %changelog -%autochangelog +* Thu Apr 27 2023 dm4 - 0.12.0-1 +- Release 0.12.0 From 9eb6ebd60aac0fff1bd65dab1ec4b2c9056ef597 Mon Sep 17 00:00:00 2001 From: dm4 Date: Tue, 2 May 2023 15:28:40 +0000 Subject: [PATCH 04/18] Update gcc toolset toolchain Signed-off-by: dm4 --- wasmedge.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wasmedge.spec b/wasmedge.spec index 6da5656..f916380 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -14,7 +14,8 @@ Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz BuildRequires: boost-devel BuildRequires: cmake BuildRequires: gcc-c++ -BuildRequires: gcc-toolset-10-toolchain +BuildRequires: gcc-toolset-11-annobin-plugin-gcc +BuildRequires: gcc-toolset-11-toolchain BuildRequires: git BuildRequires: lld-devel BuildRequires: llvm-devel @@ -60,7 +61,8 @@ This package contains necessary header files for %{reponame} development. [ -f VERSION ] || echo -n %{version} > VERSION %build -source /opt/rh/gcc-toolset-10/enable +source /opt/rh/gcc-toolset-11/enable +ln -sf /opt/rh/gcc-toolset-11/root/usr/lib/gcc/%{_arch}-redhat-linux/11/plugin/{,gcc-}annobin.so %cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DWASMEDGE_BUILD_TESTS=OFF %cmake_build mkdir rt From daec546d722a0382a2c5ac18efcc711e5ff8584b Mon Sep 17 00:00:00 2001 From: dm4 Date: Wed, 3 May 2023 09:23:59 +0000 Subject: [PATCH 05/18] Disable annotated build Signed-off-by: dm4 --- wasmedge.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wasmedge.spec b/wasmedge.spec index f916380..89978c6 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -2,6 +2,7 @@ %global reponame WasmEdge %global capi_soname 0 %global capi_version 0.0.2 +%undefine _annotated_build Name: wasmedge Version: %{version} @@ -14,7 +15,6 @@ Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz BuildRequires: boost-devel BuildRequires: cmake BuildRequires: gcc-c++ -BuildRequires: gcc-toolset-11-annobin-plugin-gcc BuildRequires: gcc-toolset-11-toolchain BuildRequires: git BuildRequires: lld-devel @@ -62,7 +62,6 @@ This package contains necessary header files for %{reponame} development. %build source /opt/rh/gcc-toolset-11/enable -ln -sf /opt/rh/gcc-toolset-11/root/usr/lib/gcc/%{_arch}-redhat-linux/11/plugin/{,gcc-}annobin.so %cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DWASMEDGE_BUILD_TESTS=OFF %cmake_build mkdir rt From d2e674867335cfdb5435a0339c4850e1c0726845 Mon Sep 17 00:00:00 2001 From: dm4 Date: Wed, 12 Jul 2023 07:35:47 +0000 Subject: [PATCH 06/18] Revert fmt fix for old fmt version Ref: https://github.com/WasmEdge/WasmEdge/pull/2511 Signed-off-by: dm4 --- wasmedge-revert-fmt.patch | 1551 +++++++++++++++++++++++++++++++++++++ wasmedge.spec | 6 +- 2 files changed, 1555 insertions(+), 2 deletions(-) create mode 100644 wasmedge-revert-fmt.patch diff --git a/wasmedge-revert-fmt.patch b/wasmedge-revert-fmt.patch new file mode 100644 index 0000000..3f80b6f --- /dev/null +++ b/wasmedge-revert-fmt.patch @@ -0,0 +1,1551 @@ +--- b/include/common/enum_ast.hpp ++++ a/include/common/enum_ast.hpp +@@ -18,7 +18,6 @@ + #pragma once + + #include "dense_enum_map.h" +-#include "log.h" + #include "spare_enum_map.h" + + #include +@@ -73,23 +72,3 @@ + (); + + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ASTNodeAttr &Attr, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::ASTNodeAttrStr[Attr], +- Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::OpCode &Code, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::OpCodeStr[Code], Ctx); +- } +-}; +--- b/include/common/enum_errcode.hpp ++++ a/include/common/enum_errcode.hpp +@@ -15,7 +15,6 @@ + #pragma once + + #include "dense_enum_map.h" +-#include "log.h" + #include "spare_enum_map.h" + + #include +@@ -76,11 +75,6 @@ + ? ErrCode::Value::UserDefError + : static_cast(getCode()); + } +- constexpr WasmPhase getErrCodePhase() const noexcept { +- return getCategory() != ErrCategory::WASM +- ? WasmPhase::UserDefined +- : static_cast((getCode() & 0xF0U) >> 5); +- } + + constexpr ErrCode() noexcept : Inner({.Num = 0}) {} + constexpr ErrCode(const ErrCode &E) noexcept : Inner({.Num = E.Inner.Num}) {} +@@ -138,13 +132,3 @@ + (); + + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::WasmPhase &Phase, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::WasmPhaseStr[Phase], +- Ctx); +- } +-}; +--- b/include/common/enum_errinfo.hpp ++++ a/include/common/enum_errinfo.hpp +@@ -109,36 +109,3 @@ + + } // namespace ErrInfo + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::PtrType &Type, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format( +- WasmEdge::ErrInfo::PtrTypeStr[Type], Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::MismatchCategory &Category, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format( +- WasmEdge::ErrInfo::MismatchCategoryStr[Category], Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::IndexCategory &Category, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format( +- WasmEdge::ErrInfo::IndexCategoryStr[Category], Ctx); +- } +-}; +--- b/include/common/enum_types.hpp ++++ a/include/common/enum_types.hpp +@@ -15,7 +15,6 @@ + #pragma once + + #include "dense_enum_map.h" +-#include "log.h" + #include "spare_enum_map.h" + + #include +@@ -108,31 +107,3 @@ + (); + + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ValType &Type, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::ValTypeStr[Type], Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ValMut &Mut, fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::ValMutStr[Mut], Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ExternalType &Type, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::ExternalTypeStr[Type], +- Ctx); +- } +-}; +--- b/include/common/errcode.h ++++ a/include/common/errcode.h +@@ -33,6 +33,20 @@ + + namespace WasmEdge { + ++static inline WasmPhase getErrCodePhase(const ErrCode &Code) { ++ return static_cast(Code.getCategory() == ErrCategory::WASM ++ ? ((Code.getCode() & 0xF0U) >> 5) ++ : 0x05U // WasmPhase::UserDefined ++ ); ++} ++ ++static inline std::ostream &operator<<(std::ostream &OS, const ErrCode &Code) { ++ OS << WasmPhaseStr[getErrCodePhase(Code)] ++ << " failed: " << ErrCodeStr[Code.getEnum()] ++ << ", Code: " << convertUIntToHexStr(Code.getCode(), 2); ++ return OS; ++} ++ + static inline constexpr bool likely(bool V) noexcept { + return __builtin_expect(V, true); + } +@@ -54,25 +68,7 @@ + + } // namespace WasmEdge + ++#if FMT_VERSION >= 90000 + template <> ++struct fmt::formatter : ostream_formatter {}; ++#endif +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrCode &Code, +- fmt::format_context &Ctx) const noexcept { +- using namespace std::literals; +- std::string Output = +- fmt::format("{} failed: {}, Code: 0x{:02x}"sv, Code.getErrCodePhase(), +- WasmEdge::ErrCodeStr[Code.getEnum()], Code.getCode()); +- return formatter::format(Output, Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrCode::Value &Value, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::ErrCode(Value), Ctx); +- } +-}; +--- b/include/common/errinfo.h ++++ a/include/common/errinfo.h +@@ -37,6 +37,8 @@ + InfoFile() = delete; + InfoFile(const std::filesystem::path &FName) noexcept : FileName(FName) {} + ++ friend std::ostream &operator<<(std::ostream &OS, const struct InfoFile &Rhs); ++ + std::filesystem::path FileName; + }; + +@@ -44,6 +46,9 @@ + InfoLoading() = delete; + InfoLoading(const uint64_t Off) noexcept : Offset(Off) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoLoading &Rhs); ++ + uint64_t Offset; + }; + +@@ -51,6 +56,8 @@ + InfoAST() = delete; + InfoAST(const ASTNodeAttr Attr) noexcept : NodeAttr(Attr) {} + ++ friend std::ostream &operator<<(std::ostream &OS, const struct InfoAST &Rhs); ++ + ASTNodeAttr NodeAttr; + }; + +@@ -60,6 +67,9 @@ + const uint32_t Lim) noexcept + : Instance(Inst), Number(Num), Limited(Lim) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoInstanceBound &Rhs); ++ + ExternalType Instance; + uint32_t Number, Limited; + }; +@@ -70,6 +80,9 @@ + const uint32_t Bound) noexcept + : Category(Cate), Index(Idx), Boundary(Bound) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoForbidIndex &Rhs); ++ + IndexCategory Category; + uint32_t Index, Boundary; + }; +@@ -78,6 +91,9 @@ + InfoExporting() = delete; + InfoExporting(std::string_view Ext) noexcept : ExtName(Ext) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoExporting &Rhs); ++ + std::string ExtName; + }; + +@@ -87,6 +103,9 @@ + const uint32_t Max = 0) noexcept + : LimHasMax(HasMax), LimMin(Min), LimMax(Max) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoLimit &Rhs); ++ + bool LimHasMax; + uint32_t LimMin, LimMax; + }; +@@ -95,6 +114,9 @@ + InfoRegistering() = delete; + InfoRegistering(std::string_view Mod) noexcept : ModName(Mod) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoRegistering &Rhs); ++ + std::string ModName; + }; + +@@ -104,6 +126,9 @@ + const ExternalType ExtT = ExternalType::Function) noexcept + : ModName(Mod), ExtName(Ext), ExtType(ExtT) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoLinking &Rhs); ++ + std::string ModName; + std::string ExtName; + ExternalType ExtType; +@@ -115,6 +140,9 @@ + : ModName(Mod), FuncName(Func) {} + InfoExecuting(std::string_view Func) noexcept : ModName(""), FuncName(Func) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoExecuting &Rhs); ++ + std::string ModName; + std::string FuncName; + }; +@@ -190,6 +218,9 @@ + : Category(MismatchCategory::Version), ExpVersion(ExpV), + GotVersion(GotV) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoMismatch &Rhs); ++ + /// Mismatched category + MismatchCategory Category; + +@@ -231,6 +262,9 @@ + : Code(Op), Offset(Off), Args(ArgsVec), ArgsTypes(ArgsTypesVec), + IsSigned(Signed) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoInstruction &Rhs); ++ + OpCode Code; + uint64_t Offset; + std::vector Args; +@@ -245,6 +279,9 @@ + const uint32_t Lim = std::numeric_limits::max()) noexcept + : Offset(Off), Size(Len), Limit(Lim) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoBoundary &Rhs); ++ + uint64_t Offset; + uint32_t Size; + uint32_t Limit; +@@ -254,104 +291,45 @@ + InfoProposal() = delete; + InfoProposal(Proposal P) noexcept : P(P) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoProposal &Rhs); + Proposal P; + }; + + } // namespace ErrInfo + } // namespace WasmEdge + ++#if FMT_VERSION >= 90000 + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoFile &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoLoading &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoAST &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> + struct fmt::formatter ++ : ostream_formatter {}; +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoInstanceBound &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter { +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoForbidIndex &Info, +- fmt::format_context &Ctx) const noexcept; + }; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoExporting &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoLimit &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter { +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoRegistering &Info, +- fmt::format_context &Ctx) const noexcept; + }; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoLinking &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoExecuting &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoMismatch &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter { +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoInstruction &Info, +- fmt::format_context &Ctx) const noexcept; + }; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoBoundary &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; ++#endif +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoProposal &Info, +- fmt::format_context &Ctx) const noexcept; +-}; +--- b/include/common/log.h ++++ a/include/common/log.h +@@ -13,8 +13,8 @@ + //===----------------------------------------------------------------------===// + #pragma once + +-#include "common/filesystem.h" + #define SPDLOG_NO_EXCEPTIONS 1 ++#include "spdlog/fmt/ostr.h" + #include "spdlog/spdlog.h" + + namespace WasmEdge { +@@ -32,26 +32,3 @@ + + } // namespace Log + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator format(const std::filesystem::path &Path, +- fmt::format_context &Ctx) const { +- // mimic std::quoted +- constexpr const char Delimiter = '"'; +- constexpr const char Escape = '\\'; +- auto Quoted = fmt::memory_buffer(); +- auto Iter = std::back_inserter(Quoted); +- *Iter++ = Delimiter; +- for (const auto C : Path.u8string()) { +- if (C == Delimiter || C == Escape) { +- *Iter++ = Escape; +- } +- *Iter++ = C; +- } +- *Iter++ = Delimiter; +- return fmt::formatter::format( +- std::string_view(Quoted.data(), Quoted.size()), Ctx); +- } +-}; +--- b/include/host/wasi/error.h ++++ a/include/host/wasi/error.h +@@ -4,9 +4,7 @@ + #pragma once + + #include "common/expected.h" +-#include "common/log.h" + #include "wasi/api.hpp" +-#include + + namespace WasmEdge { + namespace Host { +@@ -26,296 +24,3 @@ + } // namespace WASI + } // namespace Host + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter<__wasi_errno_t> : fmt::formatter { +- fmt::format_context::iterator +- format(__wasi_errno_t ErrNo, fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- using namespace std::literals; +- auto Iter = std::back_inserter(Buffer); +- switch (ErrNo) { +- case __WASI_ERRNO_SUCCESS: +- fmt::format_to( +- Iter, "No error occurred. System call completed successfully."sv); +- break; +- case __WASI_ERRNO_2BIG: +- fmt::format_to(Iter, "Argument list too long."sv); +- break; +- case __WASI_ERRNO_ACCES: +- fmt::format_to(Iter, "Permission denied."sv); +- break; +- case __WASI_ERRNO_ADDRINUSE: +- fmt::format_to(Iter, "Address in use."sv); +- break; +- case __WASI_ERRNO_ADDRNOTAVAIL: +- fmt::format_to(Iter, "Address not available."sv); +- break; +- case __WASI_ERRNO_AFNOSUPPORT: +- fmt::format_to(Iter, "Address family not supported."sv); +- break; +- case __WASI_ERRNO_AGAIN: +- fmt::format_to(Iter, "Resource unavailable, or operation would block."sv); +- break; +- case __WASI_ERRNO_ALREADY: +- fmt::format_to(Iter, "Connection already in progress."sv); +- break; +- case __WASI_ERRNO_BADF: +- fmt::format_to(Iter, "Bad file descriptor."sv); +- break; +- case __WASI_ERRNO_BADMSG: +- fmt::format_to(Iter, "Bad message."sv); +- break; +- case __WASI_ERRNO_BUSY: +- fmt::format_to(Iter, "Device or resource busy."sv); +- break; +- case __WASI_ERRNO_CANCELED: +- fmt::format_to(Iter, "Operation canceled."sv); +- break; +- case __WASI_ERRNO_CHILD: +- fmt::format_to(Iter, "No child processes."sv); +- break; +- case __WASI_ERRNO_CONNABORTED: +- fmt::format_to(Iter, "Connection aborted."sv); +- break; +- case __WASI_ERRNO_CONNREFUSED: +- fmt::format_to(Iter, "Connection refused."sv); +- break; +- case __WASI_ERRNO_CONNRESET: +- fmt::format_to(Iter, "Connection reset."sv); +- break; +- case __WASI_ERRNO_DEADLK: +- fmt::format_to(Iter, "Resource deadlock would occur."sv); +- break; +- case __WASI_ERRNO_DESTADDRREQ: +- fmt::format_to(Iter, "Destination address required."sv); +- break; +- case __WASI_ERRNO_DOM: +- fmt::format_to(Iter, "Mathematics argument out of domain of function."sv); +- break; +- case __WASI_ERRNO_DQUOT: +- fmt::format_to(Iter, "Reserved."sv); +- break; +- case __WASI_ERRNO_EXIST: +- fmt::format_to(Iter, "File exists."sv); +- break; +- case __WASI_ERRNO_FAULT: +- fmt::format_to(Iter, "Bad address."sv); +- break; +- case __WASI_ERRNO_FBIG: +- fmt::format_to(Iter, "File too large."sv); +- break; +- case __WASI_ERRNO_HOSTUNREACH: +- fmt::format_to(Iter, "Host is unreachable."sv); +- break; +- case __WASI_ERRNO_IDRM: +- fmt::format_to(Iter, "Identifier removed."sv); +- break; +- case __WASI_ERRNO_ILSEQ: +- fmt::format_to(Iter, "Illegal byte sequence."sv); +- break; +- case __WASI_ERRNO_INPROGRESS: +- fmt::format_to(Iter, "Operation in progress."sv); +- break; +- case __WASI_ERRNO_INTR: +- fmt::format_to(Iter, "Interrupted function."sv); +- break; +- case __WASI_ERRNO_INVAL: +- fmt::format_to(Iter, "Invalid argument."sv); +- break; +- case __WASI_ERRNO_IO: +- fmt::format_to(Iter, "I/O error."sv); +- break; +- case __WASI_ERRNO_ISCONN: +- fmt::format_to(Iter, "Socket is connected."sv); +- break; +- case __WASI_ERRNO_ISDIR: +- fmt::format_to(Iter, "Is a directory."sv); +- break; +- case __WASI_ERRNO_LOOP: +- fmt::format_to(Iter, "Too many levels of symbolic links."sv); +- break; +- case __WASI_ERRNO_MFILE: +- fmt::format_to(Iter, "File descriptor value too large."sv); +- break; +- case __WASI_ERRNO_MLINK: +- fmt::format_to(Iter, "Too many links."sv); +- break; +- case __WASI_ERRNO_MSGSIZE: +- fmt::format_to(Iter, "Message too large."sv); +- break; +- case __WASI_ERRNO_MULTIHOP: +- fmt::format_to(Iter, "Reserved."sv); +- break; +- case __WASI_ERRNO_NAMETOOLONG: +- fmt::format_to(Iter, "Filename too long."sv); +- break; +- case __WASI_ERRNO_NETDOWN: +- fmt::format_to(Iter, "Network is down."sv); +- break; +- case __WASI_ERRNO_NETRESET: +- fmt::format_to(Iter, "Connection aborted by network."sv); +- break; +- case __WASI_ERRNO_NETUNREACH: +- fmt::format_to(Iter, "Network unreachable."sv); +- break; +- case __WASI_ERRNO_NFILE: +- fmt::format_to(Iter, "Too many files open in system."sv); +- break; +- case __WASI_ERRNO_NOBUFS: +- fmt::format_to(Iter, "No buffer space available."sv); +- break; +- case __WASI_ERRNO_NODEV: +- fmt::format_to(Iter, "No such device."sv); +- break; +- case __WASI_ERRNO_NOENT: +- fmt::format_to(Iter, "No such file or directory."sv); +- break; +- case __WASI_ERRNO_NOEXEC: +- fmt::format_to(Iter, "Executable file format error."sv); +- break; +- case __WASI_ERRNO_NOLCK: +- fmt::format_to(Iter, "No locks available."sv); +- break; +- case __WASI_ERRNO_NOLINK: +- fmt::format_to(Iter, "Reserved."sv); +- break; +- case __WASI_ERRNO_NOMEM: +- fmt::format_to(Iter, "Not enough space."sv); +- break; +- case __WASI_ERRNO_NOMSG: +- fmt::format_to(Iter, "No message of the desired type."sv); +- break; +- case __WASI_ERRNO_NOPROTOOPT: +- fmt::format_to(Iter, "Protocol not available."sv); +- break; +- case __WASI_ERRNO_NOSPC: +- fmt::format_to(Iter, "No space left on device."sv); +- break; +- case __WASI_ERRNO_NOSYS: +- fmt::format_to(Iter, "Function not supported."sv); +- break; +- case __WASI_ERRNO_NOTCONN: +- fmt::format_to(Iter, "The socket is not connected."sv); +- break; +- case __WASI_ERRNO_NOTDIR: +- fmt::format_to(Iter, +- "Not a directory or a symbolic link to a directory."sv); +- break; +- case __WASI_ERRNO_NOTEMPTY: +- fmt::format_to(Iter, "Directory not empty."sv); +- break; +- case __WASI_ERRNO_NOTRECOVERABLE: +- fmt::format_to(Iter, "State not recoverable."sv); +- break; +- case __WASI_ERRNO_NOTSOCK: +- fmt::format_to(Iter, "Not a socket."sv); +- break; +- case __WASI_ERRNO_NOTSUP: +- fmt::format_to(Iter, +- "Not supported, or operation not supported on socket."sv); +- break; +- case __WASI_ERRNO_NOTTY: +- fmt::format_to(Iter, "Inappropriate I/O control operation."sv); +- break; +- case __WASI_ERRNO_NXIO: +- fmt::format_to(Iter, "No such device or address."sv); +- break; +- case __WASI_ERRNO_OVERFLOW: +- fmt::format_to(Iter, "Value too large to be stored in data type."sv); +- break; +- case __WASI_ERRNO_OWNERDEAD: +- fmt::format_to(Iter, "Previous owner died."sv); +- break; +- case __WASI_ERRNO_PERM: +- fmt::format_to(Iter, "Operation not permitted."sv); +- break; +- case __WASI_ERRNO_PIPE: +- fmt::format_to(Iter, "Broken pipe."sv); +- break; +- case __WASI_ERRNO_PROTO: +- fmt::format_to(Iter, "Protocol error."sv); +- break; +- case __WASI_ERRNO_PROTONOSUPPORT: +- fmt::format_to(Iter, "Protocol not supported."sv); +- break; +- case __WASI_ERRNO_PROTOTYPE: +- fmt::format_to(Iter, "Protocol wrong type for socket."sv); +- break; +- case __WASI_ERRNO_RANGE: +- fmt::format_to(Iter, "Result too large."sv); +- break; +- case __WASI_ERRNO_ROFS: +- fmt::format_to(Iter, "Read-only file system."sv); +- break; +- case __WASI_ERRNO_SPIPE: +- fmt::format_to(Iter, "Invalid seek."sv); +- break; +- case __WASI_ERRNO_SRCH: +- fmt::format_to(Iter, "No such process."sv); +- break; +- case __WASI_ERRNO_STALE: +- fmt::format_to(Iter, "Reserved."sv); +- break; +- case __WASI_ERRNO_TIMEDOUT: +- fmt::format_to(Iter, "Connection timed out."sv); +- break; +- case __WASI_ERRNO_TXTBSY: +- fmt::format_to(Iter, "Text file busy."sv); +- break; +- case __WASI_ERRNO_XDEV: +- fmt::format_to(Iter, "Cross-device link."sv); +- break; +- case __WASI_ERRNO_NOTCAPABLE: +- fmt::format_to(Iter, "Extension: Capabilities insufficient."sv); +- break; +- case __WASI_ERRNO_AIADDRFAMILY: +- fmt::format_to(Iter, +- "The specified network host does not have any network " +- "addresses in the requested address family."sv); +- break; +- case __WASI_ERRNO_AIAGAIN: +- fmt::format_to(Iter, "Try again later."sv); +- break; +- case __WASI_ERRNO_AIBADFLAG: +- fmt::format_to(Iter, "Hints.ai_flags contains invalid flags"sv); +- break; +- case __WASI_ERRNO_AIFAIL: +- fmt::format_to( +- Iter, "The name server returned a permanent failure indication."sv); +- break; +- case __WASI_ERRNO_AIFAMILY: +- fmt::format_to(Iter, "The requested address family is not supported."sv); +- break; +- case __WASI_ERRNO_AIMEMORY: +- fmt::format_to(Iter, "Addrinfo out of memory."sv); +- break; +- case __WASI_ERRNO_AINODATA: +- fmt::format_to(Iter, "Network host exists, but does not have any network " +- "addresses defined."sv); +- break; +- case __WASI_ERRNO_AINONAME: +- fmt::format_to( +- Iter, +- "Node or service is not known; or both node and service are NULL."sv); +- break; +- case __WASI_ERRNO_AISERVICE: +- fmt::format_to( +- Iter, "Service is not available for the requested socket type."sv); +- break; +- case __WASI_ERRNO_AISOCKTYPE: +- fmt::format_to(Iter, "The requested socket type is not supported."sv); +- break; +- case __WASI_ERRNO_AISYSTEM: +- fmt::format_to(Iter, "Other system error."sv); +- break; +- default: +- fmt::format_to( +- Iter, "Unknown error code {}"sv, +- static_cast>(ErrNo)); +- break; +- } +- return fmt::formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); +- } +-}; +--- b/lib/common/CMakeLists.txt ++++ a/lib/common/CMakeLists.txt +@@ -7,7 +7,7 @@ + FetchContent_Declare( + spdlog + GIT_REPOSITORY https://github.com/gabime/spdlog.git ++ GIT_TAG v1.9.0 +- GIT_TAG v1.11.0 + GIT_SHALLOW TRUE + ) + set(SPDLOG_BUILD_SHARED OFF CACHE BOOL "Build shared library" FORCE) +--- b/lib/common/errinfo.cpp ++++ a/lib/common/errinfo.cpp +@@ -2,316 +2,270 @@ + // SPDX-FileCopyrightText: 2019-2022 Second State INC + + #include "common/errinfo.h" ++ + #include "common/errcode.h" + #include "common/hexstr.h" + ++namespace WasmEdge { ++namespace ErrInfo { ++std::ostream &operator<<(std::ostream &OS, const struct InfoFile &Rhs) { ++ OS << " File name: " << Rhs.FileName; ++ return OS; +-using namespace std::literals; +- +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoFile &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), " File name: {}"sv, +- Info.FileName); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoLoading &Rhs) { ++ OS << " Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoLoading &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), " Bytecode offset: 0x{:08x}"sv, +- Info.Offset); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoAST &Rhs) { ++ OS << " At AST node: " << ASTNodeAttrStr[Rhs.NodeAttr]; ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoAST &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), " At AST node: {}"sv, +- Info.NodeAttr); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, ++ const struct InfoInstanceBound &Rhs) { ++ OS << " Instance " << ExternalTypeStr[Rhs.Instance] ++ << " has limited number " << Rhs.Limited << " , Got: " << Rhs.Number; ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoInstanceBound &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), +- " Instance {} has limited number {} , Got: {}"sv, +- Info.Instance, Info.Limited, Info.Number); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoForbidIndex &Rhs) { ++ OS << " When checking " << IndexCategoryStr[Rhs.Category] ++ << " index: " << Rhs.Index << " , Out of boundary: "; ++ if (Rhs.Boundary > 0) { ++ OS << (Rhs.Boundary - 1); +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoForbidIndex &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- auto Iter = +- fmt::format_to(std::back_inserter(Buffer), +- " When checking {} index: {} , Out of boundary: "sv, +- Info.Category, Info.Index); +- if (Info.Boundary > 0) { +- fmt::format_to(Iter, "{}"sv, Info.Boundary - 1); + } else { ++ OS << "empty"; +- fmt::format_to(Iter, "empty"sv); + } ++ return OS; +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoExporting &Rhs) { ++ OS << " Duplicated exporting name: \"" << Rhs.ExtName << "\""; ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoExporting &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), +- " Duplicated exporting name: \"{}\""sv, Info.ExtName); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoLimit &Rhs) { ++ OS << " In Limit type: { min: " << Rhs.LimMin; ++ if (Rhs.LimHasMax) { ++ OS << " , max: " << Rhs.LimMax; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoLimit &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- auto Iter = fmt::format_to(std::back_inserter(Buffer), +- " In Limit type: {{ min: {}"sv, Info.LimMin); +- if (Info.LimHasMax) { +- Iter = fmt::format_to(Iter, " , max: {}"sv, Info.LimMax); + } ++ OS << " }"; ++ return OS; +- fmt::format_to(Iter, " }}"sv); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoRegistering &Rhs) { ++ OS << " Module name: \"" << Rhs.ModName << "\""; ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoRegistering &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), " Module name: \"{}\""sv, +- Info.ModName); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoLinking &Rhs) { ++ OS << " When linking module: \"" << Rhs.ModName << "\" , " ++ << ExternalTypeStr[Rhs.ExtType] << " name: \"" << Rhs.ExtName << "\""; ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoLinking &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), +- " When linking module: \"{}\" , {} name: \"{}\""sv, +- Info.ModName, Info.ExtType, Info.ExtName); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoExecuting &Rhs) { ++ OS << " When executing "; ++ if (Rhs.ModName != "") { ++ OS << "module name: \"" << Rhs.ModName << "\" , "; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoExecuting &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- auto Iter = +- fmt::format_to(std::back_inserter(Buffer), " When executing "sv); +- if (!Info.ModName.empty()) { +- Iter = fmt::format_to(Iter, "module name: \"{}\" , "sv, Info.ModName); + } ++ OS << "function name: \"" << Rhs.FuncName << "\""; ++ return OS; +- fmt::format_to(Iter, "function name: \"{}\""sv, Info.FuncName); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoMismatch &Rhs) { ++ OS << " Mismatched " << MismatchCategoryStr[Rhs.Category] << ". "; ++ switch (Rhs.Category) { ++ case MismatchCategory::Alignment: ++ OS << "Expected: need to <= " << static_cast(Rhs.ExpAlignment) ++ << " , Got: " << (1UL << Rhs.GotAlignment); +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoMismatch &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- auto Iter = fmt::format_to(std::back_inserter(Buffer), +- " Mismatched {}. "sv, Info.Category); +- auto FormatLimit = [](auto Out, bool LimHasMax, uint32_t LimMin, +- uint32_t LimMax) { +- Out = fmt::format_to(Out, "Limit{{{}"sv, LimMin); +- if (LimHasMax) { +- Out = fmt::format_to(Out, " , {}"sv, LimMax); +- } +- Out = fmt::format_to(Out, "}}"sv); +- return Out; +- }; +- switch (Info.Category) { +- case WasmEdge::ErrInfo::MismatchCategory::Alignment: +- fmt::format_to(Iter, "Expected: need to <= {} , Got: {}"sv, +- static_cast(Info.ExpAlignment), +- 1UL << Info.GotAlignment); + break; ++ case MismatchCategory::ValueType: ++ OS << "Expected: " << ValTypeStr[Rhs.ExpValType] ++ << " , Got: " << ValTypeStr[Rhs.GotValType]; +- case WasmEdge::ErrInfo::MismatchCategory::ValueType: +- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpValType, +- Info.GotValType); + break; ++ case MismatchCategory::ValueTypes: ++ OS << "Expected: types{"; ++ for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { ++ OS << ValTypeStr[Rhs.ExpParams[I]]; ++ if (I < Rhs.ExpParams.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "} , Got: types{"; ++ for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { ++ OS << ValTypeStr[Rhs.GotParams[I]]; ++ if (I < Rhs.GotParams.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "}"; +- case WasmEdge::ErrInfo::MismatchCategory::ValueTypes: +- fmt::format_to(Iter, "Expected: types{{{}}} , Got: types{{{}}}"sv, +- fmt::join(Info.ExpParams, " , "sv), +- fmt::join(Info.GotParams, " , "sv)); + break; ++ case MismatchCategory::Mutation: ++ OS << "Expected: " << ValMutStr[Rhs.ExpValMut] ++ << " , Got: " << ValMutStr[Rhs.GotValMut]; +- case WasmEdge::ErrInfo::MismatchCategory::Mutation: +- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpValMut, +- Info.GotValMut); + break; ++ case MismatchCategory::ExternalType: ++ OS << "Expected: " << ExternalTypeStr[Rhs.ExpExtType] ++ << " , Got: " << ExternalTypeStr[Rhs.GotExtType]; +- case WasmEdge::ErrInfo::MismatchCategory::ExternalType: +- fmt::format_to(Iter, "Expected: {} , Got: {}", Info.ExpExtType, +- Info.GotExtType); + break; ++ case MismatchCategory::FunctionType: ++ OS << "Expected: FuncType {params{"; ++ for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { ++ OS << ValTypeStr[Rhs.ExpParams[I]]; ++ if (I < Rhs.ExpParams.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "} returns{"; ++ for (uint32_t I = 0; I < Rhs.ExpReturns.size(); ++I) { ++ OS << ValTypeStr[Rhs.ExpReturns[I]]; ++ if (I < Rhs.ExpReturns.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "}} , Got: FuncType {params{"; ++ for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { ++ OS << ValTypeStr[Rhs.GotParams[I]]; ++ if (I < Rhs.GotParams.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "} returns{"; ++ for (uint32_t I = 0; I < Rhs.GotReturns.size(); ++I) { ++ OS << ValTypeStr[Rhs.GotReturns[I]]; ++ if (I < Rhs.GotReturns.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "}}"; +- case WasmEdge::ErrInfo::MismatchCategory::FunctionType: +- fmt::format_to(Iter, +- "Expected: FuncType {{params{{{}}} returns{{{}}}}} , " +- "Got: FuncType {{params{{{}}} returns{{{}}}}}"sv, +- fmt::join(Info.ExpParams, " , "sv), +- fmt::join(Info.ExpReturns, " , "sv), +- fmt::join(Info.GotParams, " , "sv), +- fmt::join(Info.GotReturns, " , "sv)); + break; ++ case MismatchCategory::Table: ++ OS << "Expected: TableType {RefType{" ++ << ValTypeStr[static_cast(Rhs.ExpRefType)] << "} Limit{" ++ << Rhs.ExpLimMin; ++ if (Rhs.ExpLimHasMax) { ++ OS << " , " << Rhs.ExpLimMax; ++ } ++ OS << "}} , Got: TableType {RefType{" ++ << ValTypeStr[static_cast(Rhs.GotRefType)] << "} Limit{" ++ << Rhs.GotLimMin; ++ if (Rhs.GotLimHasMax) { ++ OS << " , " << Rhs.GotLimMax; ++ } ++ OS << "}}"; +- case WasmEdge::ErrInfo::MismatchCategory::Table: +- Iter = fmt::format_to(Iter, "Expected: TableType {{RefType{{{}}} "sv, +- static_cast(Info.ExpRefType)); +- Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); +- Iter = fmt::format_to(Iter, "}} , Got: TableType {{RefType{{{}}} "sv, +- static_cast(Info.GotRefType)); +- Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); +- fmt::format_to(Iter, "}}"sv); + break; ++ case MismatchCategory::Memory: ++ OS << "Expected: MemoryType {Limit{" << Rhs.ExpLimMin; ++ if (Rhs.ExpLimHasMax) { ++ OS << " , " << Rhs.ExpLimMax; ++ } ++ OS << "}} , Got: MemoryType {Limit{" << Rhs.GotLimMin; ++ if (Rhs.GotLimHasMax) { ++ OS << " , " << Rhs.GotLimMax; ++ } ++ OS << "}}"; +- case WasmEdge::ErrInfo::MismatchCategory::Memory: +- Iter = fmt::format_to(Iter, "Expected: MemoryType {{"sv); +- Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); +- Iter = fmt::format_to(Iter, "}} , Got: MemoryType {{"sv); +- Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); +- fmt::format_to(Iter, "}}"sv); + break; ++ case MismatchCategory::Global: ++ OS << "Expected: GlobalType {Mutation{" << ValMutStr[Rhs.ExpValMut] ++ << "} ValType{" << ValTypeStr[Rhs.ExpValType] ++ << "}} , Got: GlobalType {Mutation{" << ValMutStr[Rhs.GotValMut] ++ << "} ValType{" << ValTypeStr[Rhs.GotValType] << "}}"; +- case WasmEdge::ErrInfo::MismatchCategory::Global: +- fmt::format_to(Iter, +- "Expected: GlobalType {{Mutation{{{}}} ValType{{{}}}}} , " +- "Got: GlobalType {{Mutation{{{}}} ValType{{{}}}}}"sv, +- Info.ExpValMut, Info.ExpValType, Info.GotValMut, +- Info.GotValType); + break; ++ case MismatchCategory::Version: ++ OS << "Expected: " << Rhs.ExpVersion << " , Got: " << Rhs.GotVersion; +- case WasmEdge::ErrInfo::MismatchCategory::Version: +- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpVersion, +- Info.GotVersion); + break; + default: + break; + } ++ return OS; +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoInstruction &Rhs) { ++ uint16_t Payload = static_cast(Rhs.Code); ++ OS << " In instruction: " << OpCodeStr[Rhs.Code] << " ("; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoInstruction &Info, +- fmt::format_context &Ctx) const noexcept { +- uint16_t Payload = static_cast(Info.Code); +- fmt::memory_buffer Buffer; +- auto Iter = fmt::format_to(std::back_inserter(Buffer), +- " In instruction: {} ("sv, Info.Code); + if ((Payload >> 8) >= static_cast(0xFCU)) { ++ OS << convertUIntToHexStr(Payload >> 8, 2) << " "; +- Iter = fmt::format_to(Iter, "0x{:02x} "sv, Payload >> 8); + } ++ OS << convertUIntToHexStr(Payload & 0xFFU, 2) ++ << ") , Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); ++ if (Rhs.Args.size() > 0) { ++ OS << " , Args: ["; ++ for (uint32_t I = 0; I < Rhs.Args.size(); ++I) { ++ switch (Rhs.ArgsTypes[I]) { ++ case ValType::I32: ++ if (Rhs.IsSigned) { ++ OS << Rhs.Args[I].get(); +- Iter = fmt::format_to(Iter, "0x{:02x}) , Bytecode offset: 0x{:08x}"sv, +- Payload & 0xFFU, Info.Offset); +- if (!Info.Args.empty()) { +- Iter = fmt::format_to(Iter, " , Args: ["sv); +- for (uint32_t I = 0; I < Info.Args.size(); ++I) { +- switch (Info.ArgsTypes[I]) { +- case WasmEdge::ValType::I32: +- if (Info.IsSigned) { +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + } else { ++ OS << Rhs.Args[I].get(); +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + } + break; ++ case ValType::I64: ++ if (Rhs.IsSigned) { ++ OS << Rhs.Args[I].get(); +- case WasmEdge::ValType::I64: +- if (Info.IsSigned) { +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + } else { ++ OS << Rhs.Args[I].get(); +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + } + break; ++ case ValType::F32: ++ OS << Rhs.Args[I].get(); +- case WasmEdge::ValType::F32: +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + break; ++ case ValType::F64: ++ OS << Rhs.Args[I].get(); +- case WasmEdge::ValType::F64: +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + break; ++ case ValType::V128: { ++ const auto Value = Rhs.Args[I].get(); ++ OS << std::hex << Value[0] << Value[1]; +- case WasmEdge::ValType::V128: { +- const auto Value = Info.Args[I].get(); +- Iter = fmt::format_to(Iter, "0x{:08x}{:08x}"sv, Value[1], Value[0]); + break; + } ++ case ValType::FuncRef: ++ OS << ValTypeStr[Rhs.ArgsTypes[I]]; ++ if (isNullRef(Rhs.Args[I])) { ++ OS << ":null"; +- case WasmEdge::ValType::FuncRef: +- case WasmEdge::ValType::ExternRef: +- Iter = fmt::format_to(Iter, "{}"sv, Info.ArgsTypes[I]); +- if (isNullRef(Info.Args[I])) { +- Iter = fmt::format_to(Iter, ":null"sv); + } else { ++ OS << ":" << &Rhs.Args[I].get(); ++ } ++ break; ++ case ValType::ExternRef: ++ OS << ValTypeStr[Rhs.ArgsTypes[I]]; ++ if (isNullRef(Rhs.Args[I])) { ++ OS << ":null"; ++ } else { ++ OS << ":" << &Rhs.Args[I].get(); +- Iter = +- fmt::format_to(Iter, ":0x{:08x}"sv, Info.Args[I].get()); + } + break; + default: + break; + } ++ if (I < Rhs.Args.size() - 1) { ++ OS << " , "; +- if (I < Info.Args.size() - 1) { +- Iter = fmt::format_to(Iter, " , "sv); + } + } ++ OS << "]"; +- Iter = fmt::format_to(Iter, "]"sv); + } ++ return OS; +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoBoundary &Rhs) { ++ OS << " Accessing offset from: " << convertUIntToHexStr(Rhs.Offset) ++ << " to: " ++ << convertUIntToHexStr(Rhs.Offset + Rhs.Size - (Rhs.Size > 0 ? 1 : 0)) ++ << " , Out of boundary: " << convertUIntToHexStr(Rhs.Limit); ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoBoundary &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), +- " Accessing offset from: 0x{:08x} to: 0x{:08x} , Out of " +- "boundary: 0x{:08x}"sv, +- Info.Offset, +- Info.Offset + (Info.Size > 0U ? Info.Size - 1U : 0U), +- Info.Limit); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoProposal &Rhs) { ++ if (auto Iter = ProposalStr.find(Rhs.P); Iter != ProposalStr.end()) { ++ OS << " This instruction or syntax requires enabling proposal " ++ << Iter->second; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoProposal &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- if (auto Iter = WasmEdge::ProposalStr.find(Info.P); +- Iter != WasmEdge::ProposalStr.end()) { +- fmt::format_to( +- std::back_inserter(Buffer), +- " This instruction or syntax requires enabling proposal {}"sv, +- Iter->second); + } else { ++ OS << " Unknown proposal, Code " ++ << convertUIntToHexStr(static_cast(Rhs.P)); +- fmt::format_to(std::back_inserter(Buffer), +- " Unknown proposal, Code 0x{:08x}"sv, +- static_cast(Info.P)); + } ++ return OS; +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } ++ ++} // namespace ErrInfo ++} // namespace WasmEdge +--- b/test/errinfo/errinfoTest.cpp ++++ a/test/errinfo/errinfoTest.cpp +@@ -5,124 +5,122 @@ + + #include + #include ++#include +-#include + #include + +-using namespace std::literals; +- + namespace { + + TEST(ErrInfoTest, Info__File) { + WasmEdge::ErrInfo::InfoFile Info1("file.txt"); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Loading) { + WasmEdge::ErrInfo::InfoLoading Info1(30); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__AST) { + WasmEdge::ErrInfo::InfoAST Info1(WasmEdge::ASTNodeAttr::Module); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__InstanceBound) { + WasmEdge::ErrInfo::InfoInstanceBound Info1(WasmEdge::ExternalType::Memory, 2, + 1); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__ForbidIndex) { + WasmEdge::ErrInfo::InfoForbidIndex Info1( + WasmEdge::ErrInfo::IndexCategory::FunctionType, 2, 1); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoForbidIndex Info2( + WasmEdge::ErrInfo::IndexCategory::Memory, 2, 0); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Exporting) { + WasmEdge::ErrInfo::InfoExporting Info1("export"); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Limit) { + WasmEdge::ErrInfo::InfoLimit Info1(true, 10, 20); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoLimit Info2(false, 30); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Registering) { + WasmEdge::ErrInfo::InfoRegistering Info1("host_func"); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Linking) { + WasmEdge::ErrInfo::InfoLinking Info1("module", "func"); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Executing) { + WasmEdge::ErrInfo::InfoExecuting Info1("", "func"); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoExecuting Info2("module", "func"); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Mismatch) { + WasmEdge::ErrInfo::InfoMismatch Info1(static_cast(16), 8888); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoMismatch Info2(WasmEdge::ValType::ExternRef, + WasmEdge::ValType::FuncRef); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + WasmEdge::ErrInfo::InfoMismatch Info3( + {WasmEdge::ValType::I32, WasmEdge::ValType::FuncRef}, + {WasmEdge::ValType::F64, WasmEdge::ValType::ExternRef, + WasmEdge::ValType::V128}); ++ std::cout << Info3 << std::endl; +- fmt::print("{}\n"sv, Info3); + WasmEdge::ErrInfo::InfoMismatch Info4(WasmEdge::ValMut::Const, + WasmEdge::ValMut::Var); ++ std::cout << Info4 << std::endl; +- fmt::print("{}\n"sv, Info4); + WasmEdge::ErrInfo::InfoMismatch Info5(WasmEdge::ExternalType::Function, + WasmEdge::ExternalType::Global); ++ std::cout << Info5 << std::endl; +- fmt::print("{}\n"sv, Info5); + WasmEdge::ErrInfo::InfoMismatch Info6( + {WasmEdge::ValType::I32, WasmEdge::ValType::FuncRef}, + {WasmEdge::ValType::I64, WasmEdge::ValType::F64}, + {WasmEdge::ValType::F64, WasmEdge::ValType::ExternRef, + WasmEdge::ValType::V128}, + {WasmEdge::ValType::V128}); ++ std::cout << Info6 << std::endl; +- fmt::print("{}\n"sv, Info6); + WasmEdge::ErrInfo::InfoMismatch Info7(WasmEdge::RefType::ExternRef, true, 10, + 20, WasmEdge::RefType::FuncRef, true, + 20, 50); ++ std::cout << Info7 << std::endl; +- fmt::print("{}\n"sv, Info7); + WasmEdge::ErrInfo::InfoMismatch Info8(WasmEdge::RefType::ExternRef, false, 10, + 10, WasmEdge::RefType::FuncRef, false, + 20, 20); ++ std::cout << Info8 << std::endl; +- fmt::print("{}\n"sv, Info8); + WasmEdge::ErrInfo::InfoMismatch Info9(true, 10, 20, true, 20, 50); ++ std::cout << Info9 << std::endl; +- fmt::print("{}\n"sv, Info9); + WasmEdge::ErrInfo::InfoMismatch Info10(false, 10, 10, false, 20, 20); ++ std::cout << Info10 << std::endl; +- fmt::print("{}\n"sv, Info10); + WasmEdge::ErrInfo::InfoMismatch Info11( + WasmEdge::ValType::I32, WasmEdge::ValMut::Var, WasmEdge::ValType::I64, + WasmEdge::ValMut::Const); ++ std::cout << Info11 << std::endl; +- fmt::print("{}\n"sv, Info11); + WasmEdge::ErrInfo::InfoMismatch Info12(12345678U, 98765432U); ++ std::cout << Info12 << std::endl; +- fmt::print("{}\n"sv, Info12); + + EXPECT_TRUE(true); + } +@@ -136,54 +134,54 @@ + WasmEdge::ErrInfo::InfoInstruction Info1( + WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::I32, WasmEdge::ValType::I32, WasmEdge::ValType::I32}); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoInstruction Info2( + WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::I32, WasmEdge::ValType::I32, WasmEdge::ValType::I32}); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + WasmEdge::ErrInfo::InfoInstruction Info3( + WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::I64, WasmEdge::ValType::I64, WasmEdge::ValType::I64}); ++ std::cout << Info3 << std::endl; +- fmt::print("{}\n"sv, Info3); + WasmEdge::ErrInfo::InfoInstruction Info4( + WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::F32, WasmEdge::ValType::F32, WasmEdge::ValType::F32}); ++ std::cout << Info4 << std::endl; +- fmt::print("{}\n"sv, Info4); + WasmEdge::ErrInfo::InfoInstruction Info5( + WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::F64, WasmEdge::ValType::F64, WasmEdge::ValType::F64}); ++ std::cout << Info5 << std::endl; +- fmt::print("{}\n"sv, Info5); + WasmEdge::ErrInfo::InfoInstruction Info6(WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::V128, + WasmEdge::ValType::V128, + WasmEdge::ValType::V128}); ++ std::cout << Info6 << std::endl; +- fmt::print("{}\n"sv, Info6); + WasmEdge::ErrInfo::InfoInstruction Info7(WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::FuncRef, + WasmEdge::ValType::FuncRef, + WasmEdge::ValType::FuncRef}); ++ std::cout << Info7 << std::endl; +- fmt::print("{}\n"sv, Info7); + WasmEdge::ErrInfo::InfoInstruction Info8(WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::ExternRef, + WasmEdge::ValType::ExternRef, + WasmEdge::ValType::ExternRef}); ++ std::cout << Info8 << std::endl; +- fmt::print("{}\n"sv, Info8); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Boundary) { + WasmEdge::ErrInfo::InfoBoundary Info1(3, 5, 2); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoBoundary Info2(3, 0, 2); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Proposal) { + WasmEdge::ErrInfo::InfoProposal Info1(WasmEdge::Proposal::SIMD); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoProposal Info2(static_cast(250U)); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + EXPECT_TRUE(true); + } + diff --git a/wasmedge.spec b/wasmedge.spec index 1edffec..3d6f662 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -12,6 +12,8 @@ Summary: High performance WebAssembly Virtual Machine License: ASL 2.0 and CC0 URL: https://github.com/%{reponame}/%{reponame} Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz +# Revert https://github.com/WasmEdge/WasmEdge/pull/2511 for old fmt version +Patch0: wasmedge-revert-fmt.patch BuildRequires: boost-devel BuildRequires: cmake BuildRequires: gcc-c++ @@ -57,7 +59,7 @@ Provides: %{reponame}-devel = %{version}-%{release} This package contains necessary header files for %{reponame} development. %prep -%autosetup -n %{name} +%autosetup -n %{name} -p1 [ -f VERSION ] || echo -n %{version} > VERSION %build @@ -108,7 +110,7 @@ cd .. %{_libdir}/lib%{name}.so %changelog -* Mon Jul 10 2023 dm4 - 0.13.1-2 +* Mon Jul 10 2023 dm4 - 0.13.1 - Release 0.13.1 * Thu Apr 27 2023 dm4 - 0.12.0-1 - Release 0.12.0 From c40f34f03bb913a1c1bfd824b0753d1509cead36 Mon Sep 17 00:00:00 2001 From: dm4 Date: Fri, 21 Jul 2023 09:26:51 +0000 Subject: [PATCH 07/18] Update changelog Signed-off-by: dm4 --- wasmedge.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wasmedge.spec b/wasmedge.spec index ef50f41..63cf2d3 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -110,6 +110,8 @@ cd .. %{_libdir}/lib%{name}.so %changelog +* Fri Jul 21 2023 dm4 - 0.13.2 +- Release 0.13.2 * Mon Jul 10 2023 dm4 - 0.13.1 - Release 0.13.1 * Thu Apr 27 2023 dm4 - 0.12.0-1 From 834adbbaba0eee6f4fc70c77716393dbf3a2532a Mon Sep 17 00:00:00 2001 From: dm4 Date: Mon, 2 Oct 2023 06:33:02 +0000 Subject: [PATCH 08/18] Use llvm instead of llvm16 for epel8 Signed-off-by: dm4 --- wasmedge.spec | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wasmedge.spec b/wasmedge.spec index d1d4f76..072c82b 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -19,12 +19,12 @@ BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gcc-toolset-11-toolchain BuildRequires: git -BuildRequires: lld16-devel -BuildRequires: llvm16-devel +BuildRequires: lld-devel +BuildRequires: llvm-devel BuildRequires: ninja-build BuildRequires: spdlog-devel -Requires: lld16-libs -Requires: llvm16 +Requires: lld +Requires: llvm Requires: spdlog # Currently wasmedge could only be built on specific arches ExclusiveArch: x86_64 aarch64 @@ -64,11 +64,11 @@ This package contains necessary header files for %{reponame} development. %build source /opt/rh/gcc-toolset-11/enable -%cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DWASMEDGE_BUILD_TESTS=OFF -DLLVM_DIR=/usr/lib64/llvm16/lib/cmake/llvm +%cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DWASMEDGE_BUILD_TESTS=OFF %cmake_build mkdir rt cd rt -%cmake -S .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DWASMEDGE_BUILD_TESTS=OFF -DWASMEDGE_BUILD_AOT_RUNTIME=OFF -DLLVM_DIR=/usr/lib64/llvm16/lib/cmake/llvm +%cmake -S .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DWASMEDGE_BUILD_TESTS=OFF -DWASMEDGE_BUILD_AOT_RUNTIME=OFF %cmake_build %install @@ -110,6 +110,8 @@ cd .. %{_libdir}/lib%{name}.so %changelog +* Mon Oct 2 2023 dm4 - 0.13.4 +- Release 0.13.4 * Fri Jul 21 2023 dm4 - 0.13.2 - Release 0.13.2 * Mon Jul 10 2023 dm4 - 0.13.1 From fd823d2ab6483e12f6347af8c73fc1711be1cffb Mon Sep 17 00:00:00 2001 From: dm4 Date: Tue, 14 Nov 2023 09:23:40 +0000 Subject: [PATCH 09/18] Update wasmedge-revert-fmt.patch Signed-off-by: dm4 --- wasmedge-revert-fmt.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wasmedge-revert-fmt.patch b/wasmedge-revert-fmt.patch index 3f80b6f..499272e 100644 --- a/wasmedge-revert-fmt.patch +++ b/wasmedge-revert-fmt.patch @@ -52,9 +52,9 @@ - : static_cast((getCode() & 0xF0U) >> 5); - } - constexpr ErrCode() noexcept : Inner({.Num = 0}) {} - constexpr ErrCode(const ErrCode &E) noexcept : Inner({.Num = E.Inner.Num}) {} -@@ -138,13 +132,3 @@ + constexpr ErrCode() noexcept : Inner(0) {} + constexpr ErrCode(const ErrCode &E) noexcept : Inner(E.Inner.Num) {} +@@ -140,13 +134,3 @@ (); } // namespace WasmEdge From cf25d43f24236860a179831c6fbaf91fd5850b9d Mon Sep 17 00:00:00 2001 From: dm4 Date: Thu, 6 Jun 2024 08:31:41 +0000 Subject: [PATCH 10/18] Use newer version of spdlog and apply patch to disable fmt installation for 0.14.0 Signed-off-by: dm4 --- wasmedge-disable-fmt-installation.patch | 12 + wasmedge-revert-fmt.patch | 1551 ----------------------- wasmedge.spec | 9 +- 3 files changed, 15 insertions(+), 1557 deletions(-) create mode 100644 wasmedge-disable-fmt-installation.patch delete mode 100644 wasmedge-revert-fmt.patch diff --git a/wasmedge-disable-fmt-installation.patch b/wasmedge-disable-fmt-installation.patch new file mode 100644 index 0000000..92f6919 --- /dev/null +++ b/wasmedge-disable-fmt-installation.patch @@ -0,0 +1,12 @@ +diff --git a/lib/common/CMakeLists.txt b/lib/common/CMakeLists.txt +index bf2bf37e..fcccfabc 100644 +--- a/lib/common/CMakeLists.txt ++++ b/lib/common/CMakeLists.txt +@@ -10,6 +10,7 @@ else() + GIT_TAG 10.2.1 + GIT_SHALLOW TRUE + ) ++ set(FMT_INSTALL OFF CACHE BOOL "Generate the install target." FORCE) + FetchContent_MakeAvailable(fmt) + wasmedge_setup_target(fmt) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/wasmedge-revert-fmt.patch b/wasmedge-revert-fmt.patch deleted file mode 100644 index 499272e..0000000 --- a/wasmedge-revert-fmt.patch +++ /dev/null @@ -1,1551 +0,0 @@ ---- b/include/common/enum_ast.hpp -+++ a/include/common/enum_ast.hpp -@@ -18,7 +18,6 @@ - #pragma once - - #include "dense_enum_map.h" --#include "log.h" - #include "spare_enum_map.h" - - #include -@@ -73,23 +72,3 @@ - (); - - } // namespace WasmEdge -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ASTNodeAttr &Attr, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::ASTNodeAttrStr[Attr], -- Ctx); -- } --}; -- --template <> --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::OpCode &Code, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::OpCodeStr[Code], Ctx); -- } --}; ---- b/include/common/enum_errcode.hpp -+++ a/include/common/enum_errcode.hpp -@@ -15,7 +15,6 @@ - #pragma once - - #include "dense_enum_map.h" --#include "log.h" - #include "spare_enum_map.h" - - #include -@@ -76,11 +75,6 @@ - ? ErrCode::Value::UserDefError - : static_cast(getCode()); - } -- constexpr WasmPhase getErrCodePhase() const noexcept { -- return getCategory() != ErrCategory::WASM -- ? WasmPhase::UserDefined -- : static_cast((getCode() & 0xF0U) >> 5); -- } - - constexpr ErrCode() noexcept : Inner(0) {} - constexpr ErrCode(const ErrCode &E) noexcept : Inner(E.Inner.Num) {} -@@ -140,13 +134,3 @@ - (); - - } // namespace WasmEdge -- --template <> --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::WasmPhase &Phase, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::WasmPhaseStr[Phase], -- Ctx); -- } --}; ---- b/include/common/enum_errinfo.hpp -+++ a/include/common/enum_errinfo.hpp -@@ -109,36 +109,3 @@ - - } // namespace ErrInfo - } // namespace WasmEdge -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::PtrType &Type, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format( -- WasmEdge::ErrInfo::PtrTypeStr[Type], Ctx); -- } --}; -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::MismatchCategory &Category, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format( -- WasmEdge::ErrInfo::MismatchCategoryStr[Category], Ctx); -- } --}; -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::IndexCategory &Category, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format( -- WasmEdge::ErrInfo::IndexCategoryStr[Category], Ctx); -- } --}; ---- b/include/common/enum_types.hpp -+++ a/include/common/enum_types.hpp -@@ -15,7 +15,6 @@ - #pragma once - - #include "dense_enum_map.h" --#include "log.h" - #include "spare_enum_map.h" - - #include -@@ -108,31 +107,3 @@ - (); - - } // namespace WasmEdge -- --template <> --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ValType &Type, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::ValTypeStr[Type], Ctx); -- } --}; -- --template <> --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ValMut &Mut, fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::ValMutStr[Mut], Ctx); -- } --}; -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ExternalType &Type, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::ExternalTypeStr[Type], -- Ctx); -- } --}; ---- b/include/common/errcode.h -+++ a/include/common/errcode.h -@@ -33,6 +33,20 @@ - - namespace WasmEdge { - -+static inline WasmPhase getErrCodePhase(const ErrCode &Code) { -+ return static_cast(Code.getCategory() == ErrCategory::WASM -+ ? ((Code.getCode() & 0xF0U) >> 5) -+ : 0x05U // WasmPhase::UserDefined -+ ); -+} -+ -+static inline std::ostream &operator<<(std::ostream &OS, const ErrCode &Code) { -+ OS << WasmPhaseStr[getErrCodePhase(Code)] -+ << " failed: " << ErrCodeStr[Code.getEnum()] -+ << ", Code: " << convertUIntToHexStr(Code.getCode(), 2); -+ return OS; -+} -+ - static inline constexpr bool likely(bool V) noexcept { - return __builtin_expect(V, true); - } -@@ -54,25 +68,7 @@ - - } // namespace WasmEdge - -+#if FMT_VERSION >= 90000 - template <> -+struct fmt::formatter : ostream_formatter {}; -+#endif --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrCode &Code, -- fmt::format_context &Ctx) const noexcept { -- using namespace std::literals; -- std::string Output = -- fmt::format("{} failed: {}, Code: 0x{:02x}"sv, Code.getErrCodePhase(), -- WasmEdge::ErrCodeStr[Code.getEnum()], Code.getCode()); -- return formatter::format(Output, Ctx); -- } --}; -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrCode::Value &Value, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::ErrCode(Value), Ctx); -- } --}; ---- b/include/common/errinfo.h -+++ a/include/common/errinfo.h -@@ -37,6 +37,8 @@ - InfoFile() = delete; - InfoFile(const std::filesystem::path &FName) noexcept : FileName(FName) {} - -+ friend std::ostream &operator<<(std::ostream &OS, const struct InfoFile &Rhs); -+ - std::filesystem::path FileName; - }; - -@@ -44,6 +46,9 @@ - InfoLoading() = delete; - InfoLoading(const uint64_t Off) noexcept : Offset(Off) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoLoading &Rhs); -+ - uint64_t Offset; - }; - -@@ -51,6 +56,8 @@ - InfoAST() = delete; - InfoAST(const ASTNodeAttr Attr) noexcept : NodeAttr(Attr) {} - -+ friend std::ostream &operator<<(std::ostream &OS, const struct InfoAST &Rhs); -+ - ASTNodeAttr NodeAttr; - }; - -@@ -60,6 +67,9 @@ - const uint32_t Lim) noexcept - : Instance(Inst), Number(Num), Limited(Lim) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoInstanceBound &Rhs); -+ - ExternalType Instance; - uint32_t Number, Limited; - }; -@@ -70,6 +80,9 @@ - const uint32_t Bound) noexcept - : Category(Cate), Index(Idx), Boundary(Bound) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoForbidIndex &Rhs); -+ - IndexCategory Category; - uint32_t Index, Boundary; - }; -@@ -78,6 +91,9 @@ - InfoExporting() = delete; - InfoExporting(std::string_view Ext) noexcept : ExtName(Ext) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoExporting &Rhs); -+ - std::string ExtName; - }; - -@@ -87,6 +103,9 @@ - const uint32_t Max = 0) noexcept - : LimHasMax(HasMax), LimMin(Min), LimMax(Max) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoLimit &Rhs); -+ - bool LimHasMax; - uint32_t LimMin, LimMax; - }; -@@ -95,6 +114,9 @@ - InfoRegistering() = delete; - InfoRegistering(std::string_view Mod) noexcept : ModName(Mod) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoRegistering &Rhs); -+ - std::string ModName; - }; - -@@ -104,6 +126,9 @@ - const ExternalType ExtT = ExternalType::Function) noexcept - : ModName(Mod), ExtName(Ext), ExtType(ExtT) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoLinking &Rhs); -+ - std::string ModName; - std::string ExtName; - ExternalType ExtType; -@@ -115,6 +140,9 @@ - : ModName(Mod), FuncName(Func) {} - InfoExecuting(std::string_view Func) noexcept : ModName(""), FuncName(Func) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoExecuting &Rhs); -+ - std::string ModName; - std::string FuncName; - }; -@@ -190,6 +218,9 @@ - : Category(MismatchCategory::Version), ExpVersion(ExpV), - GotVersion(GotV) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoMismatch &Rhs); -+ - /// Mismatched category - MismatchCategory Category; - -@@ -231,6 +262,9 @@ - : Code(Op), Offset(Off), Args(ArgsVec), ArgsTypes(ArgsTypesVec), - IsSigned(Signed) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoInstruction &Rhs); -+ - OpCode Code; - uint64_t Offset; - std::vector Args; -@@ -245,6 +279,9 @@ - const uint32_t Lim = std::numeric_limits::max()) noexcept - : Offset(Off), Size(Len), Limit(Lim) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoBoundary &Rhs); -+ - uint64_t Offset; - uint32_t Size; - uint32_t Limit; -@@ -254,104 +291,45 @@ - InfoProposal() = delete; - InfoProposal(Proposal P) noexcept : P(P) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoProposal &Rhs); - Proposal P; - }; - - } // namespace ErrInfo - } // namespace WasmEdge - -+#if FMT_VERSION >= 90000 - template <> -+struct fmt::formatter : ostream_formatter {}; --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoFile &Info, -- fmt::format_context &Ctx) const noexcept; --}; - template <> -+struct fmt::formatter : ostream_formatter {}; --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoLoading &Info, -- fmt::format_context &Ctx) const noexcept; --}; - template <> -+struct fmt::formatter : ostream_formatter {}; --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoAST &Info, -- fmt::format_context &Ctx) const noexcept; --}; - template <> - struct fmt::formatter -+ : ostream_formatter {}; -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoInstanceBound &Info, -- fmt::format_context &Ctx) const noexcept; --}; - template <> -+struct fmt::formatter : ostream_formatter { --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoForbidIndex &Info, -- fmt::format_context &Ctx) const noexcept; - }; - template <> -+struct fmt::formatter : ostream_formatter {}; --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoExporting &Info, -- fmt::format_context &Ctx) const noexcept; --}; - template <> -+struct fmt::formatter : ostream_formatter {}; --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoLimit &Info, -- fmt::format_context &Ctx) const noexcept; --}; - template <> -+struct fmt::formatter : ostream_formatter { --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoRegistering &Info, -- fmt::format_context &Ctx) const noexcept; - }; - template <> -+struct fmt::formatter : ostream_formatter {}; --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoLinking &Info, -- fmt::format_context &Ctx) const noexcept; --}; - template <> -+struct fmt::formatter : ostream_formatter {}; --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoExecuting &Info, -- fmt::format_context &Ctx) const noexcept; --}; - template <> -+struct fmt::formatter : ostream_formatter {}; --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoMismatch &Info, -- fmt::format_context &Ctx) const noexcept; --}; - template <> -+struct fmt::formatter : ostream_formatter { --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoInstruction &Info, -- fmt::format_context &Ctx) const noexcept; - }; - template <> -+struct fmt::formatter : ostream_formatter {}; --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoBoundary &Info, -- fmt::format_context &Ctx) const noexcept; --}; - template <> -+struct fmt::formatter : ostream_formatter {}; -+#endif --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoProposal &Info, -- fmt::format_context &Ctx) const noexcept; --}; ---- b/include/common/log.h -+++ a/include/common/log.h -@@ -13,8 +13,8 @@ - //===----------------------------------------------------------------------===// - #pragma once - --#include "common/filesystem.h" - #define SPDLOG_NO_EXCEPTIONS 1 -+#include "spdlog/fmt/ostr.h" - #include "spdlog/spdlog.h" - - namespace WasmEdge { -@@ -32,26 +32,3 @@ - - } // namespace Log - } // namespace WasmEdge -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator format(const std::filesystem::path &Path, -- fmt::format_context &Ctx) const { -- // mimic std::quoted -- constexpr const char Delimiter = '"'; -- constexpr const char Escape = '\\'; -- auto Quoted = fmt::memory_buffer(); -- auto Iter = std::back_inserter(Quoted); -- *Iter++ = Delimiter; -- for (const auto C : Path.u8string()) { -- if (C == Delimiter || C == Escape) { -- *Iter++ = Escape; -- } -- *Iter++ = C; -- } -- *Iter++ = Delimiter; -- return fmt::formatter::format( -- std::string_view(Quoted.data(), Quoted.size()), Ctx); -- } --}; ---- b/include/host/wasi/error.h -+++ a/include/host/wasi/error.h -@@ -4,9 +4,7 @@ - #pragma once - - #include "common/expected.h" --#include "common/log.h" - #include "wasi/api.hpp" --#include - - namespace WasmEdge { - namespace Host { -@@ -26,296 +24,3 @@ - } // namespace WASI - } // namespace Host - } // namespace WasmEdge -- --template <> --struct fmt::formatter<__wasi_errno_t> : fmt::formatter { -- fmt::format_context::iterator -- format(__wasi_errno_t ErrNo, fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- using namespace std::literals; -- auto Iter = std::back_inserter(Buffer); -- switch (ErrNo) { -- case __WASI_ERRNO_SUCCESS: -- fmt::format_to( -- Iter, "No error occurred. System call completed successfully."sv); -- break; -- case __WASI_ERRNO_2BIG: -- fmt::format_to(Iter, "Argument list too long."sv); -- break; -- case __WASI_ERRNO_ACCES: -- fmt::format_to(Iter, "Permission denied."sv); -- break; -- case __WASI_ERRNO_ADDRINUSE: -- fmt::format_to(Iter, "Address in use."sv); -- break; -- case __WASI_ERRNO_ADDRNOTAVAIL: -- fmt::format_to(Iter, "Address not available."sv); -- break; -- case __WASI_ERRNO_AFNOSUPPORT: -- fmt::format_to(Iter, "Address family not supported."sv); -- break; -- case __WASI_ERRNO_AGAIN: -- fmt::format_to(Iter, "Resource unavailable, or operation would block."sv); -- break; -- case __WASI_ERRNO_ALREADY: -- fmt::format_to(Iter, "Connection already in progress."sv); -- break; -- case __WASI_ERRNO_BADF: -- fmt::format_to(Iter, "Bad file descriptor."sv); -- break; -- case __WASI_ERRNO_BADMSG: -- fmt::format_to(Iter, "Bad message."sv); -- break; -- case __WASI_ERRNO_BUSY: -- fmt::format_to(Iter, "Device or resource busy."sv); -- break; -- case __WASI_ERRNO_CANCELED: -- fmt::format_to(Iter, "Operation canceled."sv); -- break; -- case __WASI_ERRNO_CHILD: -- fmt::format_to(Iter, "No child processes."sv); -- break; -- case __WASI_ERRNO_CONNABORTED: -- fmt::format_to(Iter, "Connection aborted."sv); -- break; -- case __WASI_ERRNO_CONNREFUSED: -- fmt::format_to(Iter, "Connection refused."sv); -- break; -- case __WASI_ERRNO_CONNRESET: -- fmt::format_to(Iter, "Connection reset."sv); -- break; -- case __WASI_ERRNO_DEADLK: -- fmt::format_to(Iter, "Resource deadlock would occur."sv); -- break; -- case __WASI_ERRNO_DESTADDRREQ: -- fmt::format_to(Iter, "Destination address required."sv); -- break; -- case __WASI_ERRNO_DOM: -- fmt::format_to(Iter, "Mathematics argument out of domain of function."sv); -- break; -- case __WASI_ERRNO_DQUOT: -- fmt::format_to(Iter, "Reserved."sv); -- break; -- case __WASI_ERRNO_EXIST: -- fmt::format_to(Iter, "File exists."sv); -- break; -- case __WASI_ERRNO_FAULT: -- fmt::format_to(Iter, "Bad address."sv); -- break; -- case __WASI_ERRNO_FBIG: -- fmt::format_to(Iter, "File too large."sv); -- break; -- case __WASI_ERRNO_HOSTUNREACH: -- fmt::format_to(Iter, "Host is unreachable."sv); -- break; -- case __WASI_ERRNO_IDRM: -- fmt::format_to(Iter, "Identifier removed."sv); -- break; -- case __WASI_ERRNO_ILSEQ: -- fmt::format_to(Iter, "Illegal byte sequence."sv); -- break; -- case __WASI_ERRNO_INPROGRESS: -- fmt::format_to(Iter, "Operation in progress."sv); -- break; -- case __WASI_ERRNO_INTR: -- fmt::format_to(Iter, "Interrupted function."sv); -- break; -- case __WASI_ERRNO_INVAL: -- fmt::format_to(Iter, "Invalid argument."sv); -- break; -- case __WASI_ERRNO_IO: -- fmt::format_to(Iter, "I/O error."sv); -- break; -- case __WASI_ERRNO_ISCONN: -- fmt::format_to(Iter, "Socket is connected."sv); -- break; -- case __WASI_ERRNO_ISDIR: -- fmt::format_to(Iter, "Is a directory."sv); -- break; -- case __WASI_ERRNO_LOOP: -- fmt::format_to(Iter, "Too many levels of symbolic links."sv); -- break; -- case __WASI_ERRNO_MFILE: -- fmt::format_to(Iter, "File descriptor value too large."sv); -- break; -- case __WASI_ERRNO_MLINK: -- fmt::format_to(Iter, "Too many links."sv); -- break; -- case __WASI_ERRNO_MSGSIZE: -- fmt::format_to(Iter, "Message too large."sv); -- break; -- case __WASI_ERRNO_MULTIHOP: -- fmt::format_to(Iter, "Reserved."sv); -- break; -- case __WASI_ERRNO_NAMETOOLONG: -- fmt::format_to(Iter, "Filename too long."sv); -- break; -- case __WASI_ERRNO_NETDOWN: -- fmt::format_to(Iter, "Network is down."sv); -- break; -- case __WASI_ERRNO_NETRESET: -- fmt::format_to(Iter, "Connection aborted by network."sv); -- break; -- case __WASI_ERRNO_NETUNREACH: -- fmt::format_to(Iter, "Network unreachable."sv); -- break; -- case __WASI_ERRNO_NFILE: -- fmt::format_to(Iter, "Too many files open in system."sv); -- break; -- case __WASI_ERRNO_NOBUFS: -- fmt::format_to(Iter, "No buffer space available."sv); -- break; -- case __WASI_ERRNO_NODEV: -- fmt::format_to(Iter, "No such device."sv); -- break; -- case __WASI_ERRNO_NOENT: -- fmt::format_to(Iter, "No such file or directory."sv); -- break; -- case __WASI_ERRNO_NOEXEC: -- fmt::format_to(Iter, "Executable file format error."sv); -- break; -- case __WASI_ERRNO_NOLCK: -- fmt::format_to(Iter, "No locks available."sv); -- break; -- case __WASI_ERRNO_NOLINK: -- fmt::format_to(Iter, "Reserved."sv); -- break; -- case __WASI_ERRNO_NOMEM: -- fmt::format_to(Iter, "Not enough space."sv); -- break; -- case __WASI_ERRNO_NOMSG: -- fmt::format_to(Iter, "No message of the desired type."sv); -- break; -- case __WASI_ERRNO_NOPROTOOPT: -- fmt::format_to(Iter, "Protocol not available."sv); -- break; -- case __WASI_ERRNO_NOSPC: -- fmt::format_to(Iter, "No space left on device."sv); -- break; -- case __WASI_ERRNO_NOSYS: -- fmt::format_to(Iter, "Function not supported."sv); -- break; -- case __WASI_ERRNO_NOTCONN: -- fmt::format_to(Iter, "The socket is not connected."sv); -- break; -- case __WASI_ERRNO_NOTDIR: -- fmt::format_to(Iter, -- "Not a directory or a symbolic link to a directory."sv); -- break; -- case __WASI_ERRNO_NOTEMPTY: -- fmt::format_to(Iter, "Directory not empty."sv); -- break; -- case __WASI_ERRNO_NOTRECOVERABLE: -- fmt::format_to(Iter, "State not recoverable."sv); -- break; -- case __WASI_ERRNO_NOTSOCK: -- fmt::format_to(Iter, "Not a socket."sv); -- break; -- case __WASI_ERRNO_NOTSUP: -- fmt::format_to(Iter, -- "Not supported, or operation not supported on socket."sv); -- break; -- case __WASI_ERRNO_NOTTY: -- fmt::format_to(Iter, "Inappropriate I/O control operation."sv); -- break; -- case __WASI_ERRNO_NXIO: -- fmt::format_to(Iter, "No such device or address."sv); -- break; -- case __WASI_ERRNO_OVERFLOW: -- fmt::format_to(Iter, "Value too large to be stored in data type."sv); -- break; -- case __WASI_ERRNO_OWNERDEAD: -- fmt::format_to(Iter, "Previous owner died."sv); -- break; -- case __WASI_ERRNO_PERM: -- fmt::format_to(Iter, "Operation not permitted."sv); -- break; -- case __WASI_ERRNO_PIPE: -- fmt::format_to(Iter, "Broken pipe."sv); -- break; -- case __WASI_ERRNO_PROTO: -- fmt::format_to(Iter, "Protocol error."sv); -- break; -- case __WASI_ERRNO_PROTONOSUPPORT: -- fmt::format_to(Iter, "Protocol not supported."sv); -- break; -- case __WASI_ERRNO_PROTOTYPE: -- fmt::format_to(Iter, "Protocol wrong type for socket."sv); -- break; -- case __WASI_ERRNO_RANGE: -- fmt::format_to(Iter, "Result too large."sv); -- break; -- case __WASI_ERRNO_ROFS: -- fmt::format_to(Iter, "Read-only file system."sv); -- break; -- case __WASI_ERRNO_SPIPE: -- fmt::format_to(Iter, "Invalid seek."sv); -- break; -- case __WASI_ERRNO_SRCH: -- fmt::format_to(Iter, "No such process."sv); -- break; -- case __WASI_ERRNO_STALE: -- fmt::format_to(Iter, "Reserved."sv); -- break; -- case __WASI_ERRNO_TIMEDOUT: -- fmt::format_to(Iter, "Connection timed out."sv); -- break; -- case __WASI_ERRNO_TXTBSY: -- fmt::format_to(Iter, "Text file busy."sv); -- break; -- case __WASI_ERRNO_XDEV: -- fmt::format_to(Iter, "Cross-device link."sv); -- break; -- case __WASI_ERRNO_NOTCAPABLE: -- fmt::format_to(Iter, "Extension: Capabilities insufficient."sv); -- break; -- case __WASI_ERRNO_AIADDRFAMILY: -- fmt::format_to(Iter, -- "The specified network host does not have any network " -- "addresses in the requested address family."sv); -- break; -- case __WASI_ERRNO_AIAGAIN: -- fmt::format_to(Iter, "Try again later."sv); -- break; -- case __WASI_ERRNO_AIBADFLAG: -- fmt::format_to(Iter, "Hints.ai_flags contains invalid flags"sv); -- break; -- case __WASI_ERRNO_AIFAIL: -- fmt::format_to( -- Iter, "The name server returned a permanent failure indication."sv); -- break; -- case __WASI_ERRNO_AIFAMILY: -- fmt::format_to(Iter, "The requested address family is not supported."sv); -- break; -- case __WASI_ERRNO_AIMEMORY: -- fmt::format_to(Iter, "Addrinfo out of memory."sv); -- break; -- case __WASI_ERRNO_AINODATA: -- fmt::format_to(Iter, "Network host exists, but does not have any network " -- "addresses defined."sv); -- break; -- case __WASI_ERRNO_AINONAME: -- fmt::format_to( -- Iter, -- "Node or service is not known; or both node and service are NULL."sv); -- break; -- case __WASI_ERRNO_AISERVICE: -- fmt::format_to( -- Iter, "Service is not available for the requested socket type."sv); -- break; -- case __WASI_ERRNO_AISOCKTYPE: -- fmt::format_to(Iter, "The requested socket type is not supported."sv); -- break; -- case __WASI_ERRNO_AISYSTEM: -- fmt::format_to(Iter, "Other system error."sv); -- break; -- default: -- fmt::format_to( -- Iter, "Unknown error code {}"sv, -- static_cast>(ErrNo)); -- break; -- } -- return fmt::formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -- } --}; ---- b/lib/common/CMakeLists.txt -+++ a/lib/common/CMakeLists.txt -@@ -7,7 +7,7 @@ - FetchContent_Declare( - spdlog - GIT_REPOSITORY https://github.com/gabime/spdlog.git -+ GIT_TAG v1.9.0 -- GIT_TAG v1.11.0 - GIT_SHALLOW TRUE - ) - set(SPDLOG_BUILD_SHARED OFF CACHE BOOL "Build shared library" FORCE) ---- b/lib/common/errinfo.cpp -+++ a/lib/common/errinfo.cpp -@@ -2,316 +2,270 @@ - // SPDX-FileCopyrightText: 2019-2022 Second State INC - - #include "common/errinfo.h" -+ - #include "common/errcode.h" - #include "common/hexstr.h" - -+namespace WasmEdge { -+namespace ErrInfo { -+std::ostream &operator<<(std::ostream &OS, const struct InfoFile &Rhs) { -+ OS << " File name: " << Rhs.FileName; -+ return OS; --using namespace std::literals; -- --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoFile &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), " File name: {}"sv, -- Info.FileName); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoLoading &Rhs) { -+ OS << " Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); -+ return OS; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoLoading &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), " Bytecode offset: 0x{:08x}"sv, -- Info.Offset); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoAST &Rhs) { -+ OS << " At AST node: " << ASTNodeAttrStr[Rhs.NodeAttr]; -+ return OS; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoAST &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), " At AST node: {}"sv, -- Info.NodeAttr); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, -+ const struct InfoInstanceBound &Rhs) { -+ OS << " Instance " << ExternalTypeStr[Rhs.Instance] -+ << " has limited number " << Rhs.Limited << " , Got: " << Rhs.Number; -+ return OS; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoInstanceBound &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), -- " Instance {} has limited number {} , Got: {}"sv, -- Info.Instance, Info.Limited, Info.Number); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoForbidIndex &Rhs) { -+ OS << " When checking " << IndexCategoryStr[Rhs.Category] -+ << " index: " << Rhs.Index << " , Out of boundary: "; -+ if (Rhs.Boundary > 0) { -+ OS << (Rhs.Boundary - 1); --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoForbidIndex &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- auto Iter = -- fmt::format_to(std::back_inserter(Buffer), -- " When checking {} index: {} , Out of boundary: "sv, -- Info.Category, Info.Index); -- if (Info.Boundary > 0) { -- fmt::format_to(Iter, "{}"sv, Info.Boundary - 1); - } else { -+ OS << "empty"; -- fmt::format_to(Iter, "empty"sv); - } -+ return OS; -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoExporting &Rhs) { -+ OS << " Duplicated exporting name: \"" << Rhs.ExtName << "\""; -+ return OS; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoExporting &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), -- " Duplicated exporting name: \"{}\""sv, Info.ExtName); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoLimit &Rhs) { -+ OS << " In Limit type: { min: " << Rhs.LimMin; -+ if (Rhs.LimHasMax) { -+ OS << " , max: " << Rhs.LimMax; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoLimit &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- auto Iter = fmt::format_to(std::back_inserter(Buffer), -- " In Limit type: {{ min: {}"sv, Info.LimMin); -- if (Info.LimHasMax) { -- Iter = fmt::format_to(Iter, " , max: {}"sv, Info.LimMax); - } -+ OS << " }"; -+ return OS; -- fmt::format_to(Iter, " }}"sv); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoRegistering &Rhs) { -+ OS << " Module name: \"" << Rhs.ModName << "\""; -+ return OS; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoRegistering &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), " Module name: \"{}\""sv, -- Info.ModName); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoLinking &Rhs) { -+ OS << " When linking module: \"" << Rhs.ModName << "\" , " -+ << ExternalTypeStr[Rhs.ExtType] << " name: \"" << Rhs.ExtName << "\""; -+ return OS; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoLinking &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), -- " When linking module: \"{}\" , {} name: \"{}\""sv, -- Info.ModName, Info.ExtType, Info.ExtName); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoExecuting &Rhs) { -+ OS << " When executing "; -+ if (Rhs.ModName != "") { -+ OS << "module name: \"" << Rhs.ModName << "\" , "; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoExecuting &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- auto Iter = -- fmt::format_to(std::back_inserter(Buffer), " When executing "sv); -- if (!Info.ModName.empty()) { -- Iter = fmt::format_to(Iter, "module name: \"{}\" , "sv, Info.ModName); - } -+ OS << "function name: \"" << Rhs.FuncName << "\""; -+ return OS; -- fmt::format_to(Iter, "function name: \"{}\""sv, Info.FuncName); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoMismatch &Rhs) { -+ OS << " Mismatched " << MismatchCategoryStr[Rhs.Category] << ". "; -+ switch (Rhs.Category) { -+ case MismatchCategory::Alignment: -+ OS << "Expected: need to <= " << static_cast(Rhs.ExpAlignment) -+ << " , Got: " << (1UL << Rhs.GotAlignment); --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoMismatch &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- auto Iter = fmt::format_to(std::back_inserter(Buffer), -- " Mismatched {}. "sv, Info.Category); -- auto FormatLimit = [](auto Out, bool LimHasMax, uint32_t LimMin, -- uint32_t LimMax) { -- Out = fmt::format_to(Out, "Limit{{{}"sv, LimMin); -- if (LimHasMax) { -- Out = fmt::format_to(Out, " , {}"sv, LimMax); -- } -- Out = fmt::format_to(Out, "}}"sv); -- return Out; -- }; -- switch (Info.Category) { -- case WasmEdge::ErrInfo::MismatchCategory::Alignment: -- fmt::format_to(Iter, "Expected: need to <= {} , Got: {}"sv, -- static_cast(Info.ExpAlignment), -- 1UL << Info.GotAlignment); - break; -+ case MismatchCategory::ValueType: -+ OS << "Expected: " << ValTypeStr[Rhs.ExpValType] -+ << " , Got: " << ValTypeStr[Rhs.GotValType]; -- case WasmEdge::ErrInfo::MismatchCategory::ValueType: -- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpValType, -- Info.GotValType); - break; -+ case MismatchCategory::ValueTypes: -+ OS << "Expected: types{"; -+ for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { -+ OS << ValTypeStr[Rhs.ExpParams[I]]; -+ if (I < Rhs.ExpParams.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "} , Got: types{"; -+ for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { -+ OS << ValTypeStr[Rhs.GotParams[I]]; -+ if (I < Rhs.GotParams.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "}"; -- case WasmEdge::ErrInfo::MismatchCategory::ValueTypes: -- fmt::format_to(Iter, "Expected: types{{{}}} , Got: types{{{}}}"sv, -- fmt::join(Info.ExpParams, " , "sv), -- fmt::join(Info.GotParams, " , "sv)); - break; -+ case MismatchCategory::Mutation: -+ OS << "Expected: " << ValMutStr[Rhs.ExpValMut] -+ << " , Got: " << ValMutStr[Rhs.GotValMut]; -- case WasmEdge::ErrInfo::MismatchCategory::Mutation: -- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpValMut, -- Info.GotValMut); - break; -+ case MismatchCategory::ExternalType: -+ OS << "Expected: " << ExternalTypeStr[Rhs.ExpExtType] -+ << " , Got: " << ExternalTypeStr[Rhs.GotExtType]; -- case WasmEdge::ErrInfo::MismatchCategory::ExternalType: -- fmt::format_to(Iter, "Expected: {} , Got: {}", Info.ExpExtType, -- Info.GotExtType); - break; -+ case MismatchCategory::FunctionType: -+ OS << "Expected: FuncType {params{"; -+ for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { -+ OS << ValTypeStr[Rhs.ExpParams[I]]; -+ if (I < Rhs.ExpParams.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "} returns{"; -+ for (uint32_t I = 0; I < Rhs.ExpReturns.size(); ++I) { -+ OS << ValTypeStr[Rhs.ExpReturns[I]]; -+ if (I < Rhs.ExpReturns.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "}} , Got: FuncType {params{"; -+ for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { -+ OS << ValTypeStr[Rhs.GotParams[I]]; -+ if (I < Rhs.GotParams.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "} returns{"; -+ for (uint32_t I = 0; I < Rhs.GotReturns.size(); ++I) { -+ OS << ValTypeStr[Rhs.GotReturns[I]]; -+ if (I < Rhs.GotReturns.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "}}"; -- case WasmEdge::ErrInfo::MismatchCategory::FunctionType: -- fmt::format_to(Iter, -- "Expected: FuncType {{params{{{}}} returns{{{}}}}} , " -- "Got: FuncType {{params{{{}}} returns{{{}}}}}"sv, -- fmt::join(Info.ExpParams, " , "sv), -- fmt::join(Info.ExpReturns, " , "sv), -- fmt::join(Info.GotParams, " , "sv), -- fmt::join(Info.GotReturns, " , "sv)); - break; -+ case MismatchCategory::Table: -+ OS << "Expected: TableType {RefType{" -+ << ValTypeStr[static_cast(Rhs.ExpRefType)] << "} Limit{" -+ << Rhs.ExpLimMin; -+ if (Rhs.ExpLimHasMax) { -+ OS << " , " << Rhs.ExpLimMax; -+ } -+ OS << "}} , Got: TableType {RefType{" -+ << ValTypeStr[static_cast(Rhs.GotRefType)] << "} Limit{" -+ << Rhs.GotLimMin; -+ if (Rhs.GotLimHasMax) { -+ OS << " , " << Rhs.GotLimMax; -+ } -+ OS << "}}"; -- case WasmEdge::ErrInfo::MismatchCategory::Table: -- Iter = fmt::format_to(Iter, "Expected: TableType {{RefType{{{}}} "sv, -- static_cast(Info.ExpRefType)); -- Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); -- Iter = fmt::format_to(Iter, "}} , Got: TableType {{RefType{{{}}} "sv, -- static_cast(Info.GotRefType)); -- Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); -- fmt::format_to(Iter, "}}"sv); - break; -+ case MismatchCategory::Memory: -+ OS << "Expected: MemoryType {Limit{" << Rhs.ExpLimMin; -+ if (Rhs.ExpLimHasMax) { -+ OS << " , " << Rhs.ExpLimMax; -+ } -+ OS << "}} , Got: MemoryType {Limit{" << Rhs.GotLimMin; -+ if (Rhs.GotLimHasMax) { -+ OS << " , " << Rhs.GotLimMax; -+ } -+ OS << "}}"; -- case WasmEdge::ErrInfo::MismatchCategory::Memory: -- Iter = fmt::format_to(Iter, "Expected: MemoryType {{"sv); -- Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); -- Iter = fmt::format_to(Iter, "}} , Got: MemoryType {{"sv); -- Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); -- fmt::format_to(Iter, "}}"sv); - break; -+ case MismatchCategory::Global: -+ OS << "Expected: GlobalType {Mutation{" << ValMutStr[Rhs.ExpValMut] -+ << "} ValType{" << ValTypeStr[Rhs.ExpValType] -+ << "}} , Got: GlobalType {Mutation{" << ValMutStr[Rhs.GotValMut] -+ << "} ValType{" << ValTypeStr[Rhs.GotValType] << "}}"; -- case WasmEdge::ErrInfo::MismatchCategory::Global: -- fmt::format_to(Iter, -- "Expected: GlobalType {{Mutation{{{}}} ValType{{{}}}}} , " -- "Got: GlobalType {{Mutation{{{}}} ValType{{{}}}}}"sv, -- Info.ExpValMut, Info.ExpValType, Info.GotValMut, -- Info.GotValType); - break; -+ case MismatchCategory::Version: -+ OS << "Expected: " << Rhs.ExpVersion << " , Got: " << Rhs.GotVersion; -- case WasmEdge::ErrInfo::MismatchCategory::Version: -- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpVersion, -- Info.GotVersion); - break; - default: - break; - } -+ return OS; -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoInstruction &Rhs) { -+ uint16_t Payload = static_cast(Rhs.Code); -+ OS << " In instruction: " << OpCodeStr[Rhs.Code] << " ("; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoInstruction &Info, -- fmt::format_context &Ctx) const noexcept { -- uint16_t Payload = static_cast(Info.Code); -- fmt::memory_buffer Buffer; -- auto Iter = fmt::format_to(std::back_inserter(Buffer), -- " In instruction: {} ("sv, Info.Code); - if ((Payload >> 8) >= static_cast(0xFCU)) { -+ OS << convertUIntToHexStr(Payload >> 8, 2) << " "; -- Iter = fmt::format_to(Iter, "0x{:02x} "sv, Payload >> 8); - } -+ OS << convertUIntToHexStr(Payload & 0xFFU, 2) -+ << ") , Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); -+ if (Rhs.Args.size() > 0) { -+ OS << " , Args: ["; -+ for (uint32_t I = 0; I < Rhs.Args.size(); ++I) { -+ switch (Rhs.ArgsTypes[I]) { -+ case ValType::I32: -+ if (Rhs.IsSigned) { -+ OS << Rhs.Args[I].get(); -- Iter = fmt::format_to(Iter, "0x{:02x}) , Bytecode offset: 0x{:08x}"sv, -- Payload & 0xFFU, Info.Offset); -- if (!Info.Args.empty()) { -- Iter = fmt::format_to(Iter, " , Args: ["sv); -- for (uint32_t I = 0; I < Info.Args.size(); ++I) { -- switch (Info.ArgsTypes[I]) { -- case WasmEdge::ValType::I32: -- if (Info.IsSigned) { -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); - } else { -+ OS << Rhs.Args[I].get(); -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); - } - break; -+ case ValType::I64: -+ if (Rhs.IsSigned) { -+ OS << Rhs.Args[I].get(); -- case WasmEdge::ValType::I64: -- if (Info.IsSigned) { -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); - } else { -+ OS << Rhs.Args[I].get(); -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); - } - break; -+ case ValType::F32: -+ OS << Rhs.Args[I].get(); -- case WasmEdge::ValType::F32: -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); - break; -+ case ValType::F64: -+ OS << Rhs.Args[I].get(); -- case WasmEdge::ValType::F64: -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); - break; -+ case ValType::V128: { -+ const auto Value = Rhs.Args[I].get(); -+ OS << std::hex << Value[0] << Value[1]; -- case WasmEdge::ValType::V128: { -- const auto Value = Info.Args[I].get(); -- Iter = fmt::format_to(Iter, "0x{:08x}{:08x}"sv, Value[1], Value[0]); - break; - } -+ case ValType::FuncRef: -+ OS << ValTypeStr[Rhs.ArgsTypes[I]]; -+ if (isNullRef(Rhs.Args[I])) { -+ OS << ":null"; -- case WasmEdge::ValType::FuncRef: -- case WasmEdge::ValType::ExternRef: -- Iter = fmt::format_to(Iter, "{}"sv, Info.ArgsTypes[I]); -- if (isNullRef(Info.Args[I])) { -- Iter = fmt::format_to(Iter, ":null"sv); - } else { -+ OS << ":" << &Rhs.Args[I].get(); -+ } -+ break; -+ case ValType::ExternRef: -+ OS << ValTypeStr[Rhs.ArgsTypes[I]]; -+ if (isNullRef(Rhs.Args[I])) { -+ OS << ":null"; -+ } else { -+ OS << ":" << &Rhs.Args[I].get(); -- Iter = -- fmt::format_to(Iter, ":0x{:08x}"sv, Info.Args[I].get()); - } - break; - default: - break; - } -+ if (I < Rhs.Args.size() - 1) { -+ OS << " , "; -- if (I < Info.Args.size() - 1) { -- Iter = fmt::format_to(Iter, " , "sv); - } - } -+ OS << "]"; -- Iter = fmt::format_to(Iter, "]"sv); - } -+ return OS; -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoBoundary &Rhs) { -+ OS << " Accessing offset from: " << convertUIntToHexStr(Rhs.Offset) -+ << " to: " -+ << convertUIntToHexStr(Rhs.Offset + Rhs.Size - (Rhs.Size > 0 ? 1 : 0)) -+ << " , Out of boundary: " << convertUIntToHexStr(Rhs.Limit); -+ return OS; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoBoundary &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), -- " Accessing offset from: 0x{:08x} to: 0x{:08x} , Out of " -- "boundary: 0x{:08x}"sv, -- Info.Offset, -- Info.Offset + (Info.Size > 0U ? Info.Size - 1U : 0U), -- Info.Limit); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } - -+std::ostream &operator<<(std::ostream &OS, const struct InfoProposal &Rhs) { -+ if (auto Iter = ProposalStr.find(Rhs.P); Iter != ProposalStr.end()) { -+ OS << " This instruction or syntax requires enabling proposal " -+ << Iter->second; --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoProposal &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- if (auto Iter = WasmEdge::ProposalStr.find(Info.P); -- Iter != WasmEdge::ProposalStr.end()) { -- fmt::format_to( -- std::back_inserter(Buffer), -- " This instruction or syntax requires enabling proposal {}"sv, -- Iter->second); - } else { -+ OS << " Unknown proposal, Code " -+ << convertUIntToHexStr(static_cast(Rhs.P)); -- fmt::format_to(std::back_inserter(Buffer), -- " Unknown proposal, Code 0x{:08x}"sv, -- static_cast(Info.P)); - } -+ return OS; -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); - } -+ -+} // namespace ErrInfo -+} // namespace WasmEdge ---- b/test/errinfo/errinfoTest.cpp -+++ a/test/errinfo/errinfoTest.cpp -@@ -5,124 +5,122 @@ - - #include - #include -+#include --#include - #include - --using namespace std::literals; -- - namespace { - - TEST(ErrInfoTest, Info__File) { - WasmEdge::ErrInfo::InfoFile Info1("file.txt"); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Loading) { - WasmEdge::ErrInfo::InfoLoading Info1(30); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__AST) { - WasmEdge::ErrInfo::InfoAST Info1(WasmEdge::ASTNodeAttr::Module); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__InstanceBound) { - WasmEdge::ErrInfo::InfoInstanceBound Info1(WasmEdge::ExternalType::Memory, 2, - 1); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__ForbidIndex) { - WasmEdge::ErrInfo::InfoForbidIndex Info1( - WasmEdge::ErrInfo::IndexCategory::FunctionType, 2, 1); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - WasmEdge::ErrInfo::InfoForbidIndex Info2( - WasmEdge::ErrInfo::IndexCategory::Memory, 2, 0); -+ std::cout << Info2 << std::endl; -- fmt::print("{}\n"sv, Info2); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Exporting) { - WasmEdge::ErrInfo::InfoExporting Info1("export"); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Limit) { - WasmEdge::ErrInfo::InfoLimit Info1(true, 10, 20); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - WasmEdge::ErrInfo::InfoLimit Info2(false, 30); -+ std::cout << Info2 << std::endl; -- fmt::print("{}\n"sv, Info2); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Registering) { - WasmEdge::ErrInfo::InfoRegistering Info1("host_func"); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Linking) { - WasmEdge::ErrInfo::InfoLinking Info1("module", "func"); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Executing) { - WasmEdge::ErrInfo::InfoExecuting Info1("", "func"); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - WasmEdge::ErrInfo::InfoExecuting Info2("module", "func"); -+ std::cout << Info2 << std::endl; -- fmt::print("{}\n"sv, Info2); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Mismatch) { - WasmEdge::ErrInfo::InfoMismatch Info1(static_cast(16), 8888); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - WasmEdge::ErrInfo::InfoMismatch Info2(WasmEdge::ValType::ExternRef, - WasmEdge::ValType::FuncRef); -+ std::cout << Info2 << std::endl; -- fmt::print("{}\n"sv, Info2); - WasmEdge::ErrInfo::InfoMismatch Info3( - {WasmEdge::ValType::I32, WasmEdge::ValType::FuncRef}, - {WasmEdge::ValType::F64, WasmEdge::ValType::ExternRef, - WasmEdge::ValType::V128}); -+ std::cout << Info3 << std::endl; -- fmt::print("{}\n"sv, Info3); - WasmEdge::ErrInfo::InfoMismatch Info4(WasmEdge::ValMut::Const, - WasmEdge::ValMut::Var); -+ std::cout << Info4 << std::endl; -- fmt::print("{}\n"sv, Info4); - WasmEdge::ErrInfo::InfoMismatch Info5(WasmEdge::ExternalType::Function, - WasmEdge::ExternalType::Global); -+ std::cout << Info5 << std::endl; -- fmt::print("{}\n"sv, Info5); - WasmEdge::ErrInfo::InfoMismatch Info6( - {WasmEdge::ValType::I32, WasmEdge::ValType::FuncRef}, - {WasmEdge::ValType::I64, WasmEdge::ValType::F64}, - {WasmEdge::ValType::F64, WasmEdge::ValType::ExternRef, - WasmEdge::ValType::V128}, - {WasmEdge::ValType::V128}); -+ std::cout << Info6 << std::endl; -- fmt::print("{}\n"sv, Info6); - WasmEdge::ErrInfo::InfoMismatch Info7(WasmEdge::RefType::ExternRef, true, 10, - 20, WasmEdge::RefType::FuncRef, true, - 20, 50); -+ std::cout << Info7 << std::endl; -- fmt::print("{}\n"sv, Info7); - WasmEdge::ErrInfo::InfoMismatch Info8(WasmEdge::RefType::ExternRef, false, 10, - 10, WasmEdge::RefType::FuncRef, false, - 20, 20); -+ std::cout << Info8 << std::endl; -- fmt::print("{}\n"sv, Info8); - WasmEdge::ErrInfo::InfoMismatch Info9(true, 10, 20, true, 20, 50); -+ std::cout << Info9 << std::endl; -- fmt::print("{}\n"sv, Info9); - WasmEdge::ErrInfo::InfoMismatch Info10(false, 10, 10, false, 20, 20); -+ std::cout << Info10 << std::endl; -- fmt::print("{}\n"sv, Info10); - WasmEdge::ErrInfo::InfoMismatch Info11( - WasmEdge::ValType::I32, WasmEdge::ValMut::Var, WasmEdge::ValType::I64, - WasmEdge::ValMut::Const); -+ std::cout << Info11 << std::endl; -- fmt::print("{}\n"sv, Info11); - WasmEdge::ErrInfo::InfoMismatch Info12(12345678U, 98765432U); -+ std::cout << Info12 << std::endl; -- fmt::print("{}\n"sv, Info12); - - EXPECT_TRUE(true); - } -@@ -136,54 +134,54 @@ - WasmEdge::ErrInfo::InfoInstruction Info1( - WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::I32, WasmEdge::ValType::I32, WasmEdge::ValType::I32}); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - WasmEdge::ErrInfo::InfoInstruction Info2( - WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::I32, WasmEdge::ValType::I32, WasmEdge::ValType::I32}); -+ std::cout << Info2 << std::endl; -- fmt::print("{}\n"sv, Info2); - WasmEdge::ErrInfo::InfoInstruction Info3( - WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::I64, WasmEdge::ValType::I64, WasmEdge::ValType::I64}); -+ std::cout << Info3 << std::endl; -- fmt::print("{}\n"sv, Info3); - WasmEdge::ErrInfo::InfoInstruction Info4( - WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::F32, WasmEdge::ValType::F32, WasmEdge::ValType::F32}); -+ std::cout << Info4 << std::endl; -- fmt::print("{}\n"sv, Info4); - WasmEdge::ErrInfo::InfoInstruction Info5( - WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::F64, WasmEdge::ValType::F64, WasmEdge::ValType::F64}); -+ std::cout << Info5 << std::endl; -- fmt::print("{}\n"sv, Info5); - WasmEdge::ErrInfo::InfoInstruction Info6(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::V128, - WasmEdge::ValType::V128, - WasmEdge::ValType::V128}); -+ std::cout << Info6 << std::endl; -- fmt::print("{}\n"sv, Info6); - WasmEdge::ErrInfo::InfoInstruction Info7(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::FuncRef, - WasmEdge::ValType::FuncRef, - WasmEdge::ValType::FuncRef}); -+ std::cout << Info7 << std::endl; -- fmt::print("{}\n"sv, Info7); - WasmEdge::ErrInfo::InfoInstruction Info8(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::ExternRef, - WasmEdge::ValType::ExternRef, - WasmEdge::ValType::ExternRef}); -+ std::cout << Info8 << std::endl; -- fmt::print("{}\n"sv, Info8); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Boundary) { - WasmEdge::ErrInfo::InfoBoundary Info1(3, 5, 2); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - WasmEdge::ErrInfo::InfoBoundary Info2(3, 0, 2); -+ std::cout << Info2 << std::endl; -- fmt::print("{}\n"sv, Info2); - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Proposal) { - WasmEdge::ErrInfo::InfoProposal Info1(WasmEdge::Proposal::SIMD); -+ std::cout << Info1 << std::endl; -- fmt::print("{}\n"sv, Info1); - WasmEdge::ErrInfo::InfoProposal Info2(static_cast(250U)); -+ std::cout << Info2 << std::endl; -- fmt::print("{}\n"sv, Info2); - EXPECT_TRUE(true); - } - diff --git a/wasmedge.spec b/wasmedge.spec index d4b62b9..b2a09fc 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -12,8 +12,8 @@ Summary: High performance WebAssembly Virtual Machine License: ASL 2.0 and CC0 URL: https://github.com/%{reponame}/%{reponame} Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz -# Revert https://github.com/WasmEdge/WasmEdge/pull/2511 for old fmt version -Patch0: wasmedge-revert-fmt.patch +# Apply the patch to disable installation for fmt https://github.com/WasmEdge/WasmEdge/pull/3430 +Patch0: wasmedge-disable-fmt-installation.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gcc-toolset-11-toolchain @@ -21,10 +21,8 @@ BuildRequires: git BuildRequires: lld-devel BuildRequires: llvm-devel BuildRequires: ninja-build -BuildRequires: spdlog-devel Requires: lld Requires: llvm -Requires: spdlog # Currently wasmedge could only be built on specific arches ExclusiveArch: x86_64 aarch64 Provides: %{reponame} = %{version}-%{release} @@ -38,7 +36,6 @@ High performance WebAssembly Virtual Machine %package rt Summary: %{reponame} Runtime -Requires: spdlog Provides: %{reponame}-rt = %{version}-%{release} Provides: bundled(blake3) = 1.3.3 Provides: bundled(wasi-cpp-header) = 0.0.1 @@ -109,7 +106,7 @@ cd .. %{_libdir}/lib%{name}.so %changelog -* Thu May 30 2024 dm4 - 0.14.0 +* Thu Jun 6 2024 dm4 - 0.14.0 - Release 0.14.0 * Mon Oct 2 2023 dm4 - 0.13.4 - Release 0.13.4 From c03b54af3ca267e510a44f859d33893e1bcf50fe Mon Sep 17 00:00:00 2001 From: dm4 Date: Fri, 7 Jun 2024 05:05:13 +0000 Subject: [PATCH 11/18] Revert "Use newer version of spdlog and apply patch to disable fmt installation for 0.14.0" This reverts commit cf25d43f24236860a179831c6fbaf91fd5850b9d. --- wasmedge-disable-fmt-installation.patch | 12 - wasmedge-revert-fmt.patch | 1551 +++++++++++++++++++++++ wasmedge.spec | 9 +- 3 files changed, 1557 insertions(+), 15 deletions(-) delete mode 100644 wasmedge-disable-fmt-installation.patch create mode 100644 wasmedge-revert-fmt.patch diff --git a/wasmedge-disable-fmt-installation.patch b/wasmedge-disable-fmt-installation.patch deleted file mode 100644 index 92f6919..0000000 --- a/wasmedge-disable-fmt-installation.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/lib/common/CMakeLists.txt b/lib/common/CMakeLists.txt -index bf2bf37e..fcccfabc 100644 ---- a/lib/common/CMakeLists.txt -+++ b/lib/common/CMakeLists.txt -@@ -10,6 +10,7 @@ else() - GIT_TAG 10.2.1 - GIT_SHALLOW TRUE - ) -+ set(FMT_INSTALL OFF CACHE BOOL "Generate the install target." FORCE) - FetchContent_MakeAvailable(fmt) - wasmedge_setup_target(fmt) - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/wasmedge-revert-fmt.patch b/wasmedge-revert-fmt.patch new file mode 100644 index 0000000..499272e --- /dev/null +++ b/wasmedge-revert-fmt.patch @@ -0,0 +1,1551 @@ +--- b/include/common/enum_ast.hpp ++++ a/include/common/enum_ast.hpp +@@ -18,7 +18,6 @@ + #pragma once + + #include "dense_enum_map.h" +-#include "log.h" + #include "spare_enum_map.h" + + #include +@@ -73,23 +72,3 @@ + (); + + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ASTNodeAttr &Attr, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::ASTNodeAttrStr[Attr], +- Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::OpCode &Code, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::OpCodeStr[Code], Ctx); +- } +-}; +--- b/include/common/enum_errcode.hpp ++++ a/include/common/enum_errcode.hpp +@@ -15,7 +15,6 @@ + #pragma once + + #include "dense_enum_map.h" +-#include "log.h" + #include "spare_enum_map.h" + + #include +@@ -76,11 +75,6 @@ + ? ErrCode::Value::UserDefError + : static_cast(getCode()); + } +- constexpr WasmPhase getErrCodePhase() const noexcept { +- return getCategory() != ErrCategory::WASM +- ? WasmPhase::UserDefined +- : static_cast((getCode() & 0xF0U) >> 5); +- } + + constexpr ErrCode() noexcept : Inner(0) {} + constexpr ErrCode(const ErrCode &E) noexcept : Inner(E.Inner.Num) {} +@@ -140,13 +134,3 @@ + (); + + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::WasmPhase &Phase, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::WasmPhaseStr[Phase], +- Ctx); +- } +-}; +--- b/include/common/enum_errinfo.hpp ++++ a/include/common/enum_errinfo.hpp +@@ -109,36 +109,3 @@ + + } // namespace ErrInfo + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::PtrType &Type, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format( +- WasmEdge::ErrInfo::PtrTypeStr[Type], Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::MismatchCategory &Category, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format( +- WasmEdge::ErrInfo::MismatchCategoryStr[Category], Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::IndexCategory &Category, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format( +- WasmEdge::ErrInfo::IndexCategoryStr[Category], Ctx); +- } +-}; +--- b/include/common/enum_types.hpp ++++ a/include/common/enum_types.hpp +@@ -15,7 +15,6 @@ + #pragma once + + #include "dense_enum_map.h" +-#include "log.h" + #include "spare_enum_map.h" + + #include +@@ -108,31 +107,3 @@ + (); + + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ValType &Type, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::ValTypeStr[Type], Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ValMut &Mut, fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::ValMutStr[Mut], Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ExternalType &Type, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::ExternalTypeStr[Type], +- Ctx); +- } +-}; +--- b/include/common/errcode.h ++++ a/include/common/errcode.h +@@ -33,6 +33,20 @@ + + namespace WasmEdge { + ++static inline WasmPhase getErrCodePhase(const ErrCode &Code) { ++ return static_cast(Code.getCategory() == ErrCategory::WASM ++ ? ((Code.getCode() & 0xF0U) >> 5) ++ : 0x05U // WasmPhase::UserDefined ++ ); ++} ++ ++static inline std::ostream &operator<<(std::ostream &OS, const ErrCode &Code) { ++ OS << WasmPhaseStr[getErrCodePhase(Code)] ++ << " failed: " << ErrCodeStr[Code.getEnum()] ++ << ", Code: " << convertUIntToHexStr(Code.getCode(), 2); ++ return OS; ++} ++ + static inline constexpr bool likely(bool V) noexcept { + return __builtin_expect(V, true); + } +@@ -54,25 +68,7 @@ + + } // namespace WasmEdge + ++#if FMT_VERSION >= 90000 + template <> ++struct fmt::formatter : ostream_formatter {}; ++#endif +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrCode &Code, +- fmt::format_context &Ctx) const noexcept { +- using namespace std::literals; +- std::string Output = +- fmt::format("{} failed: {}, Code: 0x{:02x}"sv, Code.getErrCodePhase(), +- WasmEdge::ErrCodeStr[Code.getEnum()], Code.getCode()); +- return formatter::format(Output, Ctx); +- } +-}; +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrCode::Value &Value, +- fmt::format_context &Ctx) const noexcept { +- return formatter::format(WasmEdge::ErrCode(Value), Ctx); +- } +-}; +--- b/include/common/errinfo.h ++++ a/include/common/errinfo.h +@@ -37,6 +37,8 @@ + InfoFile() = delete; + InfoFile(const std::filesystem::path &FName) noexcept : FileName(FName) {} + ++ friend std::ostream &operator<<(std::ostream &OS, const struct InfoFile &Rhs); ++ + std::filesystem::path FileName; + }; + +@@ -44,6 +46,9 @@ + InfoLoading() = delete; + InfoLoading(const uint64_t Off) noexcept : Offset(Off) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoLoading &Rhs); ++ + uint64_t Offset; + }; + +@@ -51,6 +56,8 @@ + InfoAST() = delete; + InfoAST(const ASTNodeAttr Attr) noexcept : NodeAttr(Attr) {} + ++ friend std::ostream &operator<<(std::ostream &OS, const struct InfoAST &Rhs); ++ + ASTNodeAttr NodeAttr; + }; + +@@ -60,6 +67,9 @@ + const uint32_t Lim) noexcept + : Instance(Inst), Number(Num), Limited(Lim) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoInstanceBound &Rhs); ++ + ExternalType Instance; + uint32_t Number, Limited; + }; +@@ -70,6 +80,9 @@ + const uint32_t Bound) noexcept + : Category(Cate), Index(Idx), Boundary(Bound) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoForbidIndex &Rhs); ++ + IndexCategory Category; + uint32_t Index, Boundary; + }; +@@ -78,6 +91,9 @@ + InfoExporting() = delete; + InfoExporting(std::string_view Ext) noexcept : ExtName(Ext) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoExporting &Rhs); ++ + std::string ExtName; + }; + +@@ -87,6 +103,9 @@ + const uint32_t Max = 0) noexcept + : LimHasMax(HasMax), LimMin(Min), LimMax(Max) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoLimit &Rhs); ++ + bool LimHasMax; + uint32_t LimMin, LimMax; + }; +@@ -95,6 +114,9 @@ + InfoRegistering() = delete; + InfoRegistering(std::string_view Mod) noexcept : ModName(Mod) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoRegistering &Rhs); ++ + std::string ModName; + }; + +@@ -104,6 +126,9 @@ + const ExternalType ExtT = ExternalType::Function) noexcept + : ModName(Mod), ExtName(Ext), ExtType(ExtT) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoLinking &Rhs); ++ + std::string ModName; + std::string ExtName; + ExternalType ExtType; +@@ -115,6 +140,9 @@ + : ModName(Mod), FuncName(Func) {} + InfoExecuting(std::string_view Func) noexcept : ModName(""), FuncName(Func) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoExecuting &Rhs); ++ + std::string ModName; + std::string FuncName; + }; +@@ -190,6 +218,9 @@ + : Category(MismatchCategory::Version), ExpVersion(ExpV), + GotVersion(GotV) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoMismatch &Rhs); ++ + /// Mismatched category + MismatchCategory Category; + +@@ -231,6 +262,9 @@ + : Code(Op), Offset(Off), Args(ArgsVec), ArgsTypes(ArgsTypesVec), + IsSigned(Signed) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoInstruction &Rhs); ++ + OpCode Code; + uint64_t Offset; + std::vector Args; +@@ -245,6 +279,9 @@ + const uint32_t Lim = std::numeric_limits::max()) noexcept + : Offset(Off), Size(Len), Limit(Lim) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoBoundary &Rhs); ++ + uint64_t Offset; + uint32_t Size; + uint32_t Limit; +@@ -254,104 +291,45 @@ + InfoProposal() = delete; + InfoProposal(Proposal P) noexcept : P(P) {} + ++ friend std::ostream &operator<<(std::ostream &OS, ++ const struct InfoProposal &Rhs); + Proposal P; + }; + + } // namespace ErrInfo + } // namespace WasmEdge + ++#if FMT_VERSION >= 90000 + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoFile &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoLoading &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoAST &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> + struct fmt::formatter ++ : ostream_formatter {}; +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoInstanceBound &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter { +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoForbidIndex &Info, +- fmt::format_context &Ctx) const noexcept; + }; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoExporting &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoLimit &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter { +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoRegistering &Info, +- fmt::format_context &Ctx) const noexcept; + }; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoLinking &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoExecuting &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoMismatch &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter { +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoInstruction &Info, +- fmt::format_context &Ctx) const noexcept; + }; + template <> ++struct fmt::formatter : ostream_formatter {}; +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoBoundary &Info, +- fmt::format_context &Ctx) const noexcept; +-}; + template <> ++struct fmt::formatter : ostream_formatter {}; ++#endif +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::InfoProposal &Info, +- fmt::format_context &Ctx) const noexcept; +-}; +--- b/include/common/log.h ++++ a/include/common/log.h +@@ -13,8 +13,8 @@ + //===----------------------------------------------------------------------===// + #pragma once + +-#include "common/filesystem.h" + #define SPDLOG_NO_EXCEPTIONS 1 ++#include "spdlog/fmt/ostr.h" + #include "spdlog/spdlog.h" + + namespace WasmEdge { +@@ -32,26 +32,3 @@ + + } // namespace Log + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter +- : fmt::formatter { +- fmt::format_context::iterator format(const std::filesystem::path &Path, +- fmt::format_context &Ctx) const { +- // mimic std::quoted +- constexpr const char Delimiter = '"'; +- constexpr const char Escape = '\\'; +- auto Quoted = fmt::memory_buffer(); +- auto Iter = std::back_inserter(Quoted); +- *Iter++ = Delimiter; +- for (const auto C : Path.u8string()) { +- if (C == Delimiter || C == Escape) { +- *Iter++ = Escape; +- } +- *Iter++ = C; +- } +- *Iter++ = Delimiter; +- return fmt::formatter::format( +- std::string_view(Quoted.data(), Quoted.size()), Ctx); +- } +-}; +--- b/include/host/wasi/error.h ++++ a/include/host/wasi/error.h +@@ -4,9 +4,7 @@ + #pragma once + + #include "common/expected.h" +-#include "common/log.h" + #include "wasi/api.hpp" +-#include + + namespace WasmEdge { + namespace Host { +@@ -26,296 +24,3 @@ + } // namespace WASI + } // namespace Host + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter<__wasi_errno_t> : fmt::formatter { +- fmt::format_context::iterator +- format(__wasi_errno_t ErrNo, fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- using namespace std::literals; +- auto Iter = std::back_inserter(Buffer); +- switch (ErrNo) { +- case __WASI_ERRNO_SUCCESS: +- fmt::format_to( +- Iter, "No error occurred. System call completed successfully."sv); +- break; +- case __WASI_ERRNO_2BIG: +- fmt::format_to(Iter, "Argument list too long."sv); +- break; +- case __WASI_ERRNO_ACCES: +- fmt::format_to(Iter, "Permission denied."sv); +- break; +- case __WASI_ERRNO_ADDRINUSE: +- fmt::format_to(Iter, "Address in use."sv); +- break; +- case __WASI_ERRNO_ADDRNOTAVAIL: +- fmt::format_to(Iter, "Address not available."sv); +- break; +- case __WASI_ERRNO_AFNOSUPPORT: +- fmt::format_to(Iter, "Address family not supported."sv); +- break; +- case __WASI_ERRNO_AGAIN: +- fmt::format_to(Iter, "Resource unavailable, or operation would block."sv); +- break; +- case __WASI_ERRNO_ALREADY: +- fmt::format_to(Iter, "Connection already in progress."sv); +- break; +- case __WASI_ERRNO_BADF: +- fmt::format_to(Iter, "Bad file descriptor."sv); +- break; +- case __WASI_ERRNO_BADMSG: +- fmt::format_to(Iter, "Bad message."sv); +- break; +- case __WASI_ERRNO_BUSY: +- fmt::format_to(Iter, "Device or resource busy."sv); +- break; +- case __WASI_ERRNO_CANCELED: +- fmt::format_to(Iter, "Operation canceled."sv); +- break; +- case __WASI_ERRNO_CHILD: +- fmt::format_to(Iter, "No child processes."sv); +- break; +- case __WASI_ERRNO_CONNABORTED: +- fmt::format_to(Iter, "Connection aborted."sv); +- break; +- case __WASI_ERRNO_CONNREFUSED: +- fmt::format_to(Iter, "Connection refused."sv); +- break; +- case __WASI_ERRNO_CONNRESET: +- fmt::format_to(Iter, "Connection reset."sv); +- break; +- case __WASI_ERRNO_DEADLK: +- fmt::format_to(Iter, "Resource deadlock would occur."sv); +- break; +- case __WASI_ERRNO_DESTADDRREQ: +- fmt::format_to(Iter, "Destination address required."sv); +- break; +- case __WASI_ERRNO_DOM: +- fmt::format_to(Iter, "Mathematics argument out of domain of function."sv); +- break; +- case __WASI_ERRNO_DQUOT: +- fmt::format_to(Iter, "Reserved."sv); +- break; +- case __WASI_ERRNO_EXIST: +- fmt::format_to(Iter, "File exists."sv); +- break; +- case __WASI_ERRNO_FAULT: +- fmt::format_to(Iter, "Bad address."sv); +- break; +- case __WASI_ERRNO_FBIG: +- fmt::format_to(Iter, "File too large."sv); +- break; +- case __WASI_ERRNO_HOSTUNREACH: +- fmt::format_to(Iter, "Host is unreachable."sv); +- break; +- case __WASI_ERRNO_IDRM: +- fmt::format_to(Iter, "Identifier removed."sv); +- break; +- case __WASI_ERRNO_ILSEQ: +- fmt::format_to(Iter, "Illegal byte sequence."sv); +- break; +- case __WASI_ERRNO_INPROGRESS: +- fmt::format_to(Iter, "Operation in progress."sv); +- break; +- case __WASI_ERRNO_INTR: +- fmt::format_to(Iter, "Interrupted function."sv); +- break; +- case __WASI_ERRNO_INVAL: +- fmt::format_to(Iter, "Invalid argument."sv); +- break; +- case __WASI_ERRNO_IO: +- fmt::format_to(Iter, "I/O error."sv); +- break; +- case __WASI_ERRNO_ISCONN: +- fmt::format_to(Iter, "Socket is connected."sv); +- break; +- case __WASI_ERRNO_ISDIR: +- fmt::format_to(Iter, "Is a directory."sv); +- break; +- case __WASI_ERRNO_LOOP: +- fmt::format_to(Iter, "Too many levels of symbolic links."sv); +- break; +- case __WASI_ERRNO_MFILE: +- fmt::format_to(Iter, "File descriptor value too large."sv); +- break; +- case __WASI_ERRNO_MLINK: +- fmt::format_to(Iter, "Too many links."sv); +- break; +- case __WASI_ERRNO_MSGSIZE: +- fmt::format_to(Iter, "Message too large."sv); +- break; +- case __WASI_ERRNO_MULTIHOP: +- fmt::format_to(Iter, "Reserved."sv); +- break; +- case __WASI_ERRNO_NAMETOOLONG: +- fmt::format_to(Iter, "Filename too long."sv); +- break; +- case __WASI_ERRNO_NETDOWN: +- fmt::format_to(Iter, "Network is down."sv); +- break; +- case __WASI_ERRNO_NETRESET: +- fmt::format_to(Iter, "Connection aborted by network."sv); +- break; +- case __WASI_ERRNO_NETUNREACH: +- fmt::format_to(Iter, "Network unreachable."sv); +- break; +- case __WASI_ERRNO_NFILE: +- fmt::format_to(Iter, "Too many files open in system."sv); +- break; +- case __WASI_ERRNO_NOBUFS: +- fmt::format_to(Iter, "No buffer space available."sv); +- break; +- case __WASI_ERRNO_NODEV: +- fmt::format_to(Iter, "No such device."sv); +- break; +- case __WASI_ERRNO_NOENT: +- fmt::format_to(Iter, "No such file or directory."sv); +- break; +- case __WASI_ERRNO_NOEXEC: +- fmt::format_to(Iter, "Executable file format error."sv); +- break; +- case __WASI_ERRNO_NOLCK: +- fmt::format_to(Iter, "No locks available."sv); +- break; +- case __WASI_ERRNO_NOLINK: +- fmt::format_to(Iter, "Reserved."sv); +- break; +- case __WASI_ERRNO_NOMEM: +- fmt::format_to(Iter, "Not enough space."sv); +- break; +- case __WASI_ERRNO_NOMSG: +- fmt::format_to(Iter, "No message of the desired type."sv); +- break; +- case __WASI_ERRNO_NOPROTOOPT: +- fmt::format_to(Iter, "Protocol not available."sv); +- break; +- case __WASI_ERRNO_NOSPC: +- fmt::format_to(Iter, "No space left on device."sv); +- break; +- case __WASI_ERRNO_NOSYS: +- fmt::format_to(Iter, "Function not supported."sv); +- break; +- case __WASI_ERRNO_NOTCONN: +- fmt::format_to(Iter, "The socket is not connected."sv); +- break; +- case __WASI_ERRNO_NOTDIR: +- fmt::format_to(Iter, +- "Not a directory or a symbolic link to a directory."sv); +- break; +- case __WASI_ERRNO_NOTEMPTY: +- fmt::format_to(Iter, "Directory not empty."sv); +- break; +- case __WASI_ERRNO_NOTRECOVERABLE: +- fmt::format_to(Iter, "State not recoverable."sv); +- break; +- case __WASI_ERRNO_NOTSOCK: +- fmt::format_to(Iter, "Not a socket."sv); +- break; +- case __WASI_ERRNO_NOTSUP: +- fmt::format_to(Iter, +- "Not supported, or operation not supported on socket."sv); +- break; +- case __WASI_ERRNO_NOTTY: +- fmt::format_to(Iter, "Inappropriate I/O control operation."sv); +- break; +- case __WASI_ERRNO_NXIO: +- fmt::format_to(Iter, "No such device or address."sv); +- break; +- case __WASI_ERRNO_OVERFLOW: +- fmt::format_to(Iter, "Value too large to be stored in data type."sv); +- break; +- case __WASI_ERRNO_OWNERDEAD: +- fmt::format_to(Iter, "Previous owner died."sv); +- break; +- case __WASI_ERRNO_PERM: +- fmt::format_to(Iter, "Operation not permitted."sv); +- break; +- case __WASI_ERRNO_PIPE: +- fmt::format_to(Iter, "Broken pipe."sv); +- break; +- case __WASI_ERRNO_PROTO: +- fmt::format_to(Iter, "Protocol error."sv); +- break; +- case __WASI_ERRNO_PROTONOSUPPORT: +- fmt::format_to(Iter, "Protocol not supported."sv); +- break; +- case __WASI_ERRNO_PROTOTYPE: +- fmt::format_to(Iter, "Protocol wrong type for socket."sv); +- break; +- case __WASI_ERRNO_RANGE: +- fmt::format_to(Iter, "Result too large."sv); +- break; +- case __WASI_ERRNO_ROFS: +- fmt::format_to(Iter, "Read-only file system."sv); +- break; +- case __WASI_ERRNO_SPIPE: +- fmt::format_to(Iter, "Invalid seek."sv); +- break; +- case __WASI_ERRNO_SRCH: +- fmt::format_to(Iter, "No such process."sv); +- break; +- case __WASI_ERRNO_STALE: +- fmt::format_to(Iter, "Reserved."sv); +- break; +- case __WASI_ERRNO_TIMEDOUT: +- fmt::format_to(Iter, "Connection timed out."sv); +- break; +- case __WASI_ERRNO_TXTBSY: +- fmt::format_to(Iter, "Text file busy."sv); +- break; +- case __WASI_ERRNO_XDEV: +- fmt::format_to(Iter, "Cross-device link."sv); +- break; +- case __WASI_ERRNO_NOTCAPABLE: +- fmt::format_to(Iter, "Extension: Capabilities insufficient."sv); +- break; +- case __WASI_ERRNO_AIADDRFAMILY: +- fmt::format_to(Iter, +- "The specified network host does not have any network " +- "addresses in the requested address family."sv); +- break; +- case __WASI_ERRNO_AIAGAIN: +- fmt::format_to(Iter, "Try again later."sv); +- break; +- case __WASI_ERRNO_AIBADFLAG: +- fmt::format_to(Iter, "Hints.ai_flags contains invalid flags"sv); +- break; +- case __WASI_ERRNO_AIFAIL: +- fmt::format_to( +- Iter, "The name server returned a permanent failure indication."sv); +- break; +- case __WASI_ERRNO_AIFAMILY: +- fmt::format_to(Iter, "The requested address family is not supported."sv); +- break; +- case __WASI_ERRNO_AIMEMORY: +- fmt::format_to(Iter, "Addrinfo out of memory."sv); +- break; +- case __WASI_ERRNO_AINODATA: +- fmt::format_to(Iter, "Network host exists, but does not have any network " +- "addresses defined."sv); +- break; +- case __WASI_ERRNO_AINONAME: +- fmt::format_to( +- Iter, +- "Node or service is not known; or both node and service are NULL."sv); +- break; +- case __WASI_ERRNO_AISERVICE: +- fmt::format_to( +- Iter, "Service is not available for the requested socket type."sv); +- break; +- case __WASI_ERRNO_AISOCKTYPE: +- fmt::format_to(Iter, "The requested socket type is not supported."sv); +- break; +- case __WASI_ERRNO_AISYSTEM: +- fmt::format_to(Iter, "Other system error."sv); +- break; +- default: +- fmt::format_to( +- Iter, "Unknown error code {}"sv, +- static_cast>(ErrNo)); +- break; +- } +- return fmt::formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); +- } +-}; +--- b/lib/common/CMakeLists.txt ++++ a/lib/common/CMakeLists.txt +@@ -7,7 +7,7 @@ + FetchContent_Declare( + spdlog + GIT_REPOSITORY https://github.com/gabime/spdlog.git ++ GIT_TAG v1.9.0 +- GIT_TAG v1.11.0 + GIT_SHALLOW TRUE + ) + set(SPDLOG_BUILD_SHARED OFF CACHE BOOL "Build shared library" FORCE) +--- b/lib/common/errinfo.cpp ++++ a/lib/common/errinfo.cpp +@@ -2,316 +2,270 @@ + // SPDX-FileCopyrightText: 2019-2022 Second State INC + + #include "common/errinfo.h" ++ + #include "common/errcode.h" + #include "common/hexstr.h" + ++namespace WasmEdge { ++namespace ErrInfo { ++std::ostream &operator<<(std::ostream &OS, const struct InfoFile &Rhs) { ++ OS << " File name: " << Rhs.FileName; ++ return OS; +-using namespace std::literals; +- +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoFile &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), " File name: {}"sv, +- Info.FileName); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoLoading &Rhs) { ++ OS << " Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoLoading &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), " Bytecode offset: 0x{:08x}"sv, +- Info.Offset); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoAST &Rhs) { ++ OS << " At AST node: " << ASTNodeAttrStr[Rhs.NodeAttr]; ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoAST &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), " At AST node: {}"sv, +- Info.NodeAttr); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, ++ const struct InfoInstanceBound &Rhs) { ++ OS << " Instance " << ExternalTypeStr[Rhs.Instance] ++ << " has limited number " << Rhs.Limited << " , Got: " << Rhs.Number; ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoInstanceBound &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), +- " Instance {} has limited number {} , Got: {}"sv, +- Info.Instance, Info.Limited, Info.Number); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoForbidIndex &Rhs) { ++ OS << " When checking " << IndexCategoryStr[Rhs.Category] ++ << " index: " << Rhs.Index << " , Out of boundary: "; ++ if (Rhs.Boundary > 0) { ++ OS << (Rhs.Boundary - 1); +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoForbidIndex &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- auto Iter = +- fmt::format_to(std::back_inserter(Buffer), +- " When checking {} index: {} , Out of boundary: "sv, +- Info.Category, Info.Index); +- if (Info.Boundary > 0) { +- fmt::format_to(Iter, "{}"sv, Info.Boundary - 1); + } else { ++ OS << "empty"; +- fmt::format_to(Iter, "empty"sv); + } ++ return OS; +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoExporting &Rhs) { ++ OS << " Duplicated exporting name: \"" << Rhs.ExtName << "\""; ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoExporting &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), +- " Duplicated exporting name: \"{}\""sv, Info.ExtName); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoLimit &Rhs) { ++ OS << " In Limit type: { min: " << Rhs.LimMin; ++ if (Rhs.LimHasMax) { ++ OS << " , max: " << Rhs.LimMax; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoLimit &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- auto Iter = fmt::format_to(std::back_inserter(Buffer), +- " In Limit type: {{ min: {}"sv, Info.LimMin); +- if (Info.LimHasMax) { +- Iter = fmt::format_to(Iter, " , max: {}"sv, Info.LimMax); + } ++ OS << " }"; ++ return OS; +- fmt::format_to(Iter, " }}"sv); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoRegistering &Rhs) { ++ OS << " Module name: \"" << Rhs.ModName << "\""; ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoRegistering &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), " Module name: \"{}\""sv, +- Info.ModName); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoLinking &Rhs) { ++ OS << " When linking module: \"" << Rhs.ModName << "\" , " ++ << ExternalTypeStr[Rhs.ExtType] << " name: \"" << Rhs.ExtName << "\""; ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoLinking &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), +- " When linking module: \"{}\" , {} name: \"{}\""sv, +- Info.ModName, Info.ExtType, Info.ExtName); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoExecuting &Rhs) { ++ OS << " When executing "; ++ if (Rhs.ModName != "") { ++ OS << "module name: \"" << Rhs.ModName << "\" , "; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoExecuting &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- auto Iter = +- fmt::format_to(std::back_inserter(Buffer), " When executing "sv); +- if (!Info.ModName.empty()) { +- Iter = fmt::format_to(Iter, "module name: \"{}\" , "sv, Info.ModName); + } ++ OS << "function name: \"" << Rhs.FuncName << "\""; ++ return OS; +- fmt::format_to(Iter, "function name: \"{}\""sv, Info.FuncName); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoMismatch &Rhs) { ++ OS << " Mismatched " << MismatchCategoryStr[Rhs.Category] << ". "; ++ switch (Rhs.Category) { ++ case MismatchCategory::Alignment: ++ OS << "Expected: need to <= " << static_cast(Rhs.ExpAlignment) ++ << " , Got: " << (1UL << Rhs.GotAlignment); +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoMismatch &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- auto Iter = fmt::format_to(std::back_inserter(Buffer), +- " Mismatched {}. "sv, Info.Category); +- auto FormatLimit = [](auto Out, bool LimHasMax, uint32_t LimMin, +- uint32_t LimMax) { +- Out = fmt::format_to(Out, "Limit{{{}"sv, LimMin); +- if (LimHasMax) { +- Out = fmt::format_to(Out, " , {}"sv, LimMax); +- } +- Out = fmt::format_to(Out, "}}"sv); +- return Out; +- }; +- switch (Info.Category) { +- case WasmEdge::ErrInfo::MismatchCategory::Alignment: +- fmt::format_to(Iter, "Expected: need to <= {} , Got: {}"sv, +- static_cast(Info.ExpAlignment), +- 1UL << Info.GotAlignment); + break; ++ case MismatchCategory::ValueType: ++ OS << "Expected: " << ValTypeStr[Rhs.ExpValType] ++ << " , Got: " << ValTypeStr[Rhs.GotValType]; +- case WasmEdge::ErrInfo::MismatchCategory::ValueType: +- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpValType, +- Info.GotValType); + break; ++ case MismatchCategory::ValueTypes: ++ OS << "Expected: types{"; ++ for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { ++ OS << ValTypeStr[Rhs.ExpParams[I]]; ++ if (I < Rhs.ExpParams.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "} , Got: types{"; ++ for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { ++ OS << ValTypeStr[Rhs.GotParams[I]]; ++ if (I < Rhs.GotParams.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "}"; +- case WasmEdge::ErrInfo::MismatchCategory::ValueTypes: +- fmt::format_to(Iter, "Expected: types{{{}}} , Got: types{{{}}}"sv, +- fmt::join(Info.ExpParams, " , "sv), +- fmt::join(Info.GotParams, " , "sv)); + break; ++ case MismatchCategory::Mutation: ++ OS << "Expected: " << ValMutStr[Rhs.ExpValMut] ++ << " , Got: " << ValMutStr[Rhs.GotValMut]; +- case WasmEdge::ErrInfo::MismatchCategory::Mutation: +- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpValMut, +- Info.GotValMut); + break; ++ case MismatchCategory::ExternalType: ++ OS << "Expected: " << ExternalTypeStr[Rhs.ExpExtType] ++ << " , Got: " << ExternalTypeStr[Rhs.GotExtType]; +- case WasmEdge::ErrInfo::MismatchCategory::ExternalType: +- fmt::format_to(Iter, "Expected: {} , Got: {}", Info.ExpExtType, +- Info.GotExtType); + break; ++ case MismatchCategory::FunctionType: ++ OS << "Expected: FuncType {params{"; ++ for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { ++ OS << ValTypeStr[Rhs.ExpParams[I]]; ++ if (I < Rhs.ExpParams.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "} returns{"; ++ for (uint32_t I = 0; I < Rhs.ExpReturns.size(); ++I) { ++ OS << ValTypeStr[Rhs.ExpReturns[I]]; ++ if (I < Rhs.ExpReturns.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "}} , Got: FuncType {params{"; ++ for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { ++ OS << ValTypeStr[Rhs.GotParams[I]]; ++ if (I < Rhs.GotParams.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "} returns{"; ++ for (uint32_t I = 0; I < Rhs.GotReturns.size(); ++I) { ++ OS << ValTypeStr[Rhs.GotReturns[I]]; ++ if (I < Rhs.GotReturns.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "}}"; +- case WasmEdge::ErrInfo::MismatchCategory::FunctionType: +- fmt::format_to(Iter, +- "Expected: FuncType {{params{{{}}} returns{{{}}}}} , " +- "Got: FuncType {{params{{{}}} returns{{{}}}}}"sv, +- fmt::join(Info.ExpParams, " , "sv), +- fmt::join(Info.ExpReturns, " , "sv), +- fmt::join(Info.GotParams, " , "sv), +- fmt::join(Info.GotReturns, " , "sv)); + break; ++ case MismatchCategory::Table: ++ OS << "Expected: TableType {RefType{" ++ << ValTypeStr[static_cast(Rhs.ExpRefType)] << "} Limit{" ++ << Rhs.ExpLimMin; ++ if (Rhs.ExpLimHasMax) { ++ OS << " , " << Rhs.ExpLimMax; ++ } ++ OS << "}} , Got: TableType {RefType{" ++ << ValTypeStr[static_cast(Rhs.GotRefType)] << "} Limit{" ++ << Rhs.GotLimMin; ++ if (Rhs.GotLimHasMax) { ++ OS << " , " << Rhs.GotLimMax; ++ } ++ OS << "}}"; +- case WasmEdge::ErrInfo::MismatchCategory::Table: +- Iter = fmt::format_to(Iter, "Expected: TableType {{RefType{{{}}} "sv, +- static_cast(Info.ExpRefType)); +- Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); +- Iter = fmt::format_to(Iter, "}} , Got: TableType {{RefType{{{}}} "sv, +- static_cast(Info.GotRefType)); +- Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); +- fmt::format_to(Iter, "}}"sv); + break; ++ case MismatchCategory::Memory: ++ OS << "Expected: MemoryType {Limit{" << Rhs.ExpLimMin; ++ if (Rhs.ExpLimHasMax) { ++ OS << " , " << Rhs.ExpLimMax; ++ } ++ OS << "}} , Got: MemoryType {Limit{" << Rhs.GotLimMin; ++ if (Rhs.GotLimHasMax) { ++ OS << " , " << Rhs.GotLimMax; ++ } ++ OS << "}}"; +- case WasmEdge::ErrInfo::MismatchCategory::Memory: +- Iter = fmt::format_to(Iter, "Expected: MemoryType {{"sv); +- Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); +- Iter = fmt::format_to(Iter, "}} , Got: MemoryType {{"sv); +- Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); +- fmt::format_to(Iter, "}}"sv); + break; ++ case MismatchCategory::Global: ++ OS << "Expected: GlobalType {Mutation{" << ValMutStr[Rhs.ExpValMut] ++ << "} ValType{" << ValTypeStr[Rhs.ExpValType] ++ << "}} , Got: GlobalType {Mutation{" << ValMutStr[Rhs.GotValMut] ++ << "} ValType{" << ValTypeStr[Rhs.GotValType] << "}}"; +- case WasmEdge::ErrInfo::MismatchCategory::Global: +- fmt::format_to(Iter, +- "Expected: GlobalType {{Mutation{{{}}} ValType{{{}}}}} , " +- "Got: GlobalType {{Mutation{{{}}} ValType{{{}}}}}"sv, +- Info.ExpValMut, Info.ExpValType, Info.GotValMut, +- Info.GotValType); + break; ++ case MismatchCategory::Version: ++ OS << "Expected: " << Rhs.ExpVersion << " , Got: " << Rhs.GotVersion; +- case WasmEdge::ErrInfo::MismatchCategory::Version: +- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpVersion, +- Info.GotVersion); + break; + default: + break; + } ++ return OS; +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoInstruction &Rhs) { ++ uint16_t Payload = static_cast(Rhs.Code); ++ OS << " In instruction: " << OpCodeStr[Rhs.Code] << " ("; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoInstruction &Info, +- fmt::format_context &Ctx) const noexcept { +- uint16_t Payload = static_cast(Info.Code); +- fmt::memory_buffer Buffer; +- auto Iter = fmt::format_to(std::back_inserter(Buffer), +- " In instruction: {} ("sv, Info.Code); + if ((Payload >> 8) >= static_cast(0xFCU)) { ++ OS << convertUIntToHexStr(Payload >> 8, 2) << " "; +- Iter = fmt::format_to(Iter, "0x{:02x} "sv, Payload >> 8); + } ++ OS << convertUIntToHexStr(Payload & 0xFFU, 2) ++ << ") , Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); ++ if (Rhs.Args.size() > 0) { ++ OS << " , Args: ["; ++ for (uint32_t I = 0; I < Rhs.Args.size(); ++I) { ++ switch (Rhs.ArgsTypes[I]) { ++ case ValType::I32: ++ if (Rhs.IsSigned) { ++ OS << Rhs.Args[I].get(); +- Iter = fmt::format_to(Iter, "0x{:02x}) , Bytecode offset: 0x{:08x}"sv, +- Payload & 0xFFU, Info.Offset); +- if (!Info.Args.empty()) { +- Iter = fmt::format_to(Iter, " , Args: ["sv); +- for (uint32_t I = 0; I < Info.Args.size(); ++I) { +- switch (Info.ArgsTypes[I]) { +- case WasmEdge::ValType::I32: +- if (Info.IsSigned) { +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + } else { ++ OS << Rhs.Args[I].get(); +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + } + break; ++ case ValType::I64: ++ if (Rhs.IsSigned) { ++ OS << Rhs.Args[I].get(); +- case WasmEdge::ValType::I64: +- if (Info.IsSigned) { +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + } else { ++ OS << Rhs.Args[I].get(); +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + } + break; ++ case ValType::F32: ++ OS << Rhs.Args[I].get(); +- case WasmEdge::ValType::F32: +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + break; ++ case ValType::F64: ++ OS << Rhs.Args[I].get(); +- case WasmEdge::ValType::F64: +- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); + break; ++ case ValType::V128: { ++ const auto Value = Rhs.Args[I].get(); ++ OS << std::hex << Value[0] << Value[1]; +- case WasmEdge::ValType::V128: { +- const auto Value = Info.Args[I].get(); +- Iter = fmt::format_to(Iter, "0x{:08x}{:08x}"sv, Value[1], Value[0]); + break; + } ++ case ValType::FuncRef: ++ OS << ValTypeStr[Rhs.ArgsTypes[I]]; ++ if (isNullRef(Rhs.Args[I])) { ++ OS << ":null"; +- case WasmEdge::ValType::FuncRef: +- case WasmEdge::ValType::ExternRef: +- Iter = fmt::format_to(Iter, "{}"sv, Info.ArgsTypes[I]); +- if (isNullRef(Info.Args[I])) { +- Iter = fmt::format_to(Iter, ":null"sv); + } else { ++ OS << ":" << &Rhs.Args[I].get(); ++ } ++ break; ++ case ValType::ExternRef: ++ OS << ValTypeStr[Rhs.ArgsTypes[I]]; ++ if (isNullRef(Rhs.Args[I])) { ++ OS << ":null"; ++ } else { ++ OS << ":" << &Rhs.Args[I].get(); +- Iter = +- fmt::format_to(Iter, ":0x{:08x}"sv, Info.Args[I].get()); + } + break; + default: + break; + } ++ if (I < Rhs.Args.size() - 1) { ++ OS << " , "; +- if (I < Info.Args.size() - 1) { +- Iter = fmt::format_to(Iter, " , "sv); + } + } ++ OS << "]"; +- Iter = fmt::format_to(Iter, "]"sv); + } ++ return OS; +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoBoundary &Rhs) { ++ OS << " Accessing offset from: " << convertUIntToHexStr(Rhs.Offset) ++ << " to: " ++ << convertUIntToHexStr(Rhs.Offset + Rhs.Size - (Rhs.Size > 0 ? 1 : 0)) ++ << " , Out of boundary: " << convertUIntToHexStr(Rhs.Limit); ++ return OS; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoBoundary &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), +- " Accessing offset from: 0x{:08x} to: 0x{:08x} , Out of " +- "boundary: 0x{:08x}"sv, +- Info.Offset, +- Info.Offset + (Info.Size > 0U ? Info.Size - 1U : 0U), +- Info.Limit); +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } + ++std::ostream &operator<<(std::ostream &OS, const struct InfoProposal &Rhs) { ++ if (auto Iter = ProposalStr.find(Rhs.P); Iter != ProposalStr.end()) { ++ OS << " This instruction or syntax requires enabling proposal " ++ << Iter->second; +-fmt::format_context::iterator +-fmt::formatter::format( +- const WasmEdge::ErrInfo::InfoProposal &Info, +- fmt::format_context &Ctx) const noexcept { +- fmt::memory_buffer Buffer; +- if (auto Iter = WasmEdge::ProposalStr.find(Info.P); +- Iter != WasmEdge::ProposalStr.end()) { +- fmt::format_to( +- std::back_inserter(Buffer), +- " This instruction or syntax requires enabling proposal {}"sv, +- Iter->second); + } else { ++ OS << " Unknown proposal, Code " ++ << convertUIntToHexStr(static_cast(Rhs.P)); +- fmt::format_to(std::back_inserter(Buffer), +- " Unknown proposal, Code 0x{:08x}"sv, +- static_cast(Info.P)); + } ++ return OS; +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); + } ++ ++} // namespace ErrInfo ++} // namespace WasmEdge +--- b/test/errinfo/errinfoTest.cpp ++++ a/test/errinfo/errinfoTest.cpp +@@ -5,124 +5,122 @@ + + #include + #include ++#include +-#include + #include + +-using namespace std::literals; +- + namespace { + + TEST(ErrInfoTest, Info__File) { + WasmEdge::ErrInfo::InfoFile Info1("file.txt"); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Loading) { + WasmEdge::ErrInfo::InfoLoading Info1(30); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__AST) { + WasmEdge::ErrInfo::InfoAST Info1(WasmEdge::ASTNodeAttr::Module); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__InstanceBound) { + WasmEdge::ErrInfo::InfoInstanceBound Info1(WasmEdge::ExternalType::Memory, 2, + 1); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__ForbidIndex) { + WasmEdge::ErrInfo::InfoForbidIndex Info1( + WasmEdge::ErrInfo::IndexCategory::FunctionType, 2, 1); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoForbidIndex Info2( + WasmEdge::ErrInfo::IndexCategory::Memory, 2, 0); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Exporting) { + WasmEdge::ErrInfo::InfoExporting Info1("export"); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Limit) { + WasmEdge::ErrInfo::InfoLimit Info1(true, 10, 20); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoLimit Info2(false, 30); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Registering) { + WasmEdge::ErrInfo::InfoRegistering Info1("host_func"); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Linking) { + WasmEdge::ErrInfo::InfoLinking Info1("module", "func"); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Executing) { + WasmEdge::ErrInfo::InfoExecuting Info1("", "func"); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoExecuting Info2("module", "func"); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Mismatch) { + WasmEdge::ErrInfo::InfoMismatch Info1(static_cast(16), 8888); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoMismatch Info2(WasmEdge::ValType::ExternRef, + WasmEdge::ValType::FuncRef); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + WasmEdge::ErrInfo::InfoMismatch Info3( + {WasmEdge::ValType::I32, WasmEdge::ValType::FuncRef}, + {WasmEdge::ValType::F64, WasmEdge::ValType::ExternRef, + WasmEdge::ValType::V128}); ++ std::cout << Info3 << std::endl; +- fmt::print("{}\n"sv, Info3); + WasmEdge::ErrInfo::InfoMismatch Info4(WasmEdge::ValMut::Const, + WasmEdge::ValMut::Var); ++ std::cout << Info4 << std::endl; +- fmt::print("{}\n"sv, Info4); + WasmEdge::ErrInfo::InfoMismatch Info5(WasmEdge::ExternalType::Function, + WasmEdge::ExternalType::Global); ++ std::cout << Info5 << std::endl; +- fmt::print("{}\n"sv, Info5); + WasmEdge::ErrInfo::InfoMismatch Info6( + {WasmEdge::ValType::I32, WasmEdge::ValType::FuncRef}, + {WasmEdge::ValType::I64, WasmEdge::ValType::F64}, + {WasmEdge::ValType::F64, WasmEdge::ValType::ExternRef, + WasmEdge::ValType::V128}, + {WasmEdge::ValType::V128}); ++ std::cout << Info6 << std::endl; +- fmt::print("{}\n"sv, Info6); + WasmEdge::ErrInfo::InfoMismatch Info7(WasmEdge::RefType::ExternRef, true, 10, + 20, WasmEdge::RefType::FuncRef, true, + 20, 50); ++ std::cout << Info7 << std::endl; +- fmt::print("{}\n"sv, Info7); + WasmEdge::ErrInfo::InfoMismatch Info8(WasmEdge::RefType::ExternRef, false, 10, + 10, WasmEdge::RefType::FuncRef, false, + 20, 20); ++ std::cout << Info8 << std::endl; +- fmt::print("{}\n"sv, Info8); + WasmEdge::ErrInfo::InfoMismatch Info9(true, 10, 20, true, 20, 50); ++ std::cout << Info9 << std::endl; +- fmt::print("{}\n"sv, Info9); + WasmEdge::ErrInfo::InfoMismatch Info10(false, 10, 10, false, 20, 20); ++ std::cout << Info10 << std::endl; +- fmt::print("{}\n"sv, Info10); + WasmEdge::ErrInfo::InfoMismatch Info11( + WasmEdge::ValType::I32, WasmEdge::ValMut::Var, WasmEdge::ValType::I64, + WasmEdge::ValMut::Const); ++ std::cout << Info11 << std::endl; +- fmt::print("{}\n"sv, Info11); + WasmEdge::ErrInfo::InfoMismatch Info12(12345678U, 98765432U); ++ std::cout << Info12 << std::endl; +- fmt::print("{}\n"sv, Info12); + + EXPECT_TRUE(true); + } +@@ -136,54 +134,54 @@ + WasmEdge::ErrInfo::InfoInstruction Info1( + WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::I32, WasmEdge::ValType::I32, WasmEdge::ValType::I32}); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoInstruction Info2( + WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::I32, WasmEdge::ValType::I32, WasmEdge::ValType::I32}); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + WasmEdge::ErrInfo::InfoInstruction Info3( + WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::I64, WasmEdge::ValType::I64, WasmEdge::ValType::I64}); ++ std::cout << Info3 << std::endl; +- fmt::print("{}\n"sv, Info3); + WasmEdge::ErrInfo::InfoInstruction Info4( + WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::F32, WasmEdge::ValType::F32, WasmEdge::ValType::F32}); ++ std::cout << Info4 << std::endl; +- fmt::print("{}\n"sv, Info4); + WasmEdge::ErrInfo::InfoInstruction Info5( + WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::F64, WasmEdge::ValType::F64, WasmEdge::ValType::F64}); ++ std::cout << Info5 << std::endl; +- fmt::print("{}\n"sv, Info5); + WasmEdge::ErrInfo::InfoInstruction Info6(WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::V128, + WasmEdge::ValType::V128, + WasmEdge::ValType::V128}); ++ std::cout << Info6 << std::endl; +- fmt::print("{}\n"sv, Info6); + WasmEdge::ErrInfo::InfoInstruction Info7(WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::FuncRef, + WasmEdge::ValType::FuncRef, + WasmEdge::ValType::FuncRef}); ++ std::cout << Info7 << std::endl; +- fmt::print("{}\n"sv, Info7); + WasmEdge::ErrInfo::InfoInstruction Info8(WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::ValType::ExternRef, + WasmEdge::ValType::ExternRef, + WasmEdge::ValType::ExternRef}); ++ std::cout << Info8 << std::endl; +- fmt::print("{}\n"sv, Info8); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Boundary) { + WasmEdge::ErrInfo::InfoBoundary Info1(3, 5, 2); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoBoundary Info2(3, 0, 2); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + EXPECT_TRUE(true); + } + + TEST(ErrInfoTest, Info__Proposal) { + WasmEdge::ErrInfo::InfoProposal Info1(WasmEdge::Proposal::SIMD); ++ std::cout << Info1 << std::endl; +- fmt::print("{}\n"sv, Info1); + WasmEdge::ErrInfo::InfoProposal Info2(static_cast(250U)); ++ std::cout << Info2 << std::endl; +- fmt::print("{}\n"sv, Info2); + EXPECT_TRUE(true); + } + diff --git a/wasmedge.spec b/wasmedge.spec index b2a09fc..d4b62b9 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -12,8 +12,8 @@ Summary: High performance WebAssembly Virtual Machine License: ASL 2.0 and CC0 URL: https://github.com/%{reponame}/%{reponame} Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz -# Apply the patch to disable installation for fmt https://github.com/WasmEdge/WasmEdge/pull/3430 -Patch0: wasmedge-disable-fmt-installation.patch +# Revert https://github.com/WasmEdge/WasmEdge/pull/2511 for old fmt version +Patch0: wasmedge-revert-fmt.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gcc-toolset-11-toolchain @@ -21,8 +21,10 @@ BuildRequires: git BuildRequires: lld-devel BuildRequires: llvm-devel BuildRequires: ninja-build +BuildRequires: spdlog-devel Requires: lld Requires: llvm +Requires: spdlog # Currently wasmedge could only be built on specific arches ExclusiveArch: x86_64 aarch64 Provides: %{reponame} = %{version}-%{release} @@ -36,6 +38,7 @@ High performance WebAssembly Virtual Machine %package rt Summary: %{reponame} Runtime +Requires: spdlog Provides: %{reponame}-rt = %{version}-%{release} Provides: bundled(blake3) = 1.3.3 Provides: bundled(wasi-cpp-header) = 0.0.1 @@ -106,7 +109,7 @@ cd .. %{_libdir}/lib%{name}.so %changelog -* Thu Jun 6 2024 dm4 - 0.14.0 +* Thu May 30 2024 dm4 - 0.14.0 - Release 0.14.0 * Mon Oct 2 2023 dm4 - 0.13.4 - Release 0.13.4 From 2f2c064b93106604b8c728860524d3c5470caa9c Mon Sep 17 00:00:00 2001 From: dm4 Date: Fri, 7 Jun 2024 07:53:24 +0000 Subject: [PATCH 12/18] Update the fmt revert patch Signed-off-by: dm4 --- wasmedge-revert-fmt.patch | 841 +++++++++++++++++++++----------------- 1 file changed, 477 insertions(+), 364 deletions(-) diff --git a/wasmedge-revert-fmt.patch b/wasmedge-revert-fmt.patch index 499272e..dc6716a 100644 --- a/wasmedge-revert-fmt.patch +++ b/wasmedge-revert-fmt.patch @@ -1,15 +1,32 @@ ---- b/include/common/enum_ast.hpp -+++ a/include/common/enum_ast.hpp -@@ -18,7 +18,6 @@ - #pragma once +diff --git a/include/common/enum_ast.hpp b/include/common/enum_ast.hpp +index be41833a..b7d0acc6 100644 +--- a/include/common/enum_ast.hpp ++++ b/include/common/enum_ast.hpp +@@ -19,7 +19,6 @@ - #include "dense_enum_map.h" --#include "log.h" - #include "spare_enum_map.h" + #include "common/dense_enum_map.h" + #include "common/spare_enum_map.h" +-#include "common/spdlog.h" #include -@@ -73,23 +72,3 @@ - (); + #include +@@ -46,7 +45,8 @@ static inline constexpr auto ASTNodeAttrStr = []() constexpr { + #undef UseASTNodeAttr + }; + return DenseEnumMap(Array); +-}(); ++} ++(); + + /// Instruction opcode enumeration class. + enum class OpCode : uint32_t { +@@ -84,26 +84,7 @@ static inline constexpr const auto OpCodeStr = []() constexpr { + #undef UseOpCode + }; + return SpareEnumMap(Array); +-}(); ++} ++(); } // namespace WasmEdge - @@ -32,30 +49,47 @@ - return formatter::format(WasmEdge::OpCodeStr[Code], Ctx); - } -}; ---- b/include/common/enum_errcode.hpp -+++ a/include/common/enum_errcode.hpp -@@ -15,7 +15,6 @@ - #pragma once +diff --git a/include/common/enum_errcode.hpp b/include/common/enum_errcode.hpp +index a50f49df..80f24bbf 100644 +--- a/include/common/enum_errcode.hpp ++++ b/include/common/enum_errcode.hpp +@@ -16,7 +16,6 @@ - #include "dense_enum_map.h" --#include "log.h" - #include "spare_enum_map.h" + #include "common/dense_enum_map.h" + #include "common/spare_enum_map.h" +-#include "common/spdlog.h" #include -@@ -76,11 +75,6 @@ + #include +@@ -42,7 +41,8 @@ static inline constexpr auto WasmPhaseStr = []() constexpr { + #undef UseWasmPhase + }; + return DenseEnumMap(Array); +-}(); ++} ++(); + + /// Error category C++ enumeration class. + enum class ErrCategory : uint8_t { +@@ -75,11 +75,6 @@ public: ? ErrCode::Value::UserDefError : static_cast(getCode()); } - constexpr WasmPhase getErrCodePhase() const noexcept { - return getCategory() != ErrCategory::WASM - ? WasmPhase::UserDefined -- : static_cast((getCode() & 0xF0U) >> 5); +- : static_cast((getCode() >> 8) & 0x0FU); - } constexpr ErrCode() noexcept : Inner(0) {} constexpr ErrCode(const ErrCode &E) noexcept : Inner(E.Inner.Num) {} -@@ -140,13 +134,3 @@ - (); +@@ -136,16 +131,7 @@ static inline constexpr const auto ErrCodeStr = []() constexpr { + #undef UseErrCode + }; + return SpareEnumMap(Array); +-}(); ++} ++(); } // namespace WasmEdge - @@ -68,9 +102,11 @@ - Ctx); - } -}; ---- b/include/common/enum_errinfo.hpp -+++ a/include/common/enum_errinfo.hpp -@@ -109,36 +109,3 @@ +diff --git a/include/common/enum_errinfo.hpp b/include/common/enum_errinfo.hpp +index f385010a..15f3ab1f 100644 +--- a/include/common/enum_errinfo.hpp ++++ b/include/common/enum_errinfo.hpp +@@ -109,36 +109,3 @@ static inline constexpr auto IndexCategoryStr = []() constexpr { } // namespace ErrInfo } // namespace WasmEdge @@ -107,31 +143,41 @@ - WasmEdge::ErrInfo::IndexCategoryStr[Category], Ctx); - } -}; ---- b/include/common/enum_types.hpp -+++ a/include/common/enum_types.hpp -@@ -15,7 +15,6 @@ - #pragma once +diff --git a/include/common/enum_types.hpp b/include/common/enum_types.hpp +index 340e8ec1..ffd5d9f5 100644 +--- a/include/common/enum_types.hpp ++++ b/include/common/enum_types.hpp +@@ -42,7 +42,8 @@ static inline constexpr const auto TypeCodeStr = []() constexpr { + #undef UseTypeCode + }; + return SpareEnumMap(Array); +-}(); ++} ++(); - #include "dense_enum_map.h" --#include "log.h" - #include "spare_enum_map.h" + /// WASM Mutability C++ enumeration class. + enum class ValMut : uint8_t { +@@ -63,7 +64,8 @@ static inline constexpr auto ValMutStr = []() constexpr { + #undef UseValMut + }; + return DenseEnumMap(Array); +-}(); ++} ++(); - #include -@@ -108,31 +107,3 @@ - (); + /// WASM External type C++ enumeration class. + enum class ExternalType : uint8_t { +@@ -84,25 +86,7 @@ static inline constexpr auto ExternalTypeStr = []() constexpr { + #undef UseExternalType + }; + return DenseEnumMap(Array); +-}(); ++} ++(); } // namespace WasmEdge - -template <> --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ValType &Type, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::ValTypeStr[Type], Ctx); -- } --}; -- --template <> -struct fmt::formatter : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ValMut &Mut, fmt::format_context &Ctx) const noexcept { @@ -149,9 +195,11 @@ - Ctx); - } -}; ---- b/include/common/errcode.h -+++ a/include/common/errcode.h -@@ -33,6 +33,20 @@ +diff --git a/include/common/errcode.h b/include/common/errcode.h +index 4f73a121..a0e5dd89 100644 +--- a/include/common/errcode.h ++++ b/include/common/errcode.h +@@ -37,6 +37,20 @@ namespace WasmEdge { @@ -172,21 +220,19 @@ static inline constexpr bool likely(bool V) noexcept { return __builtin_expect(V, true); } -@@ -54,25 +68,7 @@ +@@ -58,25 +72,7 @@ template constexpr auto Unexpect(const Expect &Val) { } // namespace WasmEdge +#if FMT_VERSION >= 90000 template <> -+struct fmt::formatter : ostream_formatter {}; -+#endif -struct fmt::formatter : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrCode &Code, - fmt::format_context &Ctx) const noexcept { - using namespace std::literals; - std::string Output = -- fmt::format("{} failed: {}, Code: 0x{:02x}"sv, Code.getErrCodePhase(), +- fmt::format("{} failed: {}, Code: 0x{:03x}"sv, Code.getErrCodePhase(), - WasmEdge::ErrCodeStr[Code.getEnum()], Code.getCode()); - return formatter::format(Output, Ctx); - } @@ -201,9 +247,13 @@ - return formatter::format(WasmEdge::ErrCode(Value), Ctx); - } -}; ---- b/include/common/errinfo.h -+++ a/include/common/errinfo.h -@@ -37,6 +37,8 @@ ++struct fmt::formatter : ostream_formatter {}; ++#endif +diff --git a/include/common/errinfo.h b/include/common/errinfo.h +index a18bb1c3..45f3761c 100644 +--- a/include/common/errinfo.h ++++ b/include/common/errinfo.h +@@ -37,6 +37,8 @@ struct InfoFile { InfoFile() = delete; InfoFile(const std::filesystem::path &FName) noexcept : FileName(FName) {} @@ -212,7 +262,7 @@ std::filesystem::path FileName; }; -@@ -44,6 +46,9 @@ +@@ -44,6 +46,9 @@ struct InfoLoading { InfoLoading() = delete; InfoLoading(const uint64_t Off) noexcept : Offset(Off) {} @@ -222,7 +272,7 @@ uint64_t Offset; }; -@@ -51,6 +56,8 @@ +@@ -51,6 +56,8 @@ struct InfoAST { InfoAST() = delete; InfoAST(const ASTNodeAttr Attr) noexcept : NodeAttr(Attr) {} @@ -231,7 +281,7 @@ ASTNodeAttr NodeAttr; }; -@@ -60,6 +67,9 @@ +@@ -60,6 +67,9 @@ struct InfoInstanceBound { const uint32_t Lim) noexcept : Instance(Inst), Number(Num), Limited(Lim) {} @@ -241,7 +291,7 @@ ExternalType Instance; uint32_t Number, Limited; }; -@@ -70,6 +80,9 @@ +@@ -70,6 +80,9 @@ struct InfoForbidIndex { const uint32_t Bound) noexcept : Category(Cate), Index(Idx), Boundary(Bound) {} @@ -251,7 +301,7 @@ IndexCategory Category; uint32_t Index, Boundary; }; -@@ -78,6 +91,9 @@ +@@ -78,6 +91,9 @@ struct InfoExporting { InfoExporting() = delete; InfoExporting(std::string_view Ext) noexcept : ExtName(Ext) {} @@ -261,7 +311,7 @@ std::string ExtName; }; -@@ -87,6 +103,9 @@ +@@ -87,6 +103,9 @@ struct InfoLimit { const uint32_t Max = 0) noexcept : LimHasMax(HasMax), LimMin(Min), LimMax(Max) {} @@ -271,7 +321,7 @@ bool LimHasMax; uint32_t LimMin, LimMax; }; -@@ -95,6 +114,9 @@ +@@ -95,6 +114,9 @@ struct InfoRegistering { InfoRegistering() = delete; InfoRegistering(std::string_view Mod) noexcept : ModName(Mod) {} @@ -281,7 +331,7 @@ std::string ModName; }; -@@ -104,6 +126,9 @@ +@@ -104,6 +126,9 @@ struct InfoLinking { const ExternalType ExtT = ExternalType::Function) noexcept : ModName(Mod), ExtName(Ext), ExtType(ExtT) {} @@ -291,7 +341,7 @@ std::string ModName; std::string ExtName; ExternalType ExtType; -@@ -115,6 +140,9 @@ +@@ -115,6 +140,9 @@ struct InfoExecuting { : ModName(Mod), FuncName(Func) {} InfoExecuting(std::string_view Func) noexcept : ModName(""), FuncName(Func) {} @@ -301,7 +351,7 @@ std::string ModName; std::string FuncName; }; -@@ -190,6 +218,9 @@ +@@ -196,6 +224,9 @@ struct InfoMismatch { : Category(MismatchCategory::Version), ExpVersion(ExpV), GotVersion(GotV) {} @@ -311,7 +361,7 @@ /// Mismatched category MismatchCategory Category; -@@ -231,6 +262,9 @@ +@@ -236,6 +267,9 @@ struct InfoInstruction { : Code(Op), Offset(Off), Args(ArgsVec), ArgsTypes(ArgsTypesVec), IsSigned(Signed) {} @@ -321,7 +371,7 @@ OpCode Code; uint64_t Offset; std::vector Args; -@@ -245,6 +279,9 @@ +@@ -250,6 +284,9 @@ struct InfoBoundary { const uint32_t Lim = std::numeric_limits::max()) noexcept : Offset(Off), Size(Len), Limit(Lim) {} @@ -331,12 +381,13 @@ uint64_t Offset; uint32_t Size; uint32_t Limit; -@@ -254,104 +291,45 @@ +@@ -259,104 +296,46 @@ struct InfoProposal { InfoProposal() = delete; InfoProposal(Proposal P) noexcept : P(P) {} + friend std::ostream &operator<<(std::ostream &OS, + const struct InfoProposal &Rhs); ++ Proposal P; }; @@ -345,117 +396,119 @@ +#if FMT_VERSION >= 90000 template <> -+struct fmt::formatter : ostream_formatter {}; -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoFile &Info, - fmt::format_context &Ctx) const noexcept; -}; ++struct fmt::formatter : ostream_formatter {}; template <> -+struct fmt::formatter : ostream_formatter {}; -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoLoading &Info, - fmt::format_context &Ctx) const noexcept; -}; ++struct fmt::formatter : ostream_formatter {}; template <> -+struct fmt::formatter : ostream_formatter {}; -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoAST &Info, - fmt::format_context &Ctx) const noexcept; -}; ++struct fmt::formatter : ostream_formatter {}; template <> struct fmt::formatter -+ : ostream_formatter {}; - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoInstanceBound &Info, - fmt::format_context &Ctx) const noexcept; -}; ++ : ostream_formatter {}; template <> -+struct fmt::formatter : ostream_formatter { -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoForbidIndex &Info, - fmt::format_context &Ctx) const noexcept; ++struct fmt::formatter : ostream_formatter { }; template <> -+struct fmt::formatter : ostream_formatter {}; -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoExporting &Info, - fmt::format_context &Ctx) const noexcept; -}; ++struct fmt::formatter : ostream_formatter {}; template <> -+struct fmt::formatter : ostream_formatter {}; -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoLimit &Info, - fmt::format_context &Ctx) const noexcept; -}; ++struct fmt::formatter : ostream_formatter {}; template <> -+struct fmt::formatter : ostream_formatter { -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoRegistering &Info, - fmt::format_context &Ctx) const noexcept; ++struct fmt::formatter : ostream_formatter { }; template <> -+struct fmt::formatter : ostream_formatter {}; -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoLinking &Info, - fmt::format_context &Ctx) const noexcept; -}; ++struct fmt::formatter : ostream_formatter {}; template <> -+struct fmt::formatter : ostream_formatter {}; -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoExecuting &Info, - fmt::format_context &Ctx) const noexcept; -}; ++struct fmt::formatter : ostream_formatter {}; template <> -+struct fmt::formatter : ostream_formatter {}; -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoMismatch &Info, - fmt::format_context &Ctx) const noexcept; -}; ++struct fmt::formatter : ostream_formatter {}; template <> -+struct fmt::formatter : ostream_formatter { -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoInstruction &Info, - fmt::format_context &Ctx) const noexcept; ++struct fmt::formatter : ostream_formatter { }; template <> -+struct fmt::formatter : ostream_formatter {}; -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoBoundary &Info, - fmt::format_context &Ctx) const noexcept; -}; ++struct fmt::formatter : ostream_formatter {}; template <> -+struct fmt::formatter : ostream_formatter {}; -+#endif -struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoProposal &Info, - fmt::format_context &Ctx) const noexcept; -}; ---- b/include/common/log.h -+++ a/include/common/log.h ++struct fmt::formatter : ostream_formatter {}; ++#endif +diff --git a/include/common/spdlog.h b/include/common/spdlog.h +index b42970a1..b2940fb0 100644 +--- a/include/common/spdlog.h ++++ b/include/common/spdlog.h @@ -13,8 +13,8 @@ //===----------------------------------------------------------------------===// #pragma once @@ -466,7 +519,7 @@ #include "spdlog/spdlog.h" namespace WasmEdge { -@@ -32,26 +32,3 @@ +@@ -32,26 +32,3 @@ void setErrorLoggingLevel(); } // namespace Log } // namespace WasmEdge @@ -493,19 +546,74 @@ - std::string_view(Quoted.data(), Quoted.size()), Ctx); - } -}; ---- b/include/host/wasi/error.h -+++ a/include/host/wasi/error.h +diff --git a/include/common/types.h b/include/common/types.h +index e0614486..baebaee8 100644 +--- a/include/common/types.h ++++ b/include/common/types.h +@@ -164,6 +164,20 @@ public: + friend bool operator!=(const ValType &LHS, const ValType &RHS) noexcept { + return !(LHS == RHS); + } ++ friend std::ostream &operator<<(std::ostream &OS, const ValType &Type) { ++ // For the number types, print the type directly. ++ if (!Type.isRefType()) { ++ OS << TypeCodeStr[Type.getCode()]; ++ return OS; ++ } ++ // For the reference types, print the details. ++ OS << WasmEdge::TypeCodeStr[Type.getCode()] << " " ++ << WasmEdge::TypeCodeStr[Type.getHeapTypeCode()]; ++ if (Type.getHeapTypeCode() == WasmEdge::TypeCode::TypeIndex) { ++ OS << "[" << Type.getTypeIndex() << "]"; ++ } ++ return OS; ++ } + + TypeCode getCode() const noexcept { return Inner.Data.Code; } + TypeCode getHeapTypeCode() const noexcept { return Inner.Data.HTCode; } +@@ -601,27 +615,3 @@ template inline T &retrieveExternRef(const RefVariant &Val) { + // <<<<<<<< Functions to retrieve reference inners <<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + } // namespace WasmEdge +- +-template <> +-struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ValType &Type, +- fmt::format_context &Ctx) const noexcept { +- using namespace std::literals; +- // For the number types, print the type directly. +- if (!Type.isRefType()) { +- return formatter::format( +- WasmEdge::TypeCodeStr[Type.getCode()], Ctx); +- } +- // For the reference types, print the details. +- fmt::memory_buffer Buffer; +- fmt::format_to(std::back_inserter(Buffer), "{} {}"sv, +- WasmEdge::TypeCodeStr[Type.getCode()], +- WasmEdge::TypeCodeStr[Type.getHeapTypeCode()]); +- if (Type.getHeapTypeCode() == WasmEdge::TypeCode::TypeIndex) { +- fmt::format_to(std::back_inserter(Buffer), "[{}]"sv, Type.getTypeIndex()); +- } +- return formatter::format( +- std::string_view(Buffer.data(), Buffer.size()), Ctx); +- } +-}; +diff --git a/include/host/wasi/error.h b/include/host/wasi/error.h +index 9fc88976..cd779e99 100644 +--- a/include/host/wasi/error.h ++++ b/include/host/wasi/error.h @@ -4,9 +4,7 @@ #pragma once #include "common/expected.h" --#include "common/log.h" +-#include "common/spdlog.h" #include "wasi/api.hpp" -#include namespace WasmEdge { namespace Host { -@@ -26,296 +24,3 @@ +@@ -26,296 +24,3 @@ template constexpr auto WasiUnexpect(const WasiExpect &Val) { } // namespace WASI } // namespace Host } // namespace WasmEdge @@ -802,32 +910,27 @@ - std::string_view(Buffer.data(), Buffer.size()), Ctx); - } -}; ---- b/lib/common/CMakeLists.txt -+++ a/lib/common/CMakeLists.txt -@@ -7,7 +7,7 @@ +diff --git a/lib/common/CMakeLists.txt b/lib/common/CMakeLists.txt +index bf2bf37e..a3c2d861 100644 +--- a/lib/common/CMakeLists.txt ++++ b/lib/common/CMakeLists.txt +@@ -24,7 +24,7 @@ else() FetchContent_Declare( spdlog GIT_REPOSITORY https://github.com/gabime/spdlog.git +- GIT_TAG v1.13.0 + GIT_TAG v1.9.0 -- GIT_TAG v1.11.0 GIT_SHALLOW TRUE ) set(SPDLOG_BUILD_SHARED OFF CACHE BOOL "Build shared library" FORCE) ---- b/lib/common/errinfo.cpp -+++ a/lib/common/errinfo.cpp -@@ -2,316 +2,270 @@ - // SPDX-FileCopyrightText: 2019-2022 Second State INC - - #include "common/errinfo.h" -+ +diff --git a/lib/common/errinfo.cpp b/lib/common/errinfo.cpp +index 188a1836..2dfbff09 100644 +--- a/lib/common/errinfo.cpp ++++ b/lib/common/errinfo.cpp +@@ -5,313 +5,266 @@ #include "common/errcode.h" #include "common/hexstr.h" -+namespace WasmEdge { -+namespace ErrInfo { -+std::ostream &operator<<(std::ostream &OS, const struct InfoFile &Rhs) { -+ OS << " File name: " << Rhs.FileName; -+ return OS; -using namespace std::literals; - -fmt::format_context::iterator @@ -839,11 +942,13 @@ - Info.FileName); - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++namespace WasmEdge { ++namespace ErrInfo { ++std::ostream &operator<<(std::ostream &OS, const struct InfoFile &Rhs) { ++ OS << " File name: " << Rhs.FileName; ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoLoading &Rhs) { -+ OS << " Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); -+ return OS; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoLoading &Info, @@ -853,11 +958,11 @@ - Info.Offset); - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++std::ostream &operator<<(std::ostream &OS, const struct InfoLoading &Rhs) { ++ OS << " Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoAST &Rhs) { -+ OS << " At AST node: " << ASTNodeAttrStr[Rhs.NodeAttr]; -+ return OS; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoAST &Info, @@ -867,13 +972,11 @@ - Info.NodeAttr); - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++std::ostream &operator<<(std::ostream &OS, const struct InfoAST &Rhs) { ++ OS << " At AST node: " << ASTNodeAttrStr[Rhs.NodeAttr]; ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, -+ const struct InfoInstanceBound &Rhs) { -+ OS << " Instance " << ExternalTypeStr[Rhs.Instance] -+ << " has limited number " << Rhs.Limited << " , Got: " << Rhs.Number; -+ return OS; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoInstanceBound &Info, @@ -884,13 +987,13 @@ - Info.Instance, Info.Limited, Info.Number); - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++std::ostream &operator<<(std::ostream &OS, ++ const struct InfoInstanceBound &Rhs) { ++ OS << " Instance " << ExternalTypeStr[Rhs.Instance] ++ << " has limited number " << Rhs.Limited << " , Got: " << Rhs.Number; ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoForbidIndex &Rhs) { -+ OS << " When checking " << IndexCategoryStr[Rhs.Category] -+ << " index: " << Rhs.Index << " , Out of boundary: "; -+ if (Rhs.Boundary > 0) { -+ OS << (Rhs.Boundary - 1); -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoForbidIndex &Info, @@ -902,18 +1005,20 @@ - Info.Category, Info.Index); - if (Info.Boundary > 0) { - fmt::format_to(Iter, "{}"sv, Info.Boundary - 1); ++std::ostream &operator<<(std::ostream &OS, const struct InfoForbidIndex &Rhs) { ++ OS << " When checking " << IndexCategoryStr[Rhs.Category] ++ << " index: " << Rhs.Index << " , Out of boundary: "; ++ if (Rhs.Boundary > 0) { ++ OS << (Rhs.Boundary - 1); } else { -+ OS << "empty"; - fmt::format_to(Iter, "empty"sv); ++ OS << "empty"; } -+ return OS; - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoExporting &Rhs) { -+ OS << " Duplicated exporting name: \"" << Rhs.ExtName << "\""; -+ return OS; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoExporting &Info, @@ -923,12 +1028,11 @@ - " Duplicated exporting name: \"{}\""sv, Info.ExtName); - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++std::ostream &operator<<(std::ostream &OS, const struct InfoExporting &Rhs) { ++ OS << " Duplicated exporting name: \"" << Rhs.ExtName << "\""; ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoLimit &Rhs) { -+ OS << " In Limit type: { min: " << Rhs.LimMin; -+ if (Rhs.LimHasMax) { -+ OS << " , max: " << Rhs.LimMax; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoLimit &Info, @@ -938,17 +1042,18 @@ - " In Limit type: {{ min: {}"sv, Info.LimMin); - if (Info.LimHasMax) { - Iter = fmt::format_to(Iter, " , max: {}"sv, Info.LimMax); ++std::ostream &operator<<(std::ostream &OS, const struct InfoLimit &Rhs) { ++ OS << " In Limit type: { min: " << Rhs.LimMin; ++ if (Rhs.LimHasMax) { ++ OS << " , max: " << Rhs.LimMax; } -+ OS << " }"; -+ return OS; - fmt::format_to(Iter, " }}"sv); - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++ OS << " }"; ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoRegistering &Rhs) { -+ OS << " Module name: \"" << Rhs.ModName << "\""; -+ return OS; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoRegistering &Info, @@ -958,12 +1063,11 @@ - Info.ModName); - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++std::ostream &operator<<(std::ostream &OS, const struct InfoRegistering &Rhs) { ++ OS << " Module name: \"" << Rhs.ModName << "\""; ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoLinking &Rhs) { -+ OS << " When linking module: \"" << Rhs.ModName << "\" , " -+ << ExternalTypeStr[Rhs.ExtType] << " name: \"" << Rhs.ExtName << "\""; -+ return OS; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoLinking &Info, @@ -974,12 +1078,12 @@ - Info.ModName, Info.ExtType, Info.ExtName); - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++std::ostream &operator<<(std::ostream &OS, const struct InfoLinking &Rhs) { ++ OS << " When linking module: \"" << Rhs.ModName << "\" , " ++ << ExternalTypeStr[Rhs.ExtType] << " name: \"" << Rhs.ExtName << "\""; ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoExecuting &Rhs) { -+ OS << " When executing "; -+ if (Rhs.ModName != "") { -+ OS << "module name: \"" << Rhs.ModName << "\" , "; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoExecuting &Info, @@ -989,20 +1093,18 @@ - fmt::format_to(std::back_inserter(Buffer), " When executing "sv); - if (!Info.ModName.empty()) { - Iter = fmt::format_to(Iter, "module name: \"{}\" , "sv, Info.ModName); ++std::ostream &operator<<(std::ostream &OS, const struct InfoExecuting &Rhs) { ++ OS << " When executing "; ++ if (Rhs.ModName != "") { ++ OS << "module name: \"" << Rhs.ModName << "\" , "; } -+ OS << "function name: \"" << Rhs.FuncName << "\""; -+ return OS; - fmt::format_to(Iter, "function name: \"{}\""sv, Info.FuncName); - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++ OS << "function name: \"" << Rhs.FuncName << "\""; ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoMismatch &Rhs) { -+ OS << " Mismatched " << MismatchCategoryStr[Rhs.Category] << ". "; -+ switch (Rhs.Category) { -+ case MismatchCategory::Alignment: -+ OS << "Expected: need to <= " << static_cast(Rhs.ExpAlignment) -+ << " , Got: " << (1UL << Rhs.GotAlignment); -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoMismatch &Info, @@ -1024,79 +1126,55 @@ - fmt::format_to(Iter, "Expected: need to <= {} , Got: {}"sv, - static_cast(Info.ExpAlignment), - 1UL << Info.GotAlignment); ++std::ostream &operator<<(std::ostream &OS, const struct InfoMismatch &Rhs) { ++ OS << " Mismatched " << MismatchCategoryStr[Rhs.Category] << ". "; ++ switch (Rhs.Category) { ++ case MismatchCategory::Alignment: ++ OS << "Expected: need to <= " << static_cast(Rhs.ExpAlignment) ++ << " , Got: " << (1UL << Rhs.GotAlignment); break; -+ case MismatchCategory::ValueType: -+ OS << "Expected: " << ValTypeStr[Rhs.ExpValType] -+ << " , Got: " << ValTypeStr[Rhs.GotValType]; - case WasmEdge::ErrInfo::MismatchCategory::ValueType: - fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpValType, - Info.GotValType); ++ case MismatchCategory::ValueType: ++ OS << "Expected: " << TypeCodeStr[Rhs.ExpValType.getCode()] ++ << " , Got: " << TypeCodeStr[Rhs.GotValType.getCode()]; break; +- case WasmEdge::ErrInfo::MismatchCategory::ValueTypes: +- fmt::format_to(Iter, "Expected: types{{{}}} , Got: types{{{}}}"sv, +- fmt::join(Info.ExpParams, " , "sv), +- fmt::join(Info.GotParams, " , "sv)); + case MismatchCategory::ValueTypes: + OS << "Expected: types{"; + for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { -+ OS << ValTypeStr[Rhs.ExpParams[I]]; ++ OS << TypeCodeStr[Rhs.ExpParams[I].getCode()]; + if (I < Rhs.ExpParams.size() - 1) { + OS << " , "; + } + } + OS << "} , Got: types{"; + for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { -+ OS << ValTypeStr[Rhs.GotParams[I]]; ++ OS << TypeCodeStr[Rhs.GotParams[I].getCode()]; + if (I < Rhs.GotParams.size() - 1) { + OS << " , "; + } + } + OS << "}"; -- case WasmEdge::ErrInfo::MismatchCategory::ValueTypes: -- fmt::format_to(Iter, "Expected: types{{{}}} , Got: types{{{}}}"sv, -- fmt::join(Info.ExpParams, " , "sv), -- fmt::join(Info.GotParams, " , "sv)); break; -+ case MismatchCategory::Mutation: -+ OS << "Expected: " << ValMutStr[Rhs.ExpValMut] -+ << " , Got: " << ValMutStr[Rhs.GotValMut]; - case WasmEdge::ErrInfo::MismatchCategory::Mutation: - fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpValMut, - Info.GotValMut); ++ case MismatchCategory::Mutation: ++ OS << "Expected: " << ValMutStr[Rhs.ExpValMut] ++ << " , Got: " << ValMutStr[Rhs.GotValMut]; break; -+ case MismatchCategory::ExternalType: -+ OS << "Expected: " << ExternalTypeStr[Rhs.ExpExtType] -+ << " , Got: " << ExternalTypeStr[Rhs.GotExtType]; - case WasmEdge::ErrInfo::MismatchCategory::ExternalType: - fmt::format_to(Iter, "Expected: {} , Got: {}", Info.ExpExtType, - Info.GotExtType); ++ case MismatchCategory::ExternalType: ++ OS << "Expected: " << ExternalTypeStr[Rhs.ExpExtType] ++ << " , Got: " << ExternalTypeStr[Rhs.GotExtType]; break; -+ case MismatchCategory::FunctionType: -+ OS << "Expected: FuncType {params{"; -+ for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { -+ OS << ValTypeStr[Rhs.ExpParams[I]]; -+ if (I < Rhs.ExpParams.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "} returns{"; -+ for (uint32_t I = 0; I < Rhs.ExpReturns.size(); ++I) { -+ OS << ValTypeStr[Rhs.ExpReturns[I]]; -+ if (I < Rhs.ExpReturns.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "}} , Got: FuncType {params{"; -+ for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { -+ OS << ValTypeStr[Rhs.GotParams[I]]; -+ if (I < Rhs.GotParams.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "} returns{"; -+ for (uint32_t I = 0; I < Rhs.GotReturns.size(); ++I) { -+ OS << ValTypeStr[Rhs.GotReturns[I]]; -+ if (I < Rhs.GotReturns.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "}}"; - case WasmEdge::ErrInfo::MismatchCategory::FunctionType: - fmt::format_to(Iter, - "Expected: FuncType {{params{{{}}} returns{{{}}}}} , " @@ -1105,30 +1183,66 @@ - fmt::join(Info.ExpReturns, " , "sv), - fmt::join(Info.GotParams, " , "sv), - fmt::join(Info.GotReturns, " , "sv)); ++ case MismatchCategory::FunctionType: ++ OS << "Expected: FuncType {params{"; ++ for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { ++ OS << TypeCodeStr[Rhs.ExpParams[I].getCode()]; ++ if (I < Rhs.ExpParams.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "} returns{"; ++ for (uint32_t I = 0; I < Rhs.ExpReturns.size(); ++I) { ++ OS << TypeCodeStr[Rhs.ExpReturns[I].getCode()]; ++ if (I < Rhs.ExpReturns.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "}} , Got: FuncType {params{"; ++ for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { ++ OS << TypeCodeStr[Rhs.GotParams[I].getCode()]; ++ if (I < Rhs.GotParams.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "} returns{"; ++ for (uint32_t I = 0; I < Rhs.GotReturns.size(); ++I) { ++ OS << TypeCodeStr[Rhs.GotReturns[I].getCode()]; ++ if (I < Rhs.GotReturns.size() - 1) { ++ OS << " , "; ++ } ++ } ++ OS << "}}"; break; +- case WasmEdge::ErrInfo::MismatchCategory::Table: +- Iter = fmt::format_to(Iter, "Expected: TableType {{RefType{{{}}} "sv, +- static_cast(Info.ExpValType)); +- Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); +- Iter = fmt::format_to(Iter, "}} , Got: TableType {{RefType{{{}}} "sv, +- static_cast(Info.GotValType)); +- Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); +- fmt::format_to(Iter, "}}"sv); + case MismatchCategory::Table: + OS << "Expected: TableType {RefType{" -+ << ValTypeStr[static_cast(Rhs.ExpRefType)] << "} Limit{" -+ << Rhs.ExpLimMin; ++ << TypeCodeStr[static_cast(Rhs.ExpValType).getCode()] ++ << "} Limit{" << Rhs.ExpLimMin; + if (Rhs.ExpLimHasMax) { + OS << " , " << Rhs.ExpLimMax; + } + OS << "}} , Got: TableType {RefType{" -+ << ValTypeStr[static_cast(Rhs.GotRefType)] << "} Limit{" -+ << Rhs.GotLimMin; ++ << TypeCodeStr[static_cast(Rhs.GotValType).getCode()] ++ << "} Limit{" << Rhs.GotLimMin; + if (Rhs.GotLimHasMax) { + OS << " , " << Rhs.GotLimMax; + } + OS << "}}"; -- case WasmEdge::ErrInfo::MismatchCategory::Table: -- Iter = fmt::format_to(Iter, "Expected: TableType {{RefType{{{}}} "sv, -- static_cast(Info.ExpRefType)); + break; +- case WasmEdge::ErrInfo::MismatchCategory::Memory: +- Iter = fmt::format_to(Iter, "Expected: MemoryType {{"sv); - Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); -- Iter = fmt::format_to(Iter, "}} , Got: TableType {{RefType{{{}}} "sv, -- static_cast(Info.GotRefType)); +- Iter = fmt::format_to(Iter, "}} , Got: MemoryType {{"sv); - Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); - fmt::format_to(Iter, "}}"sv); - break; + case MismatchCategory::Memory: + OS << "Expected: MemoryType {Limit{" << Rhs.ExpLimMin; + if (Rhs.ExpLimHasMax) { @@ -1139,42 +1253,33 @@ + OS << " , " << Rhs.GotLimMax; + } + OS << "}}"; -- case WasmEdge::ErrInfo::MismatchCategory::Memory: -- Iter = fmt::format_to(Iter, "Expected: MemoryType {{"sv); -- Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); -- Iter = fmt::format_to(Iter, "}} , Got: MemoryType {{"sv); -- Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); -- fmt::format_to(Iter, "}}"sv); break; -+ case MismatchCategory::Global: -+ OS << "Expected: GlobalType {Mutation{" << ValMutStr[Rhs.ExpValMut] -+ << "} ValType{" << ValTypeStr[Rhs.ExpValType] -+ << "}} , Got: GlobalType {Mutation{" << ValMutStr[Rhs.GotValMut] -+ << "} ValType{" << ValTypeStr[Rhs.GotValType] << "}}"; - case WasmEdge::ErrInfo::MismatchCategory::Global: - fmt::format_to(Iter, - "Expected: GlobalType {{Mutation{{{}}} ValType{{{}}}}} , " - "Got: GlobalType {{Mutation{{{}}} ValType{{{}}}}}"sv, - Info.ExpValMut, Info.ExpValType, Info.GotValMut, - Info.GotValType); ++ case MismatchCategory::Global: ++ OS << "Expected: GlobalType {Mutation{" << ValMutStr[Rhs.ExpValMut] ++ << "} ValType{" << TypeCodeStr[Rhs.ExpValType.getCode()] ++ << "}} , Got: GlobalType {Mutation{" << ValMutStr[Rhs.GotValMut] ++ << "} ValType{" << TypeCodeStr[Rhs.GotValType.getCode()] << "}}"; break; -+ case MismatchCategory::Version: -+ OS << "Expected: " << Rhs.ExpVersion << " , Got: " << Rhs.GotVersion; - case WasmEdge::ErrInfo::MismatchCategory::Version: - fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpVersion, - Info.GotVersion); ++ case MismatchCategory::Version: ++ OS << "Expected: " << Rhs.ExpVersion << " , Got: " << Rhs.GotVersion; break; default: break; } -+ return OS; - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoInstruction &Rhs) { -+ uint16_t Payload = static_cast(Rhs.Code); -+ OS << " In instruction: " << OpCodeStr[Rhs.Code] << " ("; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoInstruction &Info, @@ -1183,108 +1288,105 @@ - fmt::memory_buffer Buffer; - auto Iter = fmt::format_to(std::back_inserter(Buffer), - " In instruction: {} ("sv, Info.Code); ++std::ostream &operator<<(std::ostream &OS, const struct InfoInstruction &Rhs) { ++ uint16_t Payload = static_cast(Rhs.Code); ++ OS << " In instruction: " << OpCodeStr[Rhs.Code] << " ("; if ((Payload >> 8) >= static_cast(0xFCU)) { -+ OS << convertUIntToHexStr(Payload >> 8, 2) << " "; - Iter = fmt::format_to(Iter, "0x{:02x} "sv, Payload >> 8); ++ OS << convertUIntToHexStr(Payload >> 8, 2) << " "; } -+ OS << convertUIntToHexStr(Payload & 0xFFU, 2) -+ << ") , Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); -+ if (Rhs.Args.size() > 0) { -+ OS << " , Args: ["; -+ for (uint32_t I = 0; I < Rhs.Args.size(); ++I) { -+ switch (Rhs.ArgsTypes[I]) { -+ case ValType::I32: -+ if (Rhs.IsSigned) { -+ OS << Rhs.Args[I].get(); - Iter = fmt::format_to(Iter, "0x{:02x}) , Bytecode offset: 0x{:08x}"sv, - Payload & 0xFFU, Info.Offset); - if (!Info.Args.empty()) { - Iter = fmt::format_to(Iter, " , Args: ["sv); - for (uint32_t I = 0; I < Info.Args.size(); ++I) { -- switch (Info.ArgsTypes[I]) { -- case WasmEdge::ValType::I32: +- switch (Info.ArgsTypes[I].getCode()) { +- case WasmEdge::TypeCode::I32: - if (Info.IsSigned) { - Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); ++ OS << convertUIntToHexStr(Payload & 0xFFU, 2) ++ << ") , Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); ++ if (Rhs.Args.size() > 0) { ++ OS << " , Args: ["; ++ for (uint32_t I = 0; I < Rhs.Args.size(); ++I) { ++ switch (Rhs.ArgsTypes[I].getCode()) { ++ case TypeCode::I32: ++ if (Rhs.IsSigned) { ++ OS << Rhs.Args[I].get(); } else { -+ OS << Rhs.Args[I].get(); - Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); ++ OS << Rhs.Args[I].get(); } break; -+ case ValType::I64: -+ if (Rhs.IsSigned) { -+ OS << Rhs.Args[I].get(); -- case WasmEdge::ValType::I64: +- case WasmEdge::TypeCode::I64: - if (Info.IsSigned) { - Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); ++ case TypeCode::I64: ++ if (Rhs.IsSigned) { ++ OS << Rhs.Args[I].get(); } else { -+ OS << Rhs.Args[I].get(); - Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); ++ OS << Rhs.Args[I].get(); } break; -+ case ValType::F32: -+ OS << Rhs.Args[I].get(); -- case WasmEdge::ValType::F32: +- case WasmEdge::TypeCode::F32: - Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); ++ case TypeCode::F32: ++ OS << Rhs.Args[I].get(); break; -+ case ValType::F64: -+ OS << Rhs.Args[I].get(); -- case WasmEdge::ValType::F64: +- case WasmEdge::TypeCode::F64: - Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); ++ case TypeCode::F64: ++ OS << Rhs.Args[I].get(); break; -+ case ValType::V128: { -+ const auto Value = Rhs.Args[I].get(); -+ OS << std::hex << Value[0] << Value[1]; -- case WasmEdge::ValType::V128: { +- case WasmEdge::TypeCode::V128: { - const auto Value = Info.Args[I].get(); - Iter = fmt::format_to(Iter, "0x{:08x}{:08x}"sv, Value[1], Value[0]); ++ case TypeCode::V128: { ++ const auto Value = Rhs.Args[I].get(); ++ OS << std::hex << Value[0] << Value[1]; break; } -+ case ValType::FuncRef: -+ OS << ValTypeStr[Rhs.ArgsTypes[I]]; -+ if (isNullRef(Rhs.Args[I])) { -+ OS << ":null"; -- case WasmEdge::ValType::FuncRef: -- case WasmEdge::ValType::ExternRef: +- case WasmEdge::TypeCode::Ref: +- case WasmEdge::TypeCode::RefNull: - Iter = fmt::format_to(Iter, "{}"sv, Info.ArgsTypes[I]); -- if (isNullRef(Info.Args[I])) { +- if (Info.Args[I].get().isNull()) { - Iter = fmt::format_to(Iter, ":null"sv); ++ case TypeCode::FuncRef: ++ OS << TypeCodeStr[Rhs.ArgsTypes[I].getCode()]; ++ if (Rhs.Args[I].get().isNull()) { ++ OS << ":null"; } else { +- Iter = +- fmt::format_to(Iter, ":0x{:08x}"sv, Info.Args[I].get()); + OS << ":" << &Rhs.Args[I].get(); + } + break; -+ case ValType::ExternRef: -+ OS << ValTypeStr[Rhs.ArgsTypes[I]]; -+ if (isNullRef(Rhs.Args[I])) { ++ case TypeCode::ExternRef: ++ OS << TypeCodeStr[Rhs.ArgsTypes[I].getCode()]; ++ if (Rhs.Args[I].get().isNull()) { + OS << ":null"; + } else { + OS << ":" << &Rhs.Args[I].get(); -- Iter = -- fmt::format_to(Iter, ":0x{:08x}"sv, Info.Args[I].get()); } break; default: break; } -+ if (I < Rhs.Args.size() - 1) { -+ OS << " , "; - if (I < Info.Args.size() - 1) { - Iter = fmt::format_to(Iter, " , "sv); ++ if (I < Rhs.Args.size() - 1) { ++ OS << " , "; } } -+ OS << "]"; - Iter = fmt::format_to(Iter, "]"sv); ++ OS << "]"; } -+ return OS; - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoBoundary &Rhs) { -+ OS << " Accessing offset from: " << convertUIntToHexStr(Rhs.Offset) -+ << " to: " -+ << convertUIntToHexStr(Rhs.Offset + Rhs.Size - (Rhs.Size > 0 ? 1 : 0)) -+ << " , Out of boundary: " << convertUIntToHexStr(Rhs.Limit); -+ return OS; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoBoundary &Info, @@ -1298,12 +1400,14 @@ - Info.Limit); - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++std::ostream &operator<<(std::ostream &OS, const struct InfoBoundary &Rhs) { ++ OS << " Accessing offset from: " << convertUIntToHexStr(Rhs.Offset) ++ << " to: " ++ << convertUIntToHexStr(Rhs.Offset + Rhs.Size - (Rhs.Size > 0 ? 1 : 0)) ++ << " , Out of boundary: " << convertUIntToHexStr(Rhs.Limit); ++ return OS; } -+std::ostream &operator<<(std::ostream &OS, const struct InfoProposal &Rhs) { -+ if (auto Iter = ProposalStr.find(Rhs.P); Iter != ProposalStr.end()) { -+ OS << " This instruction or syntax requires enabling proposal " -+ << Iter->second; -fmt::format_context::iterator -fmt::formatter::format( - const WasmEdge::ErrInfo::InfoProposal &Info, @@ -1313,239 +1417,248 @@ - Iter != WasmEdge::ProposalStr.end()) { - fmt::format_to( - std::back_inserter(Buffer), -- " This instruction or syntax requires enabling proposal {}"sv, +- " This instruction or syntax requires enabling {} proposal"sv, - Iter->second); ++std::ostream &operator<<(std::ostream &OS, const struct InfoProposal &Rhs) { ++ if (auto Iter = ProposalStr.find(Rhs.P); Iter != ProposalStr.end()) { ++ OS << " This instruction or syntax requires enabling proposal " ++ << Iter->second; } else { -+ OS << " Unknown proposal, Code " -+ << convertUIntToHexStr(static_cast(Rhs.P)); - fmt::format_to(std::back_inserter(Buffer), - " Unknown proposal, Code 0x{:08x}"sv, - static_cast(Info.P)); ++ OS << " Unknown proposal, Code " ++ << convertUIntToHexStr(static_cast(Rhs.P)); } -+ return OS; - return formatter::format( - std::string_view(Buffer.data(), Buffer.size()), Ctx); ++ return OS; } + +} // namespace ErrInfo +} // namespace WasmEdge ---- b/test/errinfo/errinfoTest.cpp -+++ a/test/errinfo/errinfoTest.cpp -@@ -5,124 +5,122 @@ +diff --git a/test/errinfo/errinfoTest.cpp b/test/errinfo/errinfoTest.cpp +index d074843a..bfc66ef7 100644 +--- a/test/errinfo/errinfoTest.cpp ++++ b/test/errinfo/errinfoTest.cpp +@@ -5,7 +5,7 @@ #include #include -+#include -#include ++#include #include --using namespace std::literals; -- - namespace { + using namespace std::literals; +@@ -14,115 +14,115 @@ namespace { TEST(ErrInfoTest, Info__File) { WasmEdge::ErrInfo::InfoFile Info1("file.txt"); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__Loading) { WasmEdge::ErrInfo::InfoLoading Info1(30); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__AST) { WasmEdge::ErrInfo::InfoAST Info1(WasmEdge::ASTNodeAttr::Module); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__InstanceBound) { WasmEdge::ErrInfo::InfoInstanceBound Info1(WasmEdge::ExternalType::Memory, 2, 1); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__ForbidIndex) { WasmEdge::ErrInfo::InfoForbidIndex Info1( WasmEdge::ErrInfo::IndexCategory::FunctionType, 2, 1); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; WasmEdge::ErrInfo::InfoForbidIndex Info2( WasmEdge::ErrInfo::IndexCategory::Memory, 2, 0); -+ std::cout << Info2 << std::endl; - fmt::print("{}\n"sv, Info2); ++ std::cout << Info2 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__Exporting) { WasmEdge::ErrInfo::InfoExporting Info1("export"); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__Limit) { WasmEdge::ErrInfo::InfoLimit Info1(true, 10, 20); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; WasmEdge::ErrInfo::InfoLimit Info2(false, 30); -+ std::cout << Info2 << std::endl; - fmt::print("{}\n"sv, Info2); ++ std::cout << Info2 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__Registering) { WasmEdge::ErrInfo::InfoRegistering Info1("host_func"); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__Linking) { WasmEdge::ErrInfo::InfoLinking Info1("module", "func"); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__Executing) { WasmEdge::ErrInfo::InfoExecuting Info1("", "func"); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; WasmEdge::ErrInfo::InfoExecuting Info2("module", "func"); -+ std::cout << Info2 << std::endl; - fmt::print("{}\n"sv, Info2); ++ std::cout << Info2 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__Mismatch) { WasmEdge::ErrInfo::InfoMismatch Info1(static_cast(16), 8888); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); - WasmEdge::ErrInfo::InfoMismatch Info2(WasmEdge::ValType::ExternRef, - WasmEdge::ValType::FuncRef); -+ std::cout << Info2 << std::endl; ++ std::cout << Info1 << std::endl; + WasmEdge::ErrInfo::InfoMismatch Info2(WasmEdge::TypeCode::ExternRef, + WasmEdge::TypeCode::FuncRef); - fmt::print("{}\n"sv, Info2); ++ std::cout << Info2 << std::endl; WasmEdge::ErrInfo::InfoMismatch Info3( - {WasmEdge::ValType::I32, WasmEdge::ValType::FuncRef}, - {WasmEdge::ValType::F64, WasmEdge::ValType::ExternRef, - WasmEdge::ValType::V128}); -+ std::cout << Info3 << std::endl; + {WasmEdge::TypeCode::I32, WasmEdge::TypeCode::FuncRef}, + {WasmEdge::TypeCode::F64, WasmEdge::TypeCode::ExternRef, + WasmEdge::TypeCode::V128}); - fmt::print("{}\n"sv, Info3); ++ std::cout << Info3 << std::endl; WasmEdge::ErrInfo::InfoMismatch Info4(WasmEdge::ValMut::Const, WasmEdge::ValMut::Var); -+ std::cout << Info4 << std::endl; - fmt::print("{}\n"sv, Info4); ++ std::cout << Info4 << std::endl; WasmEdge::ErrInfo::InfoMismatch Info5(WasmEdge::ExternalType::Function, WasmEdge::ExternalType::Global); -+ std::cout << Info5 << std::endl; - fmt::print("{}\n"sv, Info5); ++ std::cout << Info5 << std::endl; WasmEdge::ErrInfo::InfoMismatch Info6( - {WasmEdge::ValType::I32, WasmEdge::ValType::FuncRef}, - {WasmEdge::ValType::I64, WasmEdge::ValType::F64}, - {WasmEdge::ValType::F64, WasmEdge::ValType::ExternRef, - WasmEdge::ValType::V128}, - {WasmEdge::ValType::V128}); -+ std::cout << Info6 << std::endl; + {WasmEdge::TypeCode::I32, WasmEdge::TypeCode::FuncRef}, + {WasmEdge::TypeCode::I64, WasmEdge::TypeCode::F64}, + {WasmEdge::TypeCode::F64, WasmEdge::TypeCode::ExternRef, + WasmEdge::TypeCode::V128}, + {WasmEdge::TypeCode::V128}); - fmt::print("{}\n"sv, Info6); - WasmEdge::ErrInfo::InfoMismatch Info7(WasmEdge::RefType::ExternRef, true, 10, - 20, WasmEdge::RefType::FuncRef, true, ++ std::cout << Info6 << std::endl; + WasmEdge::ErrInfo::InfoMismatch Info7(WasmEdge::TypeCode::ExternRef, true, 10, + 20, WasmEdge::TypeCode::FuncRef, true, 20, 50); -+ std::cout << Info7 << std::endl; - fmt::print("{}\n"sv, Info7); - WasmEdge::ErrInfo::InfoMismatch Info8(WasmEdge::RefType::ExternRef, false, 10, - 10, WasmEdge::RefType::FuncRef, false, - 20, 20); -+ std::cout << Info8 << std::endl; ++ std::cout << Info7 << std::endl; + WasmEdge::ErrInfo::InfoMismatch Info8(WasmEdge::TypeCode::ExternRef, false, + 10, 10, WasmEdge::TypeCode::FuncRef, + false, 20, 20); - fmt::print("{}\n"sv, Info8); ++ std::cout << Info8 << std::endl; WasmEdge::ErrInfo::InfoMismatch Info9(true, 10, 20, true, 20, 50); -+ std::cout << Info9 << std::endl; - fmt::print("{}\n"sv, Info9); ++ std::cout << Info9 << std::endl; WasmEdge::ErrInfo::InfoMismatch Info10(false, 10, 10, false, 20, 20); -+ std::cout << Info10 << std::endl; - fmt::print("{}\n"sv, Info10); ++ std::cout << Info10 << std::endl; WasmEdge::ErrInfo::InfoMismatch Info11( - WasmEdge::ValType::I32, WasmEdge::ValMut::Var, WasmEdge::ValType::I64, + WasmEdge::TypeCode::I32, WasmEdge::ValMut::Var, WasmEdge::TypeCode::I64, WasmEdge::ValMut::Const); -+ std::cout << Info11 << std::endl; - fmt::print("{}\n"sv, Info11); ++ std::cout << Info11 << std::endl; WasmEdge::ErrInfo::InfoMismatch Info12(12345678U, 98765432U); -+ std::cout << Info12 << std::endl; - fmt::print("{}\n"sv, Info12); ++ std::cout << Info12 << std::endl; EXPECT_TRUE(true); } -@@ -136,54 +134,54 @@ - WasmEdge::ErrInfo::InfoInstruction Info1( - WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::I32, WasmEdge::ValType::I32, WasmEdge::ValType::I32}); -+ std::cout << Info1 << std::endl; +@@ -137,58 +137,58 @@ TEST(ErrInfoTest, Info__Instruction) { + {WasmEdge::TypeCode::I32, + WasmEdge::TypeCode::I32, + WasmEdge::TypeCode::I32}); - fmt::print("{}\n"sv, Info1); - WasmEdge::ErrInfo::InfoInstruction Info2( - WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::I32, WasmEdge::ValType::I32, WasmEdge::ValType::I32}); -+ std::cout << Info2 << std::endl; ++ std::cout << Info1 << std::endl; + WasmEdge::ErrInfo::InfoInstruction Info2(WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::TypeCode::I32, + WasmEdge::TypeCode::I32, + WasmEdge::TypeCode::I32}); - fmt::print("{}\n"sv, Info2); - WasmEdge::ErrInfo::InfoInstruction Info3( - WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::I64, WasmEdge::ValType::I64, WasmEdge::ValType::I64}); -+ std::cout << Info3 << std::endl; ++ std::cout << Info2 << std::endl; + WasmEdge::ErrInfo::InfoInstruction Info3(WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::TypeCode::I64, + WasmEdge::TypeCode::I64, + WasmEdge::TypeCode::I64}); - fmt::print("{}\n"sv, Info3); - WasmEdge::ErrInfo::InfoInstruction Info4( - WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::F32, WasmEdge::ValType::F32, WasmEdge::ValType::F32}); -+ std::cout << Info4 << std::endl; ++ std::cout << Info3 << std::endl; + WasmEdge::ErrInfo::InfoInstruction Info4(WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::TypeCode::F32, + WasmEdge::TypeCode::F32, + WasmEdge::TypeCode::F32}); - fmt::print("{}\n"sv, Info4); - WasmEdge::ErrInfo::InfoInstruction Info5( - WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::F64, WasmEdge::ValType::F64, WasmEdge::ValType::F64}); -+ std::cout << Info5 << std::endl; ++ std::cout << Info4 << std::endl; + WasmEdge::ErrInfo::InfoInstruction Info5(WasmEdge::OpCode::Block, 255, Args, + {WasmEdge::TypeCode::F64, + WasmEdge::TypeCode::F64, + WasmEdge::TypeCode::F64}); - fmt::print("{}\n"sv, Info5); ++ std::cout << Info5 << std::endl; WasmEdge::ErrInfo::InfoInstruction Info6(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::V128, - WasmEdge::ValType::V128, - WasmEdge::ValType::V128}); -+ std::cout << Info6 << std::endl; + {WasmEdge::TypeCode::V128, + WasmEdge::TypeCode::V128, + WasmEdge::TypeCode::V128}); - fmt::print("{}\n"sv, Info6); ++ std::cout << Info6 << std::endl; WasmEdge::ErrInfo::InfoInstruction Info7(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::FuncRef, - WasmEdge::ValType::FuncRef, - WasmEdge::ValType::FuncRef}); -+ std::cout << Info7 << std::endl; + {WasmEdge::TypeCode::FuncRef, + WasmEdge::TypeCode::FuncRef, + WasmEdge::TypeCode::FuncRef}); - fmt::print("{}\n"sv, Info7); ++ std::cout << Info7 << std::endl; WasmEdge::ErrInfo::InfoInstruction Info8(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::ValType::ExternRef, - WasmEdge::ValType::ExternRef, - WasmEdge::ValType::ExternRef}); -+ std::cout << Info8 << std::endl; + {WasmEdge::TypeCode::ExternRef, + WasmEdge::TypeCode::ExternRef, + WasmEdge::TypeCode::ExternRef}); - fmt::print("{}\n"sv, Info8); ++ std::cout << Info8 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__Boundary) { WasmEdge::ErrInfo::InfoBoundary Info1(3, 5, 2); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; WasmEdge::ErrInfo::InfoBoundary Info2(3, 0, 2); -+ std::cout << Info2 << std::endl; - fmt::print("{}\n"sv, Info2); ++ std::cout << Info2 << std::endl; EXPECT_TRUE(true); } TEST(ErrInfoTest, Info__Proposal) { WasmEdge::ErrInfo::InfoProposal Info1(WasmEdge::Proposal::SIMD); -+ std::cout << Info1 << std::endl; - fmt::print("{}\n"sv, Info1); ++ std::cout << Info1 << std::endl; WasmEdge::ErrInfo::InfoProposal Info2(static_cast(250U)); -+ std::cout << Info2 << std::endl; - fmt::print("{}\n"sv, Info2); ++ std::cout << Info2 << std::endl; EXPECT_TRUE(true); } From e6f0b5ab0dcf5a17d26e15fd5676fe1b65194dfd Mon Sep 17 00:00:00 2001 From: Carl George Date: Tue, 26 Nov 2024 17:09:12 -0600 Subject: [PATCH 13/18] Rebuilt for LLVM 18 --- wasmedge.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wasmedge.spec b/wasmedge.spec index d4b62b9..c517502 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -6,7 +6,7 @@ Name: wasmedge Version: %{version} -Release: 1%{?dist} +Release: 2%{?dist} Summary: High performance WebAssembly Virtual Machine # The entire source code is ASL 2.0 except LICENSE.spdx which is CC0 License: ASL 2.0 and CC0 @@ -109,6 +109,9 @@ cd .. %{_libdir}/lib%{name}.so %changelog +* Tue Nov 26 2024 Carl George - 0.14.0-2 +- Rebuilt for LLVM 18 + * Thu May 30 2024 dm4 - 0.14.0 - Release 0.14.0 * Mon Oct 2 2023 dm4 - 0.13.4 From 70c97ec34a46066c3e92896f35a54ceac265f031 Mon Sep 17 00:00:00 2001 From: Carl George Date: Fri, 18 Jul 2025 01:36:48 -0500 Subject: [PATCH 14/18] Rebuild for LLVM 19 In order to build wasmedge against LLVM 19 (now the default in RHEL 8), we must add a patch from upstream to remove some unused and deprecated functions. Resolves: rhbz#2381863 --- 0001-LLVM-Support-LLVM-19-3809.patch | 33 ++++++++++++++++++++++++++++ wasmedge.spec | 8 ++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 0001-LLVM-Support-LLVM-19-3809.patch diff --git a/0001-LLVM-Support-LLVM-19-3809.patch b/0001-LLVM-Support-LLVM-19-3809.patch new file mode 100644 index 0000000..6c937a5 --- /dev/null +++ b/0001-LLVM-Support-LLVM-19-3809.patch @@ -0,0 +1,33 @@ +From 0ada5daa015f9d4de831b84526693dbd1b7a1951 Mon Sep 17 00:00:00 2001 +From: "Shen-Ta Hsieh(BestSteve)" +Date: Tue, 1 Oct 2024 16:05:58 +0800 +Subject: [PATCH] [LLVM] Support LLVM 19 (#3809) + +* Remove unused and deprecated llvm-c functions + +Signed-off-by: Shen-Ta Hsieh +(cherry picked from commit 4e0f9f1118e278b41e9a02b0e7f42735955815f4) +--- + lib/llvm/llvm.h | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/lib/llvm/llvm.h b/lib/llvm/llvm.h +index 31ac95d4..5b278849 100644 +--- a/lib/llvm/llvm.h ++++ b/lib/llvm/llvm.h +@@ -1228,12 +1228,6 @@ public: + Value createNeg(Value V, const char *Name = "") noexcept { + return LLVMBuildNeg(Ref, V.unwrap(), Name); + } +- Value createNSWNeg(Value V, const char *Name = "") noexcept { +- return LLVMBuildNSWNeg(Ref, V.unwrap(), Name); +- } +- Value createNUWNeg(Value V, const char *Name = "") noexcept { +- return LLVMBuildNUWNeg(Ref, V.unwrap(), Name); +- } + Value createFNeg(Value V, const char *Name = "") noexcept { + return LLVMBuildFNeg(Ref, V.unwrap(), Name); + } +-- +2.50.1 + diff --git a/wasmedge.spec b/wasmedge.spec index c517502..a62f3b7 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -6,7 +6,7 @@ Name: wasmedge Version: %{version} -Release: 2%{?dist} +Release: 3%{?dist} Summary: High performance WebAssembly Virtual Machine # The entire source code is ASL 2.0 except LICENSE.spdx which is CC0 License: ASL 2.0 and CC0 @@ -14,6 +14,8 @@ URL: https://github.com/%{reponame}/%{reponame} Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz # Revert https://github.com/WasmEdge/WasmEdge/pull/2511 for old fmt version Patch0: wasmedge-revert-fmt.patch +# https://github.com/WasmEdge/WasmEdge/pull/3809 +Patch1: 0001-LLVM-Support-LLVM-19-3809.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gcc-toolset-11-toolchain @@ -109,6 +111,10 @@ cd .. %{_libdir}/lib%{name}.so %changelog +* Fri Jul 18 2025 Carl George - 0.14.0-3 +- Add upstream patch for LLVM 19 support +- Rebuild for LLVM 19 rhbz#2381863 + * Tue Nov 26 2024 Carl George - 0.14.0-2 - Rebuilt for LLVM 18 From a88242f02999b987fb5fab94089f262724cb0e9c Mon Sep 17 00:00:00 2001 From: dm4 Date: Fri, 2 Jan 2026 07:50:30 +0000 Subject: [PATCH 15/18] Backport fix for CVE-2025-22921 Resolves: rhbz#2426610 Signed-off-by: dm4 --- ...ne-the-overflow-detection-when-wrapp.patch | 52 +++++++++++++++++++ wasmedge.spec | 9 +++- 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch diff --git a/0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch b/0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch new file mode 100644 index 0000000..c332c3e --- /dev/null +++ b/0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch @@ -0,0 +1,52 @@ +From 37cc9fa19bd23edbbdaa9252059b17f191fa4d17 Mon Sep 17 00:00:00 2001 +From: YiYing He +Date: Wed, 17 Dec 2025 20:27:38 +0800 +Subject: [PATCH] fix(runtime): refine the overflow detection when wrapping + memory instance + +Signed-off-by: YiYing He +--- + include/runtime/instance/memory.h | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/include/runtime/instance/memory.h b/include/runtime/instance/memory.h +index ce511a7b..9d849598 100644 +--- a/include/runtime/instance/memory.h ++++ b/include/runtime/instance/memory.h +@@ -241,14 +241,28 @@ public: + return reinterpret_cast(&DataPtr[Offset]); + } + +- /// Get array of object at specific offset of memory. ++ /// Get array of object with count at specific offset of memory. + template +- Span getSpan(uint32_t Offset, uint32_t Size) const noexcept { +- uint32_t ByteSize = static_cast(sizeof(T) * Size); +- if (unlikely(!checkAccessBound(Offset, ByteSize))) { ++ Span getSpan(uint32_t Offset, uint32_t Count) const noexcept { ++ uint32_t Size; ++#if defined(_MSC_VER) && !defined(__clang__) // MSVC ++ // Should extend for memory64 proposal. ++ uint64_t Num = ++ static_cast(sizeof(T)) * static_cast(Count); ++ if ((Num >> 32) != 0) { ++ return Span(); ++ } ++ Size = static_cast(Num); ++#else ++ if (unlikely(__builtin_mul_overflow(static_cast(sizeof(T)), Count, ++ &Size))) { ++ return Span(); ++ } ++#endif ++ if (unlikely(!checkAccessBound(Offset, Size))) { + return Span(); + } +- return Span(reinterpret_cast(&DataPtr[Offset]), Size); ++ return Span(reinterpret_cast(&DataPtr[Offset]), Count); + } + + /// Get array of object at specific offset of memory. +-- +2.43.0 + diff --git a/wasmedge.spec b/wasmedge.spec index a62f3b7..0eb6f15 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -6,7 +6,7 @@ Name: wasmedge Version: %{version} -Release: 3%{?dist} +Release: 4%{?dist} Summary: High performance WebAssembly Virtual Machine # The entire source code is ASL 2.0 except LICENSE.spdx which is CC0 License: ASL 2.0 and CC0 @@ -14,8 +14,10 @@ URL: https://github.com/%{reponame}/%{reponame} Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz # Revert https://github.com/WasmEdge/WasmEdge/pull/2511 for old fmt version Patch0: wasmedge-revert-fmt.patch +# Patch from https://github.com/WasmEdge/WasmEdge/commit/37cc9fa19bd23edbbdaa9252059b17f191fa4d17 +Patch1: 0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch # https://github.com/WasmEdge/WasmEdge/pull/3809 -Patch1: 0001-LLVM-Support-LLVM-19-3809.patch +Patch2: 0001-LLVM-Support-LLVM-19-3809.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gcc-toolset-11-toolchain @@ -111,6 +113,9 @@ cd .. %{_libdir}/lib%{name}.so %changelog +* Mon Jan 05 2026 dm4 - 0.14.0-4 +- Backport fix for CVE-2025-22921 + * Fri Jul 18 2025 Carl George - 0.14.0-3 - Add upstream patch for LLVM 19 support - Rebuild for LLVM 19 rhbz#2381863 From 19e3585e9024975ec3079979d62b85d262cf6d52 Mon Sep 17 00:00:00 2001 From: dm4 Date: Mon, 5 Jan 2026 08:22:19 +0000 Subject: [PATCH 16/18] Add support for LLVM20 Signed-off-by: dm4 --- ...MXTypeKind-is-removed-in-LLVM20-4064.patch | 28 +++++++++++++++++++ wasmedge.spec | 8 ++++-- 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 0001-LLVM-LLVMX86_MMXTypeKind-is-removed-in-LLVM20-4064.patch diff --git a/0001-LLVM-LLVMX86_MMXTypeKind-is-removed-in-LLVM20-4064.patch b/0001-LLVM-LLVMX86_MMXTypeKind-is-removed-in-LLVM20-4064.patch new file mode 100644 index 0000000..5a95793 --- /dev/null +++ b/0001-LLVM-LLVMX86_MMXTypeKind-is-removed-in-LLVM20-4064.patch @@ -0,0 +1,28 @@ +From b63e201d46452453ee7c2acf07967cd292d7e3da Mon Sep 17 00:00:00 2001 +From: hydai +Date: Wed, 19 Mar 2025 12:57:06 +0800 +Subject: [PATCH] [LLVM] LLVMX86_MMXTypeKind is removed in LLVM20 (#4064) + +Signed-off-by: hydai +--- + lib/llvm/llvm.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/llvm/llvm.h b/lib/llvm/llvm.h +index 9b08d97b..7b0bb53e 100644 +--- a/lib/llvm/llvm.h ++++ b/lib/llvm/llvm.h +@@ -556,8 +556,10 @@ public: + return 128; + case LLVMPPC_FP128TypeKind: + return 128; ++#if LLVM_VERSION_MAJOR < 20 + case LLVMX86_MMXTypeKind: + return 64; ++#endif + case LLVMIntegerTypeKind: + return getIntegerBitWidth(); + case LLVMVectorTypeKind: +-- +2.43.0 + diff --git a/wasmedge.spec b/wasmedge.spec index 0eb6f15..09bd52e 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -14,10 +14,12 @@ URL: https://github.com/%{reponame}/%{reponame} Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz # Revert https://github.com/WasmEdge/WasmEdge/pull/2511 for old fmt version Patch0: wasmedge-revert-fmt.patch -# Patch from https://github.com/WasmEdge/WasmEdge/commit/37cc9fa19bd23edbbdaa9252059b17f191fa4d17 -Patch1: 0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch # https://github.com/WasmEdge/WasmEdge/pull/3809 -Patch2: 0001-LLVM-Support-LLVM-19-3809.patch +Patch1: 0001-LLVM-Support-LLVM-19-3809.patch +# Patch from https://github.com/WasmEdge/WasmEdge/commit/b63e201d46452453ee7c2acf07967cd292d7e3da +Patch2: 0001-LLVM-LLVMX86_MMXTypeKind-is-removed-in-LLVM20-4064.patch +# Patch from https://github.com/WasmEdge/WasmEdge/commit/37cc9fa19bd23edbbdaa9252059b17f191fa4d17 +Patch3: 0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gcc-toolset-11-toolchain From 6b8e25c33fc06ba2b5ea2bdb2aa9fa85b67e4de3 Mon Sep 17 00:00:00 2001 From: hydai Date: Tue, 2 Jun 2026 10:29:15 +0000 Subject: [PATCH 17/18] Update to 0.17.0 Add fmt 6 / spdlog 1.5 compatibility patch (Patch0) for EPEL 8. RHEL 8 ships fmt 6.2.1 and spdlog 1.5.0, older than upstream expects; the patch uses conditional guards only (FMT_VERSION / __has_include) with no behavior change on newer fmt. Drops the previous revert-fmt and LLVM 19/20 backport patches, which 0.17.0 no longer needs. Signed-off-by: hydai --- ...MXTypeKind-is-removed-in-LLVM20-4064.patch | 28 - 0001-LLVM-Support-LLVM-19-3809.patch | 33 - ...ne-the-overflow-detection-when-wrapp.patch | 52 - 0001-fmt6-compat.patch | 559 ++++++ sources | 4 + wasmedge-revert-fmt.patch | 1664 ----------------- wasmedge.spec | 35 +- 7 files changed, 587 insertions(+), 1788 deletions(-) delete mode 100644 0001-LLVM-LLVMX86_MMXTypeKind-is-removed-in-LLVM20-4064.patch delete mode 100644 0001-LLVM-Support-LLVM-19-3809.patch delete mode 100644 0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch create mode 100644 0001-fmt6-compat.patch delete mode 100644 wasmedge-revert-fmt.patch diff --git a/0001-LLVM-LLVMX86_MMXTypeKind-is-removed-in-LLVM20-4064.patch b/0001-LLVM-LLVMX86_MMXTypeKind-is-removed-in-LLVM20-4064.patch deleted file mode 100644 index 5a95793..0000000 --- a/0001-LLVM-LLVMX86_MMXTypeKind-is-removed-in-LLVM20-4064.patch +++ /dev/null @@ -1,28 +0,0 @@ -From b63e201d46452453ee7c2acf07967cd292d7e3da Mon Sep 17 00:00:00 2001 -From: hydai -Date: Wed, 19 Mar 2025 12:57:06 +0800 -Subject: [PATCH] [LLVM] LLVMX86_MMXTypeKind is removed in LLVM20 (#4064) - -Signed-off-by: hydai ---- - lib/llvm/llvm.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/lib/llvm/llvm.h b/lib/llvm/llvm.h -index 9b08d97b..7b0bb53e 100644 ---- a/lib/llvm/llvm.h -+++ b/lib/llvm/llvm.h -@@ -556,8 +556,10 @@ public: - return 128; - case LLVMPPC_FP128TypeKind: - return 128; -+#if LLVM_VERSION_MAJOR < 20 - case LLVMX86_MMXTypeKind: - return 64; -+#endif - case LLVMIntegerTypeKind: - return getIntegerBitWidth(); - case LLVMVectorTypeKind: --- -2.43.0 - diff --git a/0001-LLVM-Support-LLVM-19-3809.patch b/0001-LLVM-Support-LLVM-19-3809.patch deleted file mode 100644 index 6c937a5..0000000 --- a/0001-LLVM-Support-LLVM-19-3809.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0ada5daa015f9d4de831b84526693dbd1b7a1951 Mon Sep 17 00:00:00 2001 -From: "Shen-Ta Hsieh(BestSteve)" -Date: Tue, 1 Oct 2024 16:05:58 +0800 -Subject: [PATCH] [LLVM] Support LLVM 19 (#3809) - -* Remove unused and deprecated llvm-c functions - -Signed-off-by: Shen-Ta Hsieh -(cherry picked from commit 4e0f9f1118e278b41e9a02b0e7f42735955815f4) ---- - lib/llvm/llvm.h | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/lib/llvm/llvm.h b/lib/llvm/llvm.h -index 31ac95d4..5b278849 100644 ---- a/lib/llvm/llvm.h -+++ b/lib/llvm/llvm.h -@@ -1228,12 +1228,6 @@ public: - Value createNeg(Value V, const char *Name = "") noexcept { - return LLVMBuildNeg(Ref, V.unwrap(), Name); - } -- Value createNSWNeg(Value V, const char *Name = "") noexcept { -- return LLVMBuildNSWNeg(Ref, V.unwrap(), Name); -- } -- Value createNUWNeg(Value V, const char *Name = "") noexcept { -- return LLVMBuildNUWNeg(Ref, V.unwrap(), Name); -- } - Value createFNeg(Value V, const char *Name = "") noexcept { - return LLVMBuildFNeg(Ref, V.unwrap(), Name); - } --- -2.50.1 - diff --git a/0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch b/0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch deleted file mode 100644 index c332c3e..0000000 --- a/0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 37cc9fa19bd23edbbdaa9252059b17f191fa4d17 Mon Sep 17 00:00:00 2001 -From: YiYing He -Date: Wed, 17 Dec 2025 20:27:38 +0800 -Subject: [PATCH] fix(runtime): refine the overflow detection when wrapping - memory instance - -Signed-off-by: YiYing He ---- - include/runtime/instance/memory.h | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) - -diff --git a/include/runtime/instance/memory.h b/include/runtime/instance/memory.h -index ce511a7b..9d849598 100644 ---- a/include/runtime/instance/memory.h -+++ b/include/runtime/instance/memory.h -@@ -241,14 +241,28 @@ public: - return reinterpret_cast(&DataPtr[Offset]); - } - -- /// Get array of object at specific offset of memory. -+ /// Get array of object with count at specific offset of memory. - template -- Span getSpan(uint32_t Offset, uint32_t Size) const noexcept { -- uint32_t ByteSize = static_cast(sizeof(T) * Size); -- if (unlikely(!checkAccessBound(Offset, ByteSize))) { -+ Span getSpan(uint32_t Offset, uint32_t Count) const noexcept { -+ uint32_t Size; -+#if defined(_MSC_VER) && !defined(__clang__) // MSVC -+ // Should extend for memory64 proposal. -+ uint64_t Num = -+ static_cast(sizeof(T)) * static_cast(Count); -+ if ((Num >> 32) != 0) { -+ return Span(); -+ } -+ Size = static_cast(Num); -+#else -+ if (unlikely(__builtin_mul_overflow(static_cast(sizeof(T)), Count, -+ &Size))) { -+ return Span(); -+ } -+#endif -+ if (unlikely(!checkAccessBound(Offset, Size))) { - return Span(); - } -- return Span(reinterpret_cast(&DataPtr[Offset]), Size); -+ return Span(reinterpret_cast(&DataPtr[Offset]), Count); - } - - /// Get array of object at specific offset of memory. --- -2.43.0 - diff --git a/0001-fmt6-compat.patch b/0001-fmt6-compat.patch new file mode 100644 index 0000000..97a53f9 --- /dev/null +++ b/0001-fmt6-compat.patch @@ -0,0 +1,559 @@ +diff --git a/include/ast/type.h b/include/ast/type.h +index 03fbf53ef..81399e0a7 100644 +--- a/include/ast/type.h ++++ b/include/ast/type.h +@@ -797,9 +797,9 @@ private: + template <> + struct fmt::formatter + : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::AST::FunctionType &Type, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::AST::FunctionType &Type, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + using namespace std::literals; + + fmt::memory_buffer Buffer; +diff --git a/include/common/enum_ast.hpp b/include/common/enum_ast.hpp +index 2535559a1..fab6bca27 100644 +--- a/include/common/enum_ast.hpp ++++ b/include/common/enum_ast.hpp +@@ -133,9 +133,9 @@ static inline constexpr const auto ComponentCanonOptCodeStr = []() constexpr { + template <> + struct fmt::formatter + : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ASTNodeAttr &Attr, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::ASTNodeAttr &Attr, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + return formatter::format(WasmEdge::ASTNodeAttrStr[Attr], + Ctx); + } +@@ -143,9 +143,9 @@ struct fmt::formatter + + template <> + struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::OpCode &Code, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::OpCode &Code, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + return formatter::format(WasmEdge::OpCodeStr[Code], Ctx); + } + }; +diff --git a/include/common/enum_errcode.hpp b/include/common/enum_errcode.hpp +index 71fa512b0..dcaeb77d0 100644 +--- a/include/common/enum_errcode.hpp ++++ b/include/common/enum_errcode.hpp +@@ -151,9 +151,9 @@ static inline constexpr const auto ErrCodeStr = []() constexpr { + + template <> + struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::WasmPhase &Phase, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::WasmPhase &Phase, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + return formatter::format(WasmEdge::WasmPhaseStr[Phase], + Ctx); + } +diff --git a/include/common/enum_errinfo.hpp b/include/common/enum_errinfo.hpp +index 48b7c094f..13847b090 100644 +--- a/include/common/enum_errinfo.hpp ++++ b/include/common/enum_errinfo.hpp +@@ -110,9 +110,9 @@ static inline constexpr auto IndexCategoryStr = []() constexpr { + template <> + struct fmt::formatter + : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::PtrType &Type, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::ErrInfo::PtrType &Type, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + return formatter::format( + WasmEdge::ErrInfo::PtrTypeStr[Type], Ctx); + } +@@ -121,9 +121,9 @@ struct fmt::formatter + template <> + struct fmt::formatter + : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::MismatchCategory &Category, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::ErrInfo::MismatchCategory &Category, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + return formatter::format( + WasmEdge::ErrInfo::MismatchCategoryStr[Category], Ctx); + } +@@ -132,9 +132,9 @@ struct fmt::formatter + template <> + struct fmt::formatter + : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrInfo::IndexCategory &Category, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::ErrInfo::IndexCategory &Category, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + return formatter::format( + WasmEdge::ErrInfo::IndexCategoryStr[Category], Ctx); + } +diff --git a/include/common/enum_types.hpp b/include/common/enum_types.hpp +index c73f151b1..769b0e71b 100644 +--- a/include/common/enum_types.hpp ++++ b/include/common/enum_types.hpp +@@ -111,8 +111,8 @@ static inline constexpr const auto ComponentTypeCodeStr = []() constexpr { + + template <> + struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ValMut &Mut, fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::ValMut &Mut, FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + return formatter::format(WasmEdge::ValMutStr[Mut], Ctx); + } + }; +@@ -120,9 +120,9 @@ struct fmt::formatter : fmt::formatter { + template <> + struct fmt::formatter + : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ExternalType &Type, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::ExternalType &Type, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + return formatter::format(WasmEdge::ExternalTypeStr[Type], + Ctx); + } +diff --git a/include/common/errcode.h b/include/common/errcode.h +index 2661c5207..2e5f8688d 100644 +--- a/include/common/errcode.h ++++ b/include/common/errcode.h +@@ -60,9 +60,9 @@ template constexpr auto Unexpect(const Expect &Val) { + + template <> + struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrCode &Code, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::ErrCode &Code, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + using namespace std::literals; + std::string Output = + fmt::format("{} failed: {}, Code: 0x{:03x}"sv, Code.getErrCodePhase(), +@@ -74,9 +74,9 @@ struct fmt::formatter : fmt::formatter { + template <> + struct fmt::formatter + : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ErrCode::Value &Value, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::ErrCode::Value &Value, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + return formatter::format(WasmEdge::ErrCode(Value), Ctx); + } + }; +diff --git a/include/common/errinfo.h b/include/common/errinfo.h +index 251a85215..1176a3948 100644 +--- a/include/common/errinfo.h ++++ b/include/common/errinfo.h +@@ -270,94 +270,94 @@ template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoFile &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoLoading &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoAST &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoInstanceBound &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoForbidIndex &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoExporting &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoLimit &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoRegistering &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoLinking &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoExecuting &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoMismatch &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoInstruction &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoBoundary &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; + template <> + struct fmt::formatter + : fmt::formatter { + fmt::format_context::iterator + format(const WasmEdge::ErrInfo::InfoProposal &Info, +- fmt::format_context &Ctx) const noexcept; ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; + }; +diff --git a/include/common/int128.h b/include/common/int128.h +index 40f49e727..71a2b7133 100644 +--- a/include/common/int128.h ++++ b/include/common/int128.h +@@ -554,7 +554,14 @@ using uint128_t = uint128; + + #include + ++#if FMT_VERSION >= 80000 ++#define WASMEDGE_FMT_CONST const ++#else ++#define WASMEDGE_FMT_CONST ++#endif ++ + FMT_BEGIN_NAMESPACE ++#if FMT_VERSION >= 90000 + namespace detail { + inline constexpr bool operator>=(detail::uint128_fallback LHS, + unsigned int RHS) { +@@ -668,7 +675,9 @@ FMT_CONSTEXPR20 inline int count_digits(detail::uint128_fallback N) { + } + + } // namespace detail ++#endif + ++#if FMT_VERSION >= 80000 + template struct formatter { + private: + detail::dynamic_format_specs Specs; +@@ -713,4 +722,27 @@ public: + #endif + } + }; ++#else ++template struct formatter { ++ template ++ constexpr auto parse(ParseContext &Ctx) -> decltype(Ctx.begin()) { ++ return Ctx.begin(); ++ } ++ template ++ auto format(WasmEdge::uint128 V, FormatContext &Ctx) -> decltype(Ctx.out()) { ++ char Buf[40]; ++ char *Pos = Buf + sizeof(Buf); ++ const WasmEdge::uint128 Ten(10U); ++ do { ++ *--Pos = static_cast('0' + (V % Ten).low()); ++ V /= Ten; ++ } while (V != WasmEdge::uint128(0U)); ++ auto Out = Ctx.out(); ++ for (const char *It = Pos; It != Buf + sizeof(Buf); ++It) { ++ *Out++ = *It; ++ } ++ return Out; ++ } ++}; ++#endif + FMT_END_NAMESPACE +diff --git a/include/common/spdlog.h b/include/common/spdlog.h +index c94931c55..5c80be269 100644 +--- a/include/common/spdlog.h ++++ b/include/common/spdlog.h +@@ -49,8 +49,9 @@ void setLoggingCallback( + template <> + struct fmt::formatter + : fmt::formatter { +- fmt::format_context::iterator format(const std::filesystem::path &Path, +- fmt::format_context &Ctx) const { ++ template ++ auto format(const std::filesystem::path &Path, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST -> decltype(Ctx.out()) { + // mimic std::quoted + constexpr const char Delimiter = '"'; + constexpr const char Escape = '\\'; +diff --git a/include/common/types.h b/include/common/types.h +index de5d23764..188a0a58a 100644 +--- a/include/common/types.h ++++ b/include/common/types.h +@@ -788,9 +788,9 @@ private: + + template <> + struct fmt::formatter : fmt::formatter { +- fmt::format_context::iterator +- format(const WasmEdge::ValType &Type, +- fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(const WasmEdge::ValType &Type, ++ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + using namespace std::literals; + // For the number types, print the type directly. + if (!Type.isRefType()) { +diff --git a/include/host/wasi/error.h b/include/host/wasi/error.h +index 7ff181be2..6f0bda102 100644 +--- a/include/host/wasi/error.h ++++ b/include/host/wasi/error.h +@@ -29,8 +29,8 @@ template constexpr auto WasiUnexpect(const WasiExpect &Val) { + + template <> + struct fmt::formatter<__wasi_errno_t> : fmt::formatter { +- fmt::format_context::iterator +- format(__wasi_errno_t ErrNo, fmt::format_context &Ctx) const noexcept { ++ template ++ auto format(__wasi_errno_t ErrNo, FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { + fmt::memory_buffer Buffer; + using namespace std::literals; + auto Iter = std::back_inserter(Buffer); +diff --git a/lib/common/errinfo.cpp b/lib/common/errinfo.cpp +index 71400642d..27d4aabd4 100644 +--- a/lib/common/errinfo.cpp ++++ b/lib/common/errinfo.cpp +@@ -7,14 +7,18 @@ + #include "common/int128.h" + + #include ++#if __has_include() + #include ++#else ++#include ++#endif + + using namespace std::literals; + + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoFile &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + fmt::format_to(std::back_inserter(Buffer), " File name: {}"sv, + Info.FileName); +@@ -25,7 +29,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoLoading &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + fmt::format_to(std::back_inserter(Buffer), " Bytecode offset: 0x{:08x}"sv, + Info.Offset); +@@ -36,7 +40,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoAST &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + fmt::format_to(std::back_inserter(Buffer), " At AST node: {}"sv, + Info.NodeAttr); +@@ -47,7 +51,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoInstanceBound &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + fmt::format_to(std::back_inserter(Buffer), + " Instance {} has limited number {} , Got: {}"sv, +@@ -59,7 +63,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoForbidIndex &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + auto Iter = + fmt::format_to(std::back_inserter(Buffer), +@@ -77,7 +81,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoExporting &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + fmt::format_to(std::back_inserter(Buffer), + " Duplicated exporting name: \"{}\""sv, Info.ExtName); +@@ -88,7 +92,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoLimit &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + auto Iter = fmt::format_to(std::back_inserter(Buffer), + " In Limit type: {{ min: {}"sv, Info.LimMin); +@@ -103,7 +107,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoRegistering &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + fmt::format_to(std::back_inserter(Buffer), " Module name: \"{}\""sv, + Info.ModName); +@@ -114,7 +118,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoLinking &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + fmt::format_to(std::back_inserter(Buffer), + " When linking module: \"{}\" , {} name: \"{}\""sv, +@@ -126,7 +130,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoExecuting &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + auto Iter = + fmt::format_to(std::back_inserter(Buffer), " When executing "sv); +@@ -141,7 +145,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoMismatch &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + auto Iter = fmt::format_to(std::back_inserter(Buffer), + " Mismatched {}. "sv, Info.Category); +@@ -229,7 +233,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoInstruction &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + uint16_t Payload = static_cast(Info.Code); + fmt::memory_buffer Buffer; + auto Iter = fmt::format_to(std::back_inserter(Buffer), +@@ -294,7 +298,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoBoundary &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + WasmEdge::uint128_t OffFrom = Info.Offset; + if (Info.IsOffsetOverflow) { +@@ -347,7 +351,7 @@ fmt::formatter::format( + fmt::format_context::iterator + fmt::formatter::format( + const WasmEdge::ErrInfo::InfoProposal &Info, +- fmt::format_context &Ctx) const noexcept { ++ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { + fmt::memory_buffer Buffer; + if (auto Iter = WasmEdge::ProposalStr.find(Info.P); + Iter != WasmEdge::ProposalStr.end()) { +diff --git a/lib/common/spdlog.cpp b/lib/common/spdlog.cpp +index 39ba477bb..39f6a7ff8 100644 +--- a/lib/common/spdlog.cpp ++++ b/lib/common/spdlog.cpp +@@ -9,7 +9,30 @@ + // https://github.com/gabime/spdlog/pull/3198 + #pragma clang diagnostic ignored "-Wextra-semi" + #endif ++#if __has_include() + #include ++#else ++// Fallback for spdlog without callback_sink.h (e.g. RHEL 9 / EPEL 9 spdlog 1.10). ++#include ++#include ++#include ++namespace spdlog::sinks { ++template class callback_sink final : public base_sink { ++public: ++ explicit callback_sink( ++ std::function Callback) ++ : Cb(std::move(Callback)) {} ++ ++protected: ++ void sink_it_(const details::log_msg &Msg) override { Cb(Msg); } ++ void flush_() override {} ++ ++private: ++ std::function Cb; ++}; ++using callback_sink_mt = callback_sink; ++} // namespace spdlog::sinks ++#endif + #if defined(__clang_major__) && __clang_major__ >= 10 + #pragma clang diagnostic pop + #endif diff --git a/sources b/sources index b22ae72..d2f6a58 100644 --- a/sources +++ b/sources @@ -10,3 +10,7 @@ SHA512 (WasmEdge-0.13.3-src.tar.gz) = b8b2e1974fd2ca5bfa0b10311812b69a2a0d2b9864 SHA512 (WasmEdge-0.13.4-src.tar.gz) = ec9b7d1d5eddeb263e4fd00b11e0cac8e11e73a00db0a53ef01ade13518841823274d5ad85be005a82cf8c58a5bec7a8ad6e54358abe4a784439692afbe43fcf SHA512 (WasmEdge-0.13.5-src.tar.gz) = 9d3ece45897d2c9bb3848662fc4ab36c2e0f178450b00f7ea7d183b7162d150d1306e1781b2542463993bab2ec6732def8d63be20ec192b18d93d98c537fb48a SHA512 (WasmEdge-0.14.0-src.tar.gz) = fa9ab14f1c477e1909efe88d760a2ab9212687328a885054f0830284bc71d559ab5263eefbbc564d88280b3907d5e3145ffeff87830eb13ad1f3fc4a599e4340 +SHA512 (WasmEdge-0.14.1-src.tar.gz) = cf708ad789c8d7cb8b5885d6b13dbb010fa433e93971fedb0c05dd2794ad69d79b08535c854ea8744243ff65c61f0de1b6e3fe2a981b69fc92701b4675cc80d4 +SHA512 (WasmEdge-0.15.0-src.tar.gz) = 3a41f362852dd04dc441ebe10fac266703bb146100cceec64df3fce76f57960ac7dacfc9c1243f4177899a5c4d50166158908b0ec4e88e3f226cad2fd350e6cd +SHA512 (WasmEdge-0.16.1-src.tar.gz) = b09c8d83e3627085382109ea073ecc099b57e109b419171a29ab780ee36b371de9bd1864d478c15324f29baabd0c19dda8a32a37f46a738f39e47ef6d51a0770 +SHA512 (WasmEdge-0.17.0-src.tar.gz) = 3e0f9739c7cd5af4ad1e54ed009719c8e4d3d4bfc821103bd954f5bc662381278f97078b4d177f4fae599b3a199b55b6e1fd81ce75ab7711921779db2e89d567 diff --git a/wasmedge-revert-fmt.patch b/wasmedge-revert-fmt.patch deleted file mode 100644 index dc6716a..0000000 --- a/wasmedge-revert-fmt.patch +++ /dev/null @@ -1,1664 +0,0 @@ -diff --git a/include/common/enum_ast.hpp b/include/common/enum_ast.hpp -index be41833a..b7d0acc6 100644 ---- a/include/common/enum_ast.hpp -+++ b/include/common/enum_ast.hpp -@@ -19,7 +19,6 @@ - - #include "common/dense_enum_map.h" - #include "common/spare_enum_map.h" --#include "common/spdlog.h" - - #include - #include -@@ -46,7 +45,8 @@ static inline constexpr auto ASTNodeAttrStr = []() constexpr { - #undef UseASTNodeAttr - }; - return DenseEnumMap(Array); --}(); -+} -+(); - - /// Instruction opcode enumeration class. - enum class OpCode : uint32_t { -@@ -84,26 +84,7 @@ static inline constexpr const auto OpCodeStr = []() constexpr { - #undef UseOpCode - }; - return SpareEnumMap(Array); --}(); -+} -+(); - - } // namespace WasmEdge -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ASTNodeAttr &Attr, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::ASTNodeAttrStr[Attr], -- Ctx); -- } --}; -- --template <> --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::OpCode &Code, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::OpCodeStr[Code], Ctx); -- } --}; -diff --git a/include/common/enum_errcode.hpp b/include/common/enum_errcode.hpp -index a50f49df..80f24bbf 100644 ---- a/include/common/enum_errcode.hpp -+++ b/include/common/enum_errcode.hpp -@@ -16,7 +16,6 @@ - - #include "common/dense_enum_map.h" - #include "common/spare_enum_map.h" --#include "common/spdlog.h" - - #include - #include -@@ -42,7 +41,8 @@ static inline constexpr auto WasmPhaseStr = []() constexpr { - #undef UseWasmPhase - }; - return DenseEnumMap(Array); --}(); -+} -+(); - - /// Error category C++ enumeration class. - enum class ErrCategory : uint8_t { -@@ -75,11 +75,6 @@ public: - ? ErrCode::Value::UserDefError - : static_cast(getCode()); - } -- constexpr WasmPhase getErrCodePhase() const noexcept { -- return getCategory() != ErrCategory::WASM -- ? WasmPhase::UserDefined -- : static_cast((getCode() >> 8) & 0x0FU); -- } - - constexpr ErrCode() noexcept : Inner(0) {} - constexpr ErrCode(const ErrCode &E) noexcept : Inner(E.Inner.Num) {} -@@ -136,16 +131,7 @@ static inline constexpr const auto ErrCodeStr = []() constexpr { - #undef UseErrCode - }; - return SpareEnumMap(Array); --}(); -+} -+(); - - } // namespace WasmEdge -- --template <> --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::WasmPhase &Phase, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::WasmPhaseStr[Phase], -- Ctx); -- } --}; -diff --git a/include/common/enum_errinfo.hpp b/include/common/enum_errinfo.hpp -index f385010a..15f3ab1f 100644 ---- a/include/common/enum_errinfo.hpp -+++ b/include/common/enum_errinfo.hpp -@@ -109,36 +109,3 @@ static inline constexpr auto IndexCategoryStr = []() constexpr { - - } // namespace ErrInfo - } // namespace WasmEdge -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::PtrType &Type, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format( -- WasmEdge::ErrInfo::PtrTypeStr[Type], Ctx); -- } --}; -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::MismatchCategory &Category, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format( -- WasmEdge::ErrInfo::MismatchCategoryStr[Category], Ctx); -- } --}; -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::IndexCategory &Category, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format( -- WasmEdge::ErrInfo::IndexCategoryStr[Category], Ctx); -- } --}; -diff --git a/include/common/enum_types.hpp b/include/common/enum_types.hpp -index 340e8ec1..ffd5d9f5 100644 ---- a/include/common/enum_types.hpp -+++ b/include/common/enum_types.hpp -@@ -42,7 +42,8 @@ static inline constexpr const auto TypeCodeStr = []() constexpr { - #undef UseTypeCode - }; - return SpareEnumMap(Array); --}(); -+} -+(); - - /// WASM Mutability C++ enumeration class. - enum class ValMut : uint8_t { -@@ -63,7 +64,8 @@ static inline constexpr auto ValMutStr = []() constexpr { - #undef UseValMut - }; - return DenseEnumMap(Array); --}(); -+} -+(); - - /// WASM External type C++ enumeration class. - enum class ExternalType : uint8_t { -@@ -84,25 +86,7 @@ static inline constexpr auto ExternalTypeStr = []() constexpr { - #undef UseExternalType - }; - return DenseEnumMap(Array); --}(); -+} -+(); - - } // namespace WasmEdge -- --template <> --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ValMut &Mut, fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::ValMutStr[Mut], Ctx); -- } --}; -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ExternalType &Type, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::ExternalTypeStr[Type], -- Ctx); -- } --}; -diff --git a/include/common/errcode.h b/include/common/errcode.h -index 4f73a121..a0e5dd89 100644 ---- a/include/common/errcode.h -+++ b/include/common/errcode.h -@@ -37,6 +37,20 @@ - - namespace WasmEdge { - -+static inline WasmPhase getErrCodePhase(const ErrCode &Code) { -+ return static_cast(Code.getCategory() == ErrCategory::WASM -+ ? ((Code.getCode() & 0xF0U) >> 5) -+ : 0x05U // WasmPhase::UserDefined -+ ); -+} -+ -+static inline std::ostream &operator<<(std::ostream &OS, const ErrCode &Code) { -+ OS << WasmPhaseStr[getErrCodePhase(Code)] -+ << " failed: " << ErrCodeStr[Code.getEnum()] -+ << ", Code: " << convertUIntToHexStr(Code.getCode(), 2); -+ return OS; -+} -+ - static inline constexpr bool likely(bool V) noexcept { - return __builtin_expect(V, true); - } -@@ -58,25 +72,7 @@ template constexpr auto Unexpect(const Expect &Val) { - - } // namespace WasmEdge - -+#if FMT_VERSION >= 90000 - template <> --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrCode &Code, -- fmt::format_context &Ctx) const noexcept { -- using namespace std::literals; -- std::string Output = -- fmt::format("{} failed: {}, Code: 0x{:03x}"sv, Code.getErrCodePhase(), -- WasmEdge::ErrCodeStr[Code.getEnum()], Code.getCode()); -- return formatter::format(Output, Ctx); -- } --}; -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrCode::Value &Value, -- fmt::format_context &Ctx) const noexcept { -- return formatter::format(WasmEdge::ErrCode(Value), Ctx); -- } --}; -+struct fmt::formatter : ostream_formatter {}; -+#endif -diff --git a/include/common/errinfo.h b/include/common/errinfo.h -index a18bb1c3..45f3761c 100644 ---- a/include/common/errinfo.h -+++ b/include/common/errinfo.h -@@ -37,6 +37,8 @@ struct InfoFile { - InfoFile() = delete; - InfoFile(const std::filesystem::path &FName) noexcept : FileName(FName) {} - -+ friend std::ostream &operator<<(std::ostream &OS, const struct InfoFile &Rhs); -+ - std::filesystem::path FileName; - }; - -@@ -44,6 +46,9 @@ struct InfoLoading { - InfoLoading() = delete; - InfoLoading(const uint64_t Off) noexcept : Offset(Off) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoLoading &Rhs); -+ - uint64_t Offset; - }; - -@@ -51,6 +56,8 @@ struct InfoAST { - InfoAST() = delete; - InfoAST(const ASTNodeAttr Attr) noexcept : NodeAttr(Attr) {} - -+ friend std::ostream &operator<<(std::ostream &OS, const struct InfoAST &Rhs); -+ - ASTNodeAttr NodeAttr; - }; - -@@ -60,6 +67,9 @@ struct InfoInstanceBound { - const uint32_t Lim) noexcept - : Instance(Inst), Number(Num), Limited(Lim) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoInstanceBound &Rhs); -+ - ExternalType Instance; - uint32_t Number, Limited; - }; -@@ -70,6 +80,9 @@ struct InfoForbidIndex { - const uint32_t Bound) noexcept - : Category(Cate), Index(Idx), Boundary(Bound) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoForbidIndex &Rhs); -+ - IndexCategory Category; - uint32_t Index, Boundary; - }; -@@ -78,6 +91,9 @@ struct InfoExporting { - InfoExporting() = delete; - InfoExporting(std::string_view Ext) noexcept : ExtName(Ext) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoExporting &Rhs); -+ - std::string ExtName; - }; - -@@ -87,6 +103,9 @@ struct InfoLimit { - const uint32_t Max = 0) noexcept - : LimHasMax(HasMax), LimMin(Min), LimMax(Max) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoLimit &Rhs); -+ - bool LimHasMax; - uint32_t LimMin, LimMax; - }; -@@ -95,6 +114,9 @@ struct InfoRegistering { - InfoRegistering() = delete; - InfoRegistering(std::string_view Mod) noexcept : ModName(Mod) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoRegistering &Rhs); -+ - std::string ModName; - }; - -@@ -104,6 +126,9 @@ struct InfoLinking { - const ExternalType ExtT = ExternalType::Function) noexcept - : ModName(Mod), ExtName(Ext), ExtType(ExtT) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoLinking &Rhs); -+ - std::string ModName; - std::string ExtName; - ExternalType ExtType; -@@ -115,6 +140,9 @@ struct InfoExecuting { - : ModName(Mod), FuncName(Func) {} - InfoExecuting(std::string_view Func) noexcept : ModName(""), FuncName(Func) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoExecuting &Rhs); -+ - std::string ModName; - std::string FuncName; - }; -@@ -196,6 +224,9 @@ struct InfoMismatch { - : Category(MismatchCategory::Version), ExpVersion(ExpV), - GotVersion(GotV) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoMismatch &Rhs); -+ - /// Mismatched category - MismatchCategory Category; - -@@ -236,6 +267,9 @@ struct InfoInstruction { - : Code(Op), Offset(Off), Args(ArgsVec), ArgsTypes(ArgsTypesVec), - IsSigned(Signed) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoInstruction &Rhs); -+ - OpCode Code; - uint64_t Offset; - std::vector Args; -@@ -250,6 +284,9 @@ struct InfoBoundary { - const uint32_t Lim = std::numeric_limits::max()) noexcept - : Offset(Off), Size(Len), Limit(Lim) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoBoundary &Rhs); -+ - uint64_t Offset; - uint32_t Size; - uint32_t Limit; -@@ -259,104 +296,46 @@ struct InfoProposal { - InfoProposal() = delete; - InfoProposal(Proposal P) noexcept : P(P) {} - -+ friend std::ostream &operator<<(std::ostream &OS, -+ const struct InfoProposal &Rhs); -+ - Proposal P; - }; - - } // namespace ErrInfo - } // namespace WasmEdge - -+#if FMT_VERSION >= 90000 - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoFile &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+struct fmt::formatter : ostream_formatter {}; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoLoading &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+struct fmt::formatter : ostream_formatter {}; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoAST &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+struct fmt::formatter : ostream_formatter {}; - template <> - struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoInstanceBound &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+ : ostream_formatter {}; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoForbidIndex &Info, -- fmt::format_context &Ctx) const noexcept; -+struct fmt::formatter : ostream_formatter { - }; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoExporting &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+struct fmt::formatter : ostream_formatter {}; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoLimit &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+struct fmt::formatter : ostream_formatter {}; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoRegistering &Info, -- fmt::format_context &Ctx) const noexcept; -+struct fmt::formatter : ostream_formatter { - }; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoLinking &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+struct fmt::formatter : ostream_formatter {}; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoExecuting &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+struct fmt::formatter : ostream_formatter {}; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoMismatch &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+struct fmt::formatter : ostream_formatter {}; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoInstruction &Info, -- fmt::format_context &Ctx) const noexcept; -+struct fmt::formatter : ostream_formatter { - }; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoBoundary &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+struct fmt::formatter : ostream_formatter {}; - template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::InfoProposal &Info, -- fmt::format_context &Ctx) const noexcept; --}; -+struct fmt::formatter : ostream_formatter {}; -+#endif -diff --git a/include/common/spdlog.h b/include/common/spdlog.h -index b42970a1..b2940fb0 100644 ---- a/include/common/spdlog.h -+++ b/include/common/spdlog.h -@@ -13,8 +13,8 @@ - //===----------------------------------------------------------------------===// - #pragma once - --#include "common/filesystem.h" - #define SPDLOG_NO_EXCEPTIONS 1 -+#include "spdlog/fmt/ostr.h" - #include "spdlog/spdlog.h" - - namespace WasmEdge { -@@ -32,26 +32,3 @@ void setErrorLoggingLevel(); - - } // namespace Log - } // namespace WasmEdge -- --template <> --struct fmt::formatter -- : fmt::formatter { -- fmt::format_context::iterator format(const std::filesystem::path &Path, -- fmt::format_context &Ctx) const { -- // mimic std::quoted -- constexpr const char Delimiter = '"'; -- constexpr const char Escape = '\\'; -- auto Quoted = fmt::memory_buffer(); -- auto Iter = std::back_inserter(Quoted); -- *Iter++ = Delimiter; -- for (const auto C : Path.u8string()) { -- if (C == Delimiter || C == Escape) { -- *Iter++ = Escape; -- } -- *Iter++ = C; -- } -- *Iter++ = Delimiter; -- return fmt::formatter::format( -- std::string_view(Quoted.data(), Quoted.size()), Ctx); -- } --}; -diff --git a/include/common/types.h b/include/common/types.h -index e0614486..baebaee8 100644 ---- a/include/common/types.h -+++ b/include/common/types.h -@@ -164,6 +164,20 @@ public: - friend bool operator!=(const ValType &LHS, const ValType &RHS) noexcept { - return !(LHS == RHS); - } -+ friend std::ostream &operator<<(std::ostream &OS, const ValType &Type) { -+ // For the number types, print the type directly. -+ if (!Type.isRefType()) { -+ OS << TypeCodeStr[Type.getCode()]; -+ return OS; -+ } -+ // For the reference types, print the details. -+ OS << WasmEdge::TypeCodeStr[Type.getCode()] << " " -+ << WasmEdge::TypeCodeStr[Type.getHeapTypeCode()]; -+ if (Type.getHeapTypeCode() == WasmEdge::TypeCode::TypeIndex) { -+ OS << "[" << Type.getTypeIndex() << "]"; -+ } -+ return OS; -+ } - - TypeCode getCode() const noexcept { return Inner.Data.Code; } - TypeCode getHeapTypeCode() const noexcept { return Inner.Data.HTCode; } -@@ -601,27 +615,3 @@ template inline T &retrieveExternRef(const RefVariant &Val) { - // <<<<<<<< Functions to retrieve reference inners <<<<<<<<<<<<<<<<<<<<<<<<<<<<< - - } // namespace WasmEdge -- --template <> --struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ValType &Type, -- fmt::format_context &Ctx) const noexcept { -- using namespace std::literals; -- // For the number types, print the type directly. -- if (!Type.isRefType()) { -- return formatter::format( -- WasmEdge::TypeCodeStr[Type.getCode()], Ctx); -- } -- // For the reference types, print the details. -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), "{} {}"sv, -- WasmEdge::TypeCodeStr[Type.getCode()], -- WasmEdge::TypeCodeStr[Type.getHeapTypeCode()]); -- if (Type.getHeapTypeCode() == WasmEdge::TypeCode::TypeIndex) { -- fmt::format_to(std::back_inserter(Buffer), "[{}]"sv, Type.getTypeIndex()); -- } -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -- } --}; -diff --git a/include/host/wasi/error.h b/include/host/wasi/error.h -index 9fc88976..cd779e99 100644 ---- a/include/host/wasi/error.h -+++ b/include/host/wasi/error.h -@@ -4,9 +4,7 @@ - #pragma once - - #include "common/expected.h" --#include "common/spdlog.h" - #include "wasi/api.hpp" --#include - - namespace WasmEdge { - namespace Host { -@@ -26,296 +24,3 @@ template constexpr auto WasiUnexpect(const WasiExpect &Val) { - } // namespace WASI - } // namespace Host - } // namespace WasmEdge -- --template <> --struct fmt::formatter<__wasi_errno_t> : fmt::formatter { -- fmt::format_context::iterator -- format(__wasi_errno_t ErrNo, fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- using namespace std::literals; -- auto Iter = std::back_inserter(Buffer); -- switch (ErrNo) { -- case __WASI_ERRNO_SUCCESS: -- fmt::format_to( -- Iter, "No error occurred. System call completed successfully."sv); -- break; -- case __WASI_ERRNO_2BIG: -- fmt::format_to(Iter, "Argument list too long."sv); -- break; -- case __WASI_ERRNO_ACCES: -- fmt::format_to(Iter, "Permission denied."sv); -- break; -- case __WASI_ERRNO_ADDRINUSE: -- fmt::format_to(Iter, "Address in use."sv); -- break; -- case __WASI_ERRNO_ADDRNOTAVAIL: -- fmt::format_to(Iter, "Address not available."sv); -- break; -- case __WASI_ERRNO_AFNOSUPPORT: -- fmt::format_to(Iter, "Address family not supported."sv); -- break; -- case __WASI_ERRNO_AGAIN: -- fmt::format_to(Iter, "Resource unavailable, or operation would block."sv); -- break; -- case __WASI_ERRNO_ALREADY: -- fmt::format_to(Iter, "Connection already in progress."sv); -- break; -- case __WASI_ERRNO_BADF: -- fmt::format_to(Iter, "Bad file descriptor."sv); -- break; -- case __WASI_ERRNO_BADMSG: -- fmt::format_to(Iter, "Bad message."sv); -- break; -- case __WASI_ERRNO_BUSY: -- fmt::format_to(Iter, "Device or resource busy."sv); -- break; -- case __WASI_ERRNO_CANCELED: -- fmt::format_to(Iter, "Operation canceled."sv); -- break; -- case __WASI_ERRNO_CHILD: -- fmt::format_to(Iter, "No child processes."sv); -- break; -- case __WASI_ERRNO_CONNABORTED: -- fmt::format_to(Iter, "Connection aborted."sv); -- break; -- case __WASI_ERRNO_CONNREFUSED: -- fmt::format_to(Iter, "Connection refused."sv); -- break; -- case __WASI_ERRNO_CONNRESET: -- fmt::format_to(Iter, "Connection reset."sv); -- break; -- case __WASI_ERRNO_DEADLK: -- fmt::format_to(Iter, "Resource deadlock would occur."sv); -- break; -- case __WASI_ERRNO_DESTADDRREQ: -- fmt::format_to(Iter, "Destination address required."sv); -- break; -- case __WASI_ERRNO_DOM: -- fmt::format_to(Iter, "Mathematics argument out of domain of function."sv); -- break; -- case __WASI_ERRNO_DQUOT: -- fmt::format_to(Iter, "Reserved."sv); -- break; -- case __WASI_ERRNO_EXIST: -- fmt::format_to(Iter, "File exists."sv); -- break; -- case __WASI_ERRNO_FAULT: -- fmt::format_to(Iter, "Bad address."sv); -- break; -- case __WASI_ERRNO_FBIG: -- fmt::format_to(Iter, "File too large."sv); -- break; -- case __WASI_ERRNO_HOSTUNREACH: -- fmt::format_to(Iter, "Host is unreachable."sv); -- break; -- case __WASI_ERRNO_IDRM: -- fmt::format_to(Iter, "Identifier removed."sv); -- break; -- case __WASI_ERRNO_ILSEQ: -- fmt::format_to(Iter, "Illegal byte sequence."sv); -- break; -- case __WASI_ERRNO_INPROGRESS: -- fmt::format_to(Iter, "Operation in progress."sv); -- break; -- case __WASI_ERRNO_INTR: -- fmt::format_to(Iter, "Interrupted function."sv); -- break; -- case __WASI_ERRNO_INVAL: -- fmt::format_to(Iter, "Invalid argument."sv); -- break; -- case __WASI_ERRNO_IO: -- fmt::format_to(Iter, "I/O error."sv); -- break; -- case __WASI_ERRNO_ISCONN: -- fmt::format_to(Iter, "Socket is connected."sv); -- break; -- case __WASI_ERRNO_ISDIR: -- fmt::format_to(Iter, "Is a directory."sv); -- break; -- case __WASI_ERRNO_LOOP: -- fmt::format_to(Iter, "Too many levels of symbolic links."sv); -- break; -- case __WASI_ERRNO_MFILE: -- fmt::format_to(Iter, "File descriptor value too large."sv); -- break; -- case __WASI_ERRNO_MLINK: -- fmt::format_to(Iter, "Too many links."sv); -- break; -- case __WASI_ERRNO_MSGSIZE: -- fmt::format_to(Iter, "Message too large."sv); -- break; -- case __WASI_ERRNO_MULTIHOP: -- fmt::format_to(Iter, "Reserved."sv); -- break; -- case __WASI_ERRNO_NAMETOOLONG: -- fmt::format_to(Iter, "Filename too long."sv); -- break; -- case __WASI_ERRNO_NETDOWN: -- fmt::format_to(Iter, "Network is down."sv); -- break; -- case __WASI_ERRNO_NETRESET: -- fmt::format_to(Iter, "Connection aborted by network."sv); -- break; -- case __WASI_ERRNO_NETUNREACH: -- fmt::format_to(Iter, "Network unreachable."sv); -- break; -- case __WASI_ERRNO_NFILE: -- fmt::format_to(Iter, "Too many files open in system."sv); -- break; -- case __WASI_ERRNO_NOBUFS: -- fmt::format_to(Iter, "No buffer space available."sv); -- break; -- case __WASI_ERRNO_NODEV: -- fmt::format_to(Iter, "No such device."sv); -- break; -- case __WASI_ERRNO_NOENT: -- fmt::format_to(Iter, "No such file or directory."sv); -- break; -- case __WASI_ERRNO_NOEXEC: -- fmt::format_to(Iter, "Executable file format error."sv); -- break; -- case __WASI_ERRNO_NOLCK: -- fmt::format_to(Iter, "No locks available."sv); -- break; -- case __WASI_ERRNO_NOLINK: -- fmt::format_to(Iter, "Reserved."sv); -- break; -- case __WASI_ERRNO_NOMEM: -- fmt::format_to(Iter, "Not enough space."sv); -- break; -- case __WASI_ERRNO_NOMSG: -- fmt::format_to(Iter, "No message of the desired type."sv); -- break; -- case __WASI_ERRNO_NOPROTOOPT: -- fmt::format_to(Iter, "Protocol not available."sv); -- break; -- case __WASI_ERRNO_NOSPC: -- fmt::format_to(Iter, "No space left on device."sv); -- break; -- case __WASI_ERRNO_NOSYS: -- fmt::format_to(Iter, "Function not supported."sv); -- break; -- case __WASI_ERRNO_NOTCONN: -- fmt::format_to(Iter, "The socket is not connected."sv); -- break; -- case __WASI_ERRNO_NOTDIR: -- fmt::format_to(Iter, -- "Not a directory or a symbolic link to a directory."sv); -- break; -- case __WASI_ERRNO_NOTEMPTY: -- fmt::format_to(Iter, "Directory not empty."sv); -- break; -- case __WASI_ERRNO_NOTRECOVERABLE: -- fmt::format_to(Iter, "State not recoverable."sv); -- break; -- case __WASI_ERRNO_NOTSOCK: -- fmt::format_to(Iter, "Not a socket."sv); -- break; -- case __WASI_ERRNO_NOTSUP: -- fmt::format_to(Iter, -- "Not supported, or operation not supported on socket."sv); -- break; -- case __WASI_ERRNO_NOTTY: -- fmt::format_to(Iter, "Inappropriate I/O control operation."sv); -- break; -- case __WASI_ERRNO_NXIO: -- fmt::format_to(Iter, "No such device or address."sv); -- break; -- case __WASI_ERRNO_OVERFLOW: -- fmt::format_to(Iter, "Value too large to be stored in data type."sv); -- break; -- case __WASI_ERRNO_OWNERDEAD: -- fmt::format_to(Iter, "Previous owner died."sv); -- break; -- case __WASI_ERRNO_PERM: -- fmt::format_to(Iter, "Operation not permitted."sv); -- break; -- case __WASI_ERRNO_PIPE: -- fmt::format_to(Iter, "Broken pipe."sv); -- break; -- case __WASI_ERRNO_PROTO: -- fmt::format_to(Iter, "Protocol error."sv); -- break; -- case __WASI_ERRNO_PROTONOSUPPORT: -- fmt::format_to(Iter, "Protocol not supported."sv); -- break; -- case __WASI_ERRNO_PROTOTYPE: -- fmt::format_to(Iter, "Protocol wrong type for socket."sv); -- break; -- case __WASI_ERRNO_RANGE: -- fmt::format_to(Iter, "Result too large."sv); -- break; -- case __WASI_ERRNO_ROFS: -- fmt::format_to(Iter, "Read-only file system."sv); -- break; -- case __WASI_ERRNO_SPIPE: -- fmt::format_to(Iter, "Invalid seek."sv); -- break; -- case __WASI_ERRNO_SRCH: -- fmt::format_to(Iter, "No such process."sv); -- break; -- case __WASI_ERRNO_STALE: -- fmt::format_to(Iter, "Reserved."sv); -- break; -- case __WASI_ERRNO_TIMEDOUT: -- fmt::format_to(Iter, "Connection timed out."sv); -- break; -- case __WASI_ERRNO_TXTBSY: -- fmt::format_to(Iter, "Text file busy."sv); -- break; -- case __WASI_ERRNO_XDEV: -- fmt::format_to(Iter, "Cross-device link."sv); -- break; -- case __WASI_ERRNO_NOTCAPABLE: -- fmt::format_to(Iter, "Extension: Capabilities insufficient."sv); -- break; -- case __WASI_ERRNO_AIADDRFAMILY: -- fmt::format_to(Iter, -- "The specified network host does not have any network " -- "addresses in the requested address family."sv); -- break; -- case __WASI_ERRNO_AIAGAIN: -- fmt::format_to(Iter, "Try again later."sv); -- break; -- case __WASI_ERRNO_AIBADFLAG: -- fmt::format_to(Iter, "Hints.ai_flags contains invalid flags"sv); -- break; -- case __WASI_ERRNO_AIFAIL: -- fmt::format_to( -- Iter, "The name server returned a permanent failure indication."sv); -- break; -- case __WASI_ERRNO_AIFAMILY: -- fmt::format_to(Iter, "The requested address family is not supported."sv); -- break; -- case __WASI_ERRNO_AIMEMORY: -- fmt::format_to(Iter, "Addrinfo out of memory."sv); -- break; -- case __WASI_ERRNO_AINODATA: -- fmt::format_to(Iter, "Network host exists, but does not have any network " -- "addresses defined."sv); -- break; -- case __WASI_ERRNO_AINONAME: -- fmt::format_to( -- Iter, -- "Node or service is not known; or both node and service are NULL."sv); -- break; -- case __WASI_ERRNO_AISERVICE: -- fmt::format_to( -- Iter, "Service is not available for the requested socket type."sv); -- break; -- case __WASI_ERRNO_AISOCKTYPE: -- fmt::format_to(Iter, "The requested socket type is not supported."sv); -- break; -- case __WASI_ERRNO_AISYSTEM: -- fmt::format_to(Iter, "Other system error."sv); -- break; -- default: -- fmt::format_to( -- Iter, "Unknown error code {}"sv, -- static_cast>(ErrNo)); -- break; -- } -- return fmt::formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -- } --}; -diff --git a/lib/common/CMakeLists.txt b/lib/common/CMakeLists.txt -index bf2bf37e..a3c2d861 100644 ---- a/lib/common/CMakeLists.txt -+++ b/lib/common/CMakeLists.txt -@@ -24,7 +24,7 @@ else() - FetchContent_Declare( - spdlog - GIT_REPOSITORY https://github.com/gabime/spdlog.git -- GIT_TAG v1.13.0 -+ GIT_TAG v1.9.0 - GIT_SHALLOW TRUE - ) - set(SPDLOG_BUILD_SHARED OFF CACHE BOOL "Build shared library" FORCE) -diff --git a/lib/common/errinfo.cpp b/lib/common/errinfo.cpp -index 188a1836..2dfbff09 100644 ---- a/lib/common/errinfo.cpp -+++ b/lib/common/errinfo.cpp -@@ -5,313 +5,266 @@ - #include "common/errcode.h" - #include "common/hexstr.h" - --using namespace std::literals; -- --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoFile &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), " File name: {}"sv, -- Info.FileName); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+namespace WasmEdge { -+namespace ErrInfo { -+std::ostream &operator<<(std::ostream &OS, const struct InfoFile &Rhs) { -+ OS << " File name: " << Rhs.FileName; -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoLoading &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), " Bytecode offset: 0x{:08x}"sv, -- Info.Offset); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+std::ostream &operator<<(std::ostream &OS, const struct InfoLoading &Rhs) { -+ OS << " Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoAST &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), " At AST node: {}"sv, -- Info.NodeAttr); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+std::ostream &operator<<(std::ostream &OS, const struct InfoAST &Rhs) { -+ OS << " At AST node: " << ASTNodeAttrStr[Rhs.NodeAttr]; -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoInstanceBound &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), -- " Instance {} has limited number {} , Got: {}"sv, -- Info.Instance, Info.Limited, Info.Number); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+std::ostream &operator<<(std::ostream &OS, -+ const struct InfoInstanceBound &Rhs) { -+ OS << " Instance " << ExternalTypeStr[Rhs.Instance] -+ << " has limited number " << Rhs.Limited << " , Got: " << Rhs.Number; -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoForbidIndex &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- auto Iter = -- fmt::format_to(std::back_inserter(Buffer), -- " When checking {} index: {} , Out of boundary: "sv, -- Info.Category, Info.Index); -- if (Info.Boundary > 0) { -- fmt::format_to(Iter, "{}"sv, Info.Boundary - 1); -+std::ostream &operator<<(std::ostream &OS, const struct InfoForbidIndex &Rhs) { -+ OS << " When checking " << IndexCategoryStr[Rhs.Category] -+ << " index: " << Rhs.Index << " , Out of boundary: "; -+ if (Rhs.Boundary > 0) { -+ OS << (Rhs.Boundary - 1); - } else { -- fmt::format_to(Iter, "empty"sv); -+ OS << "empty"; - } -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoExporting &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), -- " Duplicated exporting name: \"{}\""sv, Info.ExtName); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+std::ostream &operator<<(std::ostream &OS, const struct InfoExporting &Rhs) { -+ OS << " Duplicated exporting name: \"" << Rhs.ExtName << "\""; -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoLimit &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- auto Iter = fmt::format_to(std::back_inserter(Buffer), -- " In Limit type: {{ min: {}"sv, Info.LimMin); -- if (Info.LimHasMax) { -- Iter = fmt::format_to(Iter, " , max: {}"sv, Info.LimMax); -+std::ostream &operator<<(std::ostream &OS, const struct InfoLimit &Rhs) { -+ OS << " In Limit type: { min: " << Rhs.LimMin; -+ if (Rhs.LimHasMax) { -+ OS << " , max: " << Rhs.LimMax; - } -- fmt::format_to(Iter, " }}"sv); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+ OS << " }"; -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoRegistering &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), " Module name: \"{}\""sv, -- Info.ModName); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+std::ostream &operator<<(std::ostream &OS, const struct InfoRegistering &Rhs) { -+ OS << " Module name: \"" << Rhs.ModName << "\""; -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoLinking &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), -- " When linking module: \"{}\" , {} name: \"{}\""sv, -- Info.ModName, Info.ExtType, Info.ExtName); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+std::ostream &operator<<(std::ostream &OS, const struct InfoLinking &Rhs) { -+ OS << " When linking module: \"" << Rhs.ModName << "\" , " -+ << ExternalTypeStr[Rhs.ExtType] << " name: \"" << Rhs.ExtName << "\""; -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoExecuting &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- auto Iter = -- fmt::format_to(std::back_inserter(Buffer), " When executing "sv); -- if (!Info.ModName.empty()) { -- Iter = fmt::format_to(Iter, "module name: \"{}\" , "sv, Info.ModName); -+std::ostream &operator<<(std::ostream &OS, const struct InfoExecuting &Rhs) { -+ OS << " When executing "; -+ if (Rhs.ModName != "") { -+ OS << "module name: \"" << Rhs.ModName << "\" , "; - } -- fmt::format_to(Iter, "function name: \"{}\""sv, Info.FuncName); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+ OS << "function name: \"" << Rhs.FuncName << "\""; -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoMismatch &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- auto Iter = fmt::format_to(std::back_inserter(Buffer), -- " Mismatched {}. "sv, Info.Category); -- auto FormatLimit = [](auto Out, bool LimHasMax, uint32_t LimMin, -- uint32_t LimMax) { -- Out = fmt::format_to(Out, "Limit{{{}"sv, LimMin); -- if (LimHasMax) { -- Out = fmt::format_to(Out, " , {}"sv, LimMax); -- } -- Out = fmt::format_to(Out, "}}"sv); -- return Out; -- }; -- switch (Info.Category) { -- case WasmEdge::ErrInfo::MismatchCategory::Alignment: -- fmt::format_to(Iter, "Expected: need to <= {} , Got: {}"sv, -- static_cast(Info.ExpAlignment), -- 1UL << Info.GotAlignment); -+std::ostream &operator<<(std::ostream &OS, const struct InfoMismatch &Rhs) { -+ OS << " Mismatched " << MismatchCategoryStr[Rhs.Category] << ". "; -+ switch (Rhs.Category) { -+ case MismatchCategory::Alignment: -+ OS << "Expected: need to <= " << static_cast(Rhs.ExpAlignment) -+ << " , Got: " << (1UL << Rhs.GotAlignment); - break; -- case WasmEdge::ErrInfo::MismatchCategory::ValueType: -- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpValType, -- Info.GotValType); -+ case MismatchCategory::ValueType: -+ OS << "Expected: " << TypeCodeStr[Rhs.ExpValType.getCode()] -+ << " , Got: " << TypeCodeStr[Rhs.GotValType.getCode()]; - break; -- case WasmEdge::ErrInfo::MismatchCategory::ValueTypes: -- fmt::format_to(Iter, "Expected: types{{{}}} , Got: types{{{}}}"sv, -- fmt::join(Info.ExpParams, " , "sv), -- fmt::join(Info.GotParams, " , "sv)); -+ case MismatchCategory::ValueTypes: -+ OS << "Expected: types{"; -+ for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { -+ OS << TypeCodeStr[Rhs.ExpParams[I].getCode()]; -+ if (I < Rhs.ExpParams.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "} , Got: types{"; -+ for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { -+ OS << TypeCodeStr[Rhs.GotParams[I].getCode()]; -+ if (I < Rhs.GotParams.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "}"; - break; -- case WasmEdge::ErrInfo::MismatchCategory::Mutation: -- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpValMut, -- Info.GotValMut); -+ case MismatchCategory::Mutation: -+ OS << "Expected: " << ValMutStr[Rhs.ExpValMut] -+ << " , Got: " << ValMutStr[Rhs.GotValMut]; - break; -- case WasmEdge::ErrInfo::MismatchCategory::ExternalType: -- fmt::format_to(Iter, "Expected: {} , Got: {}", Info.ExpExtType, -- Info.GotExtType); -+ case MismatchCategory::ExternalType: -+ OS << "Expected: " << ExternalTypeStr[Rhs.ExpExtType] -+ << " , Got: " << ExternalTypeStr[Rhs.GotExtType]; - break; -- case WasmEdge::ErrInfo::MismatchCategory::FunctionType: -- fmt::format_to(Iter, -- "Expected: FuncType {{params{{{}}} returns{{{}}}}} , " -- "Got: FuncType {{params{{{}}} returns{{{}}}}}"sv, -- fmt::join(Info.ExpParams, " , "sv), -- fmt::join(Info.ExpReturns, " , "sv), -- fmt::join(Info.GotParams, " , "sv), -- fmt::join(Info.GotReturns, " , "sv)); -+ case MismatchCategory::FunctionType: -+ OS << "Expected: FuncType {params{"; -+ for (uint32_t I = 0; I < Rhs.ExpParams.size(); ++I) { -+ OS << TypeCodeStr[Rhs.ExpParams[I].getCode()]; -+ if (I < Rhs.ExpParams.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "} returns{"; -+ for (uint32_t I = 0; I < Rhs.ExpReturns.size(); ++I) { -+ OS << TypeCodeStr[Rhs.ExpReturns[I].getCode()]; -+ if (I < Rhs.ExpReturns.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "}} , Got: FuncType {params{"; -+ for (uint32_t I = 0; I < Rhs.GotParams.size(); ++I) { -+ OS << TypeCodeStr[Rhs.GotParams[I].getCode()]; -+ if (I < Rhs.GotParams.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "} returns{"; -+ for (uint32_t I = 0; I < Rhs.GotReturns.size(); ++I) { -+ OS << TypeCodeStr[Rhs.GotReturns[I].getCode()]; -+ if (I < Rhs.GotReturns.size() - 1) { -+ OS << " , "; -+ } -+ } -+ OS << "}}"; - break; -- case WasmEdge::ErrInfo::MismatchCategory::Table: -- Iter = fmt::format_to(Iter, "Expected: TableType {{RefType{{{}}} "sv, -- static_cast(Info.ExpValType)); -- Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); -- Iter = fmt::format_to(Iter, "}} , Got: TableType {{RefType{{{}}} "sv, -- static_cast(Info.GotValType)); -- Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); -- fmt::format_to(Iter, "}}"sv); -+ case MismatchCategory::Table: -+ OS << "Expected: TableType {RefType{" -+ << TypeCodeStr[static_cast(Rhs.ExpValType).getCode()] -+ << "} Limit{" << Rhs.ExpLimMin; -+ if (Rhs.ExpLimHasMax) { -+ OS << " , " << Rhs.ExpLimMax; -+ } -+ OS << "}} , Got: TableType {RefType{" -+ << TypeCodeStr[static_cast(Rhs.GotValType).getCode()] -+ << "} Limit{" << Rhs.GotLimMin; -+ if (Rhs.GotLimHasMax) { -+ OS << " , " << Rhs.GotLimMax; -+ } -+ OS << "}}"; - break; -- case WasmEdge::ErrInfo::MismatchCategory::Memory: -- Iter = fmt::format_to(Iter, "Expected: MemoryType {{"sv); -- Iter = FormatLimit(Iter, Info.ExpLimHasMax, Info.ExpLimMin, Info.ExpLimMax); -- Iter = fmt::format_to(Iter, "}} , Got: MemoryType {{"sv); -- Iter = FormatLimit(Iter, Info.GotLimHasMax, Info.GotLimMin, Info.GotLimMax); -- fmt::format_to(Iter, "}}"sv); -+ case MismatchCategory::Memory: -+ OS << "Expected: MemoryType {Limit{" << Rhs.ExpLimMin; -+ if (Rhs.ExpLimHasMax) { -+ OS << " , " << Rhs.ExpLimMax; -+ } -+ OS << "}} , Got: MemoryType {Limit{" << Rhs.GotLimMin; -+ if (Rhs.GotLimHasMax) { -+ OS << " , " << Rhs.GotLimMax; -+ } -+ OS << "}}"; - break; -- case WasmEdge::ErrInfo::MismatchCategory::Global: -- fmt::format_to(Iter, -- "Expected: GlobalType {{Mutation{{{}}} ValType{{{}}}}} , " -- "Got: GlobalType {{Mutation{{{}}} ValType{{{}}}}}"sv, -- Info.ExpValMut, Info.ExpValType, Info.GotValMut, -- Info.GotValType); -+ case MismatchCategory::Global: -+ OS << "Expected: GlobalType {Mutation{" << ValMutStr[Rhs.ExpValMut] -+ << "} ValType{" << TypeCodeStr[Rhs.ExpValType.getCode()] -+ << "}} , Got: GlobalType {Mutation{" << ValMutStr[Rhs.GotValMut] -+ << "} ValType{" << TypeCodeStr[Rhs.GotValType.getCode()] << "}}"; - break; -- case WasmEdge::ErrInfo::MismatchCategory::Version: -- fmt::format_to(Iter, "Expected: {} , Got: {}"sv, Info.ExpVersion, -- Info.GotVersion); -+ case MismatchCategory::Version: -+ OS << "Expected: " << Rhs.ExpVersion << " , Got: " << Rhs.GotVersion; - break; - default: - break; - } -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoInstruction &Info, -- fmt::format_context &Ctx) const noexcept { -- uint16_t Payload = static_cast(Info.Code); -- fmt::memory_buffer Buffer; -- auto Iter = fmt::format_to(std::back_inserter(Buffer), -- " In instruction: {} ("sv, Info.Code); -+std::ostream &operator<<(std::ostream &OS, const struct InfoInstruction &Rhs) { -+ uint16_t Payload = static_cast(Rhs.Code); -+ OS << " In instruction: " << OpCodeStr[Rhs.Code] << " ("; - if ((Payload >> 8) >= static_cast(0xFCU)) { -- Iter = fmt::format_to(Iter, "0x{:02x} "sv, Payload >> 8); -+ OS << convertUIntToHexStr(Payload >> 8, 2) << " "; - } -- Iter = fmt::format_to(Iter, "0x{:02x}) , Bytecode offset: 0x{:08x}"sv, -- Payload & 0xFFU, Info.Offset); -- if (!Info.Args.empty()) { -- Iter = fmt::format_to(Iter, " , Args: ["sv); -- for (uint32_t I = 0; I < Info.Args.size(); ++I) { -- switch (Info.ArgsTypes[I].getCode()) { -- case WasmEdge::TypeCode::I32: -- if (Info.IsSigned) { -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); -+ OS << convertUIntToHexStr(Payload & 0xFFU, 2) -+ << ") , Bytecode offset: " << convertUIntToHexStr(Rhs.Offset); -+ if (Rhs.Args.size() > 0) { -+ OS << " , Args: ["; -+ for (uint32_t I = 0; I < Rhs.Args.size(); ++I) { -+ switch (Rhs.ArgsTypes[I].getCode()) { -+ case TypeCode::I32: -+ if (Rhs.IsSigned) { -+ OS << Rhs.Args[I].get(); - } else { -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); -+ OS << Rhs.Args[I].get(); - } - break; -- case WasmEdge::TypeCode::I64: -- if (Info.IsSigned) { -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); -+ case TypeCode::I64: -+ if (Rhs.IsSigned) { -+ OS << Rhs.Args[I].get(); - } else { -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); -+ OS << Rhs.Args[I].get(); - } - break; -- case WasmEdge::TypeCode::F32: -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); -+ case TypeCode::F32: -+ OS << Rhs.Args[I].get(); - break; -- case WasmEdge::TypeCode::F64: -- Iter = fmt::format_to(Iter, "{}"sv, Info.Args[I].get()); -+ case TypeCode::F64: -+ OS << Rhs.Args[I].get(); - break; -- case WasmEdge::TypeCode::V128: { -- const auto Value = Info.Args[I].get(); -- Iter = fmt::format_to(Iter, "0x{:08x}{:08x}"sv, Value[1], Value[0]); -+ case TypeCode::V128: { -+ const auto Value = Rhs.Args[I].get(); -+ OS << std::hex << Value[0] << Value[1]; - break; - } -- case WasmEdge::TypeCode::Ref: -- case WasmEdge::TypeCode::RefNull: -- Iter = fmt::format_to(Iter, "{}"sv, Info.ArgsTypes[I]); -- if (Info.Args[I].get().isNull()) { -- Iter = fmt::format_to(Iter, ":null"sv); -+ case TypeCode::FuncRef: -+ OS << TypeCodeStr[Rhs.ArgsTypes[I].getCode()]; -+ if (Rhs.Args[I].get().isNull()) { -+ OS << ":null"; - } else { -- Iter = -- fmt::format_to(Iter, ":0x{:08x}"sv, Info.Args[I].get()); -+ OS << ":" << &Rhs.Args[I].get(); -+ } -+ break; -+ case TypeCode::ExternRef: -+ OS << TypeCodeStr[Rhs.ArgsTypes[I].getCode()]; -+ if (Rhs.Args[I].get().isNull()) { -+ OS << ":null"; -+ } else { -+ OS << ":" << &Rhs.Args[I].get(); - } - break; - default: - break; - } -- if (I < Info.Args.size() - 1) { -- Iter = fmt::format_to(Iter, " , "sv); -+ if (I < Rhs.Args.size() - 1) { -+ OS << " , "; - } - } -- Iter = fmt::format_to(Iter, "]"sv); -+ OS << "]"; - } -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoBoundary &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- fmt::format_to(std::back_inserter(Buffer), -- " Accessing offset from: 0x{:08x} to: 0x{:08x} , Out of " -- "boundary: 0x{:08x}"sv, -- Info.Offset, -- Info.Offset + (Info.Size > 0U ? Info.Size - 1U : 0U), -- Info.Limit); -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+std::ostream &operator<<(std::ostream &OS, const struct InfoBoundary &Rhs) { -+ OS << " Accessing offset from: " << convertUIntToHexStr(Rhs.Offset) -+ << " to: " -+ << convertUIntToHexStr(Rhs.Offset + Rhs.Size - (Rhs.Size > 0 ? 1 : 0)) -+ << " , Out of boundary: " << convertUIntToHexStr(Rhs.Limit); -+ return OS; - } - --fmt::format_context::iterator --fmt::formatter::format( -- const WasmEdge::ErrInfo::InfoProposal &Info, -- fmt::format_context &Ctx) const noexcept { -- fmt::memory_buffer Buffer; -- if (auto Iter = WasmEdge::ProposalStr.find(Info.P); -- Iter != WasmEdge::ProposalStr.end()) { -- fmt::format_to( -- std::back_inserter(Buffer), -- " This instruction or syntax requires enabling {} proposal"sv, -- Iter->second); -+std::ostream &operator<<(std::ostream &OS, const struct InfoProposal &Rhs) { -+ if (auto Iter = ProposalStr.find(Rhs.P); Iter != ProposalStr.end()) { -+ OS << " This instruction or syntax requires enabling proposal " -+ << Iter->second; - } else { -- fmt::format_to(std::back_inserter(Buffer), -- " Unknown proposal, Code 0x{:08x}"sv, -- static_cast(Info.P)); -+ OS << " Unknown proposal, Code " -+ << convertUIntToHexStr(static_cast(Rhs.P)); - } -- return formatter::format( -- std::string_view(Buffer.data(), Buffer.size()), Ctx); -+ return OS; - } -+ -+} // namespace ErrInfo -+} // namespace WasmEdge -diff --git a/test/errinfo/errinfoTest.cpp b/test/errinfo/errinfoTest.cpp -index d074843a..bfc66ef7 100644 ---- a/test/errinfo/errinfoTest.cpp -+++ b/test/errinfo/errinfoTest.cpp -@@ -5,7 +5,7 @@ - - #include - #include --#include -+#include - #include - - using namespace std::literals; -@@ -14,115 +14,115 @@ namespace { - - TEST(ErrInfoTest, Info__File) { - WasmEdge::ErrInfo::InfoFile Info1("file.txt"); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Loading) { - WasmEdge::ErrInfo::InfoLoading Info1(30); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__AST) { - WasmEdge::ErrInfo::InfoAST Info1(WasmEdge::ASTNodeAttr::Module); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__InstanceBound) { - WasmEdge::ErrInfo::InfoInstanceBound Info1(WasmEdge::ExternalType::Memory, 2, - 1); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__ForbidIndex) { - WasmEdge::ErrInfo::InfoForbidIndex Info1( - WasmEdge::ErrInfo::IndexCategory::FunctionType, 2, 1); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - WasmEdge::ErrInfo::InfoForbidIndex Info2( - WasmEdge::ErrInfo::IndexCategory::Memory, 2, 0); -- fmt::print("{}\n"sv, Info2); -+ std::cout << Info2 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Exporting) { - WasmEdge::ErrInfo::InfoExporting Info1("export"); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Limit) { - WasmEdge::ErrInfo::InfoLimit Info1(true, 10, 20); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - WasmEdge::ErrInfo::InfoLimit Info2(false, 30); -- fmt::print("{}\n"sv, Info2); -+ std::cout << Info2 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Registering) { - WasmEdge::ErrInfo::InfoRegistering Info1("host_func"); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Linking) { - WasmEdge::ErrInfo::InfoLinking Info1("module", "func"); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Executing) { - WasmEdge::ErrInfo::InfoExecuting Info1("", "func"); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - WasmEdge::ErrInfo::InfoExecuting Info2("module", "func"); -- fmt::print("{}\n"sv, Info2); -+ std::cout << Info2 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Mismatch) { - WasmEdge::ErrInfo::InfoMismatch Info1(static_cast(16), 8888); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info2(WasmEdge::TypeCode::ExternRef, - WasmEdge::TypeCode::FuncRef); -- fmt::print("{}\n"sv, Info2); -+ std::cout << Info2 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info3( - {WasmEdge::TypeCode::I32, WasmEdge::TypeCode::FuncRef}, - {WasmEdge::TypeCode::F64, WasmEdge::TypeCode::ExternRef, - WasmEdge::TypeCode::V128}); -- fmt::print("{}\n"sv, Info3); -+ std::cout << Info3 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info4(WasmEdge::ValMut::Const, - WasmEdge::ValMut::Var); -- fmt::print("{}\n"sv, Info4); -+ std::cout << Info4 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info5(WasmEdge::ExternalType::Function, - WasmEdge::ExternalType::Global); -- fmt::print("{}\n"sv, Info5); -+ std::cout << Info5 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info6( - {WasmEdge::TypeCode::I32, WasmEdge::TypeCode::FuncRef}, - {WasmEdge::TypeCode::I64, WasmEdge::TypeCode::F64}, - {WasmEdge::TypeCode::F64, WasmEdge::TypeCode::ExternRef, - WasmEdge::TypeCode::V128}, - {WasmEdge::TypeCode::V128}); -- fmt::print("{}\n"sv, Info6); -+ std::cout << Info6 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info7(WasmEdge::TypeCode::ExternRef, true, 10, - 20, WasmEdge::TypeCode::FuncRef, true, - 20, 50); -- fmt::print("{}\n"sv, Info7); -+ std::cout << Info7 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info8(WasmEdge::TypeCode::ExternRef, false, - 10, 10, WasmEdge::TypeCode::FuncRef, - false, 20, 20); -- fmt::print("{}\n"sv, Info8); -+ std::cout << Info8 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info9(true, 10, 20, true, 20, 50); -- fmt::print("{}\n"sv, Info9); -+ std::cout << Info9 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info10(false, 10, 10, false, 20, 20); -- fmt::print("{}\n"sv, Info10); -+ std::cout << Info10 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info11( - WasmEdge::TypeCode::I32, WasmEdge::ValMut::Var, WasmEdge::TypeCode::I64, - WasmEdge::ValMut::Const); -- fmt::print("{}\n"sv, Info11); -+ std::cout << Info11 << std::endl; - WasmEdge::ErrInfo::InfoMismatch Info12(12345678U, 98765432U); -- fmt::print("{}\n"sv, Info12); -+ std::cout << Info12 << std::endl; - - EXPECT_TRUE(true); - } -@@ -137,58 +137,58 @@ TEST(ErrInfoTest, Info__Instruction) { - {WasmEdge::TypeCode::I32, - WasmEdge::TypeCode::I32, - WasmEdge::TypeCode::I32}); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - WasmEdge::ErrInfo::InfoInstruction Info2(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::TypeCode::I32, - WasmEdge::TypeCode::I32, - WasmEdge::TypeCode::I32}); -- fmt::print("{}\n"sv, Info2); -+ std::cout << Info2 << std::endl; - WasmEdge::ErrInfo::InfoInstruction Info3(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::TypeCode::I64, - WasmEdge::TypeCode::I64, - WasmEdge::TypeCode::I64}); -- fmt::print("{}\n"sv, Info3); -+ std::cout << Info3 << std::endl; - WasmEdge::ErrInfo::InfoInstruction Info4(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::TypeCode::F32, - WasmEdge::TypeCode::F32, - WasmEdge::TypeCode::F32}); -- fmt::print("{}\n"sv, Info4); -+ std::cout << Info4 << std::endl; - WasmEdge::ErrInfo::InfoInstruction Info5(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::TypeCode::F64, - WasmEdge::TypeCode::F64, - WasmEdge::TypeCode::F64}); -- fmt::print("{}\n"sv, Info5); -+ std::cout << Info5 << std::endl; - WasmEdge::ErrInfo::InfoInstruction Info6(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::TypeCode::V128, - WasmEdge::TypeCode::V128, - WasmEdge::TypeCode::V128}); -- fmt::print("{}\n"sv, Info6); -+ std::cout << Info6 << std::endl; - WasmEdge::ErrInfo::InfoInstruction Info7(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::TypeCode::FuncRef, - WasmEdge::TypeCode::FuncRef, - WasmEdge::TypeCode::FuncRef}); -- fmt::print("{}\n"sv, Info7); -+ std::cout << Info7 << std::endl; - WasmEdge::ErrInfo::InfoInstruction Info8(WasmEdge::OpCode::Block, 255, Args, - {WasmEdge::TypeCode::ExternRef, - WasmEdge::TypeCode::ExternRef, - WasmEdge::TypeCode::ExternRef}); -- fmt::print("{}\n"sv, Info8); -+ std::cout << Info8 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Boundary) { - WasmEdge::ErrInfo::InfoBoundary Info1(3, 5, 2); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - WasmEdge::ErrInfo::InfoBoundary Info2(3, 0, 2); -- fmt::print("{}\n"sv, Info2); -+ std::cout << Info2 << std::endl; - EXPECT_TRUE(true); - } - - TEST(ErrInfoTest, Info__Proposal) { - WasmEdge::ErrInfo::InfoProposal Info1(WasmEdge::Proposal::SIMD); -- fmt::print("{}\n"sv, Info1); -+ std::cout << Info1 << std::endl; - WasmEdge::ErrInfo::InfoProposal Info2(static_cast(250U)); -- fmt::print("{}\n"sv, Info2); -+ std::cout << Info2 << std::endl; - EXPECT_TRUE(true); - } - diff --git a/wasmedge.spec b/wasmedge.spec index 09bd52e..04bf0ad 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -1,25 +1,21 @@ -%global version 0.14.0 +%global version 0.17.0 %global reponame WasmEdge %global capi_soname 0 -%global capi_version 0.1.0 +%global capi_version 0.1.1 %undefine _annotated_build Name: wasmedge Version: %{version} -Release: 4%{?dist} +Release: 1%{?dist} Summary: High performance WebAssembly Virtual Machine # The entire source code is ASL 2.0 except LICENSE.spdx which is CC0 License: ASL 2.0 and CC0 URL: https://github.com/%{reponame}/%{reponame} Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz -# Revert https://github.com/WasmEdge/WasmEdge/pull/2511 for old fmt version -Patch0: wasmedge-revert-fmt.patch -# https://github.com/WasmEdge/WasmEdge/pull/3809 -Patch1: 0001-LLVM-Support-LLVM-19-3809.patch -# Patch from https://github.com/WasmEdge/WasmEdge/commit/b63e201d46452453ee7c2acf07967cd292d7e3da -Patch2: 0001-LLVM-LLVMX86_MMXTypeKind-is-removed-in-LLVM20-4064.patch -# Patch from https://github.com/WasmEdge/WasmEdge/commit/37cc9fa19bd23edbbdaa9252059b17f191fa4d17 -Patch3: 0001-fix-runtime-refine-the-overflow-detection-when-wrapp.patch +# fmt 6 / spdlog 1.5 compatibility for EPEL 8: RHEL 8 ships fmt 6.2.1 and spdlog +# 1.5.0, older than upstream expects. Conditional guards only (FMT_VERSION and +# __has_include), no behavior change on newer fmt. Candidate for upstreaming. +Patch0: 0001-fmt6-compat.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gcc-toolset-11-toolchain @@ -111,10 +107,27 @@ cd .. %{_includedir}/%{name}/enum_types.h %{_includedir}/%{name}/int128.h %{_includedir}/%{name}/version.h +%{_includedir}/%{name}/wasmedge_ast.h +%{_includedir}/%{name}/wasmedge_basic.h +%{_includedir}/%{name}/wasmedge_compiler.h +%{_includedir}/%{name}/wasmedge_configure.h +%{_includedir}/%{name}/wasmedge_context.h +%{_includedir}/%{name}/wasmedge_deprecated.h +%{_includedir}/%{name}/wasmedge_execution.h +%{_includedir}/%{name}/wasmedge_experimental.h +%{_includedir}/%{name}/wasmedge_instance.h +%{_includedir}/%{name}/wasmedge_plugin.h +%{_includedir}/%{name}/wasmedge_tools.h +%{_includedir}/%{name}/wasmedge_value.h +%{_includedir}/%{name}/wasmedge_vm.h %{_includedir}/%{name}/wasmedge.h %{_libdir}/lib%{name}.so %changelog +* Tue Jun 02 2026 hydai - 0.17.0-1 +- Update to 0.17.0 +- Add fmt 6 / spdlog 1.5 compatibility patch for EPEL 8 (Patch0) + * Mon Jan 05 2026 dm4 - 0.14.0-4 - Backport fix for CVE-2025-22921 From c458425a156ec99a93cab10a5456d0e387bd6d39 Mon Sep 17 00:00:00 2001 From: hydai Date: Mon, 6 Jul 2026 16:20:33 +0000 Subject: [PATCH 18/18] Update to 0.17.1 Signed-off-by: hydai --- .gitignore | 1 + 0001-fmt6-compat.patch | 559 ----------------------------------------- sources | 1 + wasmedge.spec | 10 +- 4 files changed, 7 insertions(+), 564 deletions(-) delete mode 100644 0001-fmt6-compat.patch diff --git a/.gitignore b/.gitignore index c2b8f64..91e2db4 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /WasmEdge-0.13.4-src.tar.gz /WasmEdge-0.13.5-src.tar.gz /WasmEdge-0.14.0-src.tar.gz +/WasmEdge-0.17.1-src.tar.gz diff --git a/0001-fmt6-compat.patch b/0001-fmt6-compat.patch deleted file mode 100644 index 97a53f9..0000000 --- a/0001-fmt6-compat.patch +++ /dev/null @@ -1,559 +0,0 @@ -diff --git a/include/ast/type.h b/include/ast/type.h -index 03fbf53ef..81399e0a7 100644 ---- a/include/ast/type.h -+++ b/include/ast/type.h -@@ -797,9 +797,9 @@ private: - template <> - struct fmt::formatter - : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::AST::FunctionType &Type, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::AST::FunctionType &Type, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - using namespace std::literals; - - fmt::memory_buffer Buffer; -diff --git a/include/common/enum_ast.hpp b/include/common/enum_ast.hpp -index 2535559a1..fab6bca27 100644 ---- a/include/common/enum_ast.hpp -+++ b/include/common/enum_ast.hpp -@@ -133,9 +133,9 @@ static inline constexpr const auto ComponentCanonOptCodeStr = []() constexpr { - template <> - struct fmt::formatter - : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ASTNodeAttr &Attr, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::ASTNodeAttr &Attr, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - return formatter::format(WasmEdge::ASTNodeAttrStr[Attr], - Ctx); - } -@@ -143,9 +143,9 @@ struct fmt::formatter - - template <> - struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::OpCode &Code, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::OpCode &Code, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - return formatter::format(WasmEdge::OpCodeStr[Code], Ctx); - } - }; -diff --git a/include/common/enum_errcode.hpp b/include/common/enum_errcode.hpp -index 71fa512b0..dcaeb77d0 100644 ---- a/include/common/enum_errcode.hpp -+++ b/include/common/enum_errcode.hpp -@@ -151,9 +151,9 @@ static inline constexpr const auto ErrCodeStr = []() constexpr { - - template <> - struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::WasmPhase &Phase, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::WasmPhase &Phase, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - return formatter::format(WasmEdge::WasmPhaseStr[Phase], - Ctx); - } -diff --git a/include/common/enum_errinfo.hpp b/include/common/enum_errinfo.hpp -index 48b7c094f..13847b090 100644 ---- a/include/common/enum_errinfo.hpp -+++ b/include/common/enum_errinfo.hpp -@@ -110,9 +110,9 @@ static inline constexpr auto IndexCategoryStr = []() constexpr { - template <> - struct fmt::formatter - : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::PtrType &Type, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::ErrInfo::PtrType &Type, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - return formatter::format( - WasmEdge::ErrInfo::PtrTypeStr[Type], Ctx); - } -@@ -121,9 +121,9 @@ struct fmt::formatter - template <> - struct fmt::formatter - : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::MismatchCategory &Category, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::ErrInfo::MismatchCategory &Category, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - return formatter::format( - WasmEdge::ErrInfo::MismatchCategoryStr[Category], Ctx); - } -@@ -132,9 +132,9 @@ struct fmt::formatter - template <> - struct fmt::formatter - : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrInfo::IndexCategory &Category, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::ErrInfo::IndexCategory &Category, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - return formatter::format( - WasmEdge::ErrInfo::IndexCategoryStr[Category], Ctx); - } -diff --git a/include/common/enum_types.hpp b/include/common/enum_types.hpp -index c73f151b1..769b0e71b 100644 ---- a/include/common/enum_types.hpp -+++ b/include/common/enum_types.hpp -@@ -111,8 +111,8 @@ static inline constexpr const auto ComponentTypeCodeStr = []() constexpr { - - template <> - struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ValMut &Mut, fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::ValMut &Mut, FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - return formatter::format(WasmEdge::ValMutStr[Mut], Ctx); - } - }; -@@ -120,9 +120,9 @@ struct fmt::formatter : fmt::formatter { - template <> - struct fmt::formatter - : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ExternalType &Type, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::ExternalType &Type, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - return formatter::format(WasmEdge::ExternalTypeStr[Type], - Ctx); - } -diff --git a/include/common/errcode.h b/include/common/errcode.h -index 2661c5207..2e5f8688d 100644 ---- a/include/common/errcode.h -+++ b/include/common/errcode.h -@@ -60,9 +60,9 @@ template constexpr auto Unexpect(const Expect &Val) { - - template <> - struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrCode &Code, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::ErrCode &Code, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - using namespace std::literals; - std::string Output = - fmt::format("{} failed: {}, Code: 0x{:03x}"sv, Code.getErrCodePhase(), -@@ -74,9 +74,9 @@ struct fmt::formatter : fmt::formatter { - template <> - struct fmt::formatter - : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ErrCode::Value &Value, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::ErrCode::Value &Value, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - return formatter::format(WasmEdge::ErrCode(Value), Ctx); - } - }; -diff --git a/include/common/errinfo.h b/include/common/errinfo.h -index 251a85215..1176a3948 100644 ---- a/include/common/errinfo.h -+++ b/include/common/errinfo.h -@@ -270,94 +270,94 @@ template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoFile &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoLoading &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoAST &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoInstanceBound &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoForbidIndex &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoExporting &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator format(const WasmEdge::ErrInfo::InfoLimit &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoRegistering &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoLinking &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoExecuting &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoMismatch &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoInstruction &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoBoundary &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; - template <> - struct fmt::formatter - : fmt::formatter { - fmt::format_context::iterator - format(const WasmEdge::ErrInfo::InfoProposal &Info, -- fmt::format_context &Ctx) const noexcept; -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept; - }; -diff --git a/include/common/int128.h b/include/common/int128.h -index 40f49e727..71a2b7133 100644 ---- a/include/common/int128.h -+++ b/include/common/int128.h -@@ -554,7 +554,14 @@ using uint128_t = uint128; - - #include - -+#if FMT_VERSION >= 80000 -+#define WASMEDGE_FMT_CONST const -+#else -+#define WASMEDGE_FMT_CONST -+#endif -+ - FMT_BEGIN_NAMESPACE -+#if FMT_VERSION >= 90000 - namespace detail { - inline constexpr bool operator>=(detail::uint128_fallback LHS, - unsigned int RHS) { -@@ -668,7 +675,9 @@ FMT_CONSTEXPR20 inline int count_digits(detail::uint128_fallback N) { - } - - } // namespace detail -+#endif - -+#if FMT_VERSION >= 80000 - template struct formatter { - private: - detail::dynamic_format_specs Specs; -@@ -713,4 +722,27 @@ public: - #endif - } - }; -+#else -+template struct formatter { -+ template -+ constexpr auto parse(ParseContext &Ctx) -> decltype(Ctx.begin()) { -+ return Ctx.begin(); -+ } -+ template -+ auto format(WasmEdge::uint128 V, FormatContext &Ctx) -> decltype(Ctx.out()) { -+ char Buf[40]; -+ char *Pos = Buf + sizeof(Buf); -+ const WasmEdge::uint128 Ten(10U); -+ do { -+ *--Pos = static_cast('0' + (V % Ten).low()); -+ V /= Ten; -+ } while (V != WasmEdge::uint128(0U)); -+ auto Out = Ctx.out(); -+ for (const char *It = Pos; It != Buf + sizeof(Buf); ++It) { -+ *Out++ = *It; -+ } -+ return Out; -+ } -+}; -+#endif - FMT_END_NAMESPACE -diff --git a/include/common/spdlog.h b/include/common/spdlog.h -index c94931c55..5c80be269 100644 ---- a/include/common/spdlog.h -+++ b/include/common/spdlog.h -@@ -49,8 +49,9 @@ void setLoggingCallback( - template <> - struct fmt::formatter - : fmt::formatter { -- fmt::format_context::iterator format(const std::filesystem::path &Path, -- fmt::format_context &Ctx) const { -+ template -+ auto format(const std::filesystem::path &Path, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST -> decltype(Ctx.out()) { - // mimic std::quoted - constexpr const char Delimiter = '"'; - constexpr const char Escape = '\\'; -diff --git a/include/common/types.h b/include/common/types.h -index de5d23764..188a0a58a 100644 ---- a/include/common/types.h -+++ b/include/common/types.h -@@ -788,9 +788,9 @@ private: - - template <> - struct fmt::formatter : fmt::formatter { -- fmt::format_context::iterator -- format(const WasmEdge::ValType &Type, -- fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(const WasmEdge::ValType &Type, -+ FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - using namespace std::literals; - // For the number types, print the type directly. - if (!Type.isRefType()) { -diff --git a/include/host/wasi/error.h b/include/host/wasi/error.h -index 7ff181be2..6f0bda102 100644 ---- a/include/host/wasi/error.h -+++ b/include/host/wasi/error.h -@@ -29,8 +29,8 @@ template constexpr auto WasiUnexpect(const WasiExpect &Val) { - - template <> - struct fmt::formatter<__wasi_errno_t> : fmt::formatter { -- fmt::format_context::iterator -- format(__wasi_errno_t ErrNo, fmt::format_context &Ctx) const noexcept { -+ template -+ auto format(__wasi_errno_t ErrNo, FmtCtx &Ctx) WASMEDGE_FMT_CONST noexcept -> decltype(Ctx.out()) { - fmt::memory_buffer Buffer; - using namespace std::literals; - auto Iter = std::back_inserter(Buffer); -diff --git a/lib/common/errinfo.cpp b/lib/common/errinfo.cpp -index 71400642d..27d4aabd4 100644 ---- a/lib/common/errinfo.cpp -+++ b/lib/common/errinfo.cpp -@@ -7,14 +7,18 @@ - #include "common/int128.h" - - #include -+#if __has_include() - #include -+#else -+#include -+#endif - - using namespace std::literals; - - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoFile &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - fmt::format_to(std::back_inserter(Buffer), " File name: {}"sv, - Info.FileName); -@@ -25,7 +29,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoLoading &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - fmt::format_to(std::back_inserter(Buffer), " Bytecode offset: 0x{:08x}"sv, - Info.Offset); -@@ -36,7 +40,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoAST &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - fmt::format_to(std::back_inserter(Buffer), " At AST node: {}"sv, - Info.NodeAttr); -@@ -47,7 +51,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoInstanceBound &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - fmt::format_to(std::back_inserter(Buffer), - " Instance {} has limited number {} , Got: {}"sv, -@@ -59,7 +63,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoForbidIndex &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - auto Iter = - fmt::format_to(std::back_inserter(Buffer), -@@ -77,7 +81,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoExporting &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - fmt::format_to(std::back_inserter(Buffer), - " Duplicated exporting name: \"{}\""sv, Info.ExtName); -@@ -88,7 +92,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoLimit &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - auto Iter = fmt::format_to(std::back_inserter(Buffer), - " In Limit type: {{ min: {}"sv, Info.LimMin); -@@ -103,7 +107,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoRegistering &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - fmt::format_to(std::back_inserter(Buffer), " Module name: \"{}\""sv, - Info.ModName); -@@ -114,7 +118,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoLinking &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - fmt::format_to(std::back_inserter(Buffer), - " When linking module: \"{}\" , {} name: \"{}\""sv, -@@ -126,7 +130,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoExecuting &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - auto Iter = - fmt::format_to(std::back_inserter(Buffer), " When executing "sv); -@@ -141,7 +145,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoMismatch &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - auto Iter = fmt::format_to(std::back_inserter(Buffer), - " Mismatched {}. "sv, Info.Category); -@@ -229,7 +233,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoInstruction &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - uint16_t Payload = static_cast(Info.Code); - fmt::memory_buffer Buffer; - auto Iter = fmt::format_to(std::back_inserter(Buffer), -@@ -294,7 +298,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoBoundary &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - WasmEdge::uint128_t OffFrom = Info.Offset; - if (Info.IsOffsetOverflow) { -@@ -347,7 +351,7 @@ fmt::formatter::format( - fmt::format_context::iterator - fmt::formatter::format( - const WasmEdge::ErrInfo::InfoProposal &Info, -- fmt::format_context &Ctx) const noexcept { -+ fmt::format_context &Ctx) WASMEDGE_FMT_CONST noexcept { - fmt::memory_buffer Buffer; - if (auto Iter = WasmEdge::ProposalStr.find(Info.P); - Iter != WasmEdge::ProposalStr.end()) { -diff --git a/lib/common/spdlog.cpp b/lib/common/spdlog.cpp -index 39ba477bb..39f6a7ff8 100644 ---- a/lib/common/spdlog.cpp -+++ b/lib/common/spdlog.cpp -@@ -9,7 +9,30 @@ - // https://github.com/gabime/spdlog/pull/3198 - #pragma clang diagnostic ignored "-Wextra-semi" - #endif -+#if __has_include() - #include -+#else -+// Fallback for spdlog without callback_sink.h (e.g. RHEL 9 / EPEL 9 spdlog 1.10). -+#include -+#include -+#include -+namespace spdlog::sinks { -+template class callback_sink final : public base_sink { -+public: -+ explicit callback_sink( -+ std::function Callback) -+ : Cb(std::move(Callback)) {} -+ -+protected: -+ void sink_it_(const details::log_msg &Msg) override { Cb(Msg); } -+ void flush_() override {} -+ -+private: -+ std::function Cb; -+}; -+using callback_sink_mt = callback_sink; -+} // namespace spdlog::sinks -+#endif - #if defined(__clang_major__) && __clang_major__ >= 10 - #pragma clang diagnostic pop - #endif diff --git a/sources b/sources index d2f6a58..761ab14 100644 --- a/sources +++ b/sources @@ -14,3 +14,4 @@ SHA512 (WasmEdge-0.14.1-src.tar.gz) = cf708ad789c8d7cb8b5885d6b13dbb010fa433e939 SHA512 (WasmEdge-0.15.0-src.tar.gz) = 3a41f362852dd04dc441ebe10fac266703bb146100cceec64df3fce76f57960ac7dacfc9c1243f4177899a5c4d50166158908b0ec4e88e3f226cad2fd350e6cd SHA512 (WasmEdge-0.16.1-src.tar.gz) = b09c8d83e3627085382109ea073ecc099b57e109b419171a29ab780ee36b371de9bd1864d478c15324f29baabd0c19dda8a32a37f46a738f39e47ef6d51a0770 SHA512 (WasmEdge-0.17.0-src.tar.gz) = 3e0f9739c7cd5af4ad1e54ed009719c8e4d3d4bfc821103bd954f5bc662381278f97078b4d177f4fae599b3a199b55b6e1fd81ce75ab7711921779db2e89d567 +SHA512 (WasmEdge-0.17.1-src.tar.gz) = b5f1d7cde7fee8f43dff972135fb49489c0e752cd364aa13ecb15b7ccd0d81579ac2552d3e3a8f6f5a870313eda640010f833869a0089677a3c8d76476e0fbed diff --git a/wasmedge.spec b/wasmedge.spec index 04bf0ad..50d0502 100644 --- a/wasmedge.spec +++ b/wasmedge.spec @@ -1,4 +1,4 @@ -%global version 0.17.0 +%global version 0.17.1 %global reponame WasmEdge %global capi_soname 0 %global capi_version 0.1.1 @@ -12,10 +12,6 @@ Summary: High performance WebAssembly Virtual Machine License: ASL 2.0 and CC0 URL: https://github.com/%{reponame}/%{reponame} Source0: %{url}/releases/download/%{version}/%{reponame}-%{version}-src.tar.gz -# fmt 6 / spdlog 1.5 compatibility for EPEL 8: RHEL 8 ships fmt 6.2.1 and spdlog -# 1.5.0, older than upstream expects. Conditional guards only (FMT_VERSION and -# __has_include), no behavior change on newer fmt. Candidate for upstreaming. -Patch0: 0001-fmt6-compat.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gcc-toolset-11-toolchain @@ -124,6 +120,10 @@ cd .. %{_libdir}/lib%{name}.so %changelog +* Mon Jul 06 2026 hydai - 0.17.1-1 +- Update to 0.17.1 +- Drop 0001-fmt6-compat.patch; fmt/spdlog compat upstreamed + * Tue Jun 02 2026 hydai - 0.17.0-1 - Update to 0.17.0 - Add fmt 6 / spdlog 1.5 compatibility patch for EPEL 8 (Patch0)