From c2f50e6fc52696099ae43f999a8f438eb1eca836 Mon Sep 17 00:00:00 2001 From: kobalicek Date: Sat, 17 Nov 2018 05:43:49 +0100 Subject: [PATCH] Incorporated changes from pull requests 187, 202, and 212 --- .appveyor.yml | 34 +++++----------------------------- CMakeLists.txt | 7 ++++++- src/asmjit/asmjit_apibegin.h | 2 ++ src/asmjit/base/arch.h | 4 ++-- src/asmjit/base/cpuinfo.h | 4 ++-- src/asmjit/base/operand.h | 12 ++++++------ src/asmjit/x86/x86builder.h | 2 ++ src/asmjit/x86/x86internal.cpp | 8 ++------ 8 files changed, 27 insertions(+), 46 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index d003e0b..12f42d4 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,6 @@ version: "{build}" -image: Visual Studio 2015 +image: Visual Studio 2017 clone_folder: c:\dev\asmjit environment: @@ -14,40 +14,16 @@ environment: TOOLCHAIN: "MinGW Makefiles" - BUILD_TYPE: Debug - TOOLCHAIN: "Visual Studio 10 2010" + TOOLCHAIN: "Visual Studio 15 2017" - BUILD_TYPE: Release - TOOLCHAIN: "Visual Studio 10 2010" + TOOLCHAIN: "Visual Studio 15 2017" - BUILD_TYPE: Debug - TOOLCHAIN: "Visual Studio 10 2010 Win64" + TOOLCHAIN: "Visual Studio 15 2017 Win64" - BUILD_TYPE: Release - TOOLCHAIN: "Visual Studio 10 2010 Win64" - - - BUILD_TYPE: Debug - TOOLCHAIN: "Visual Studio 12 2013" - - - BUILD_TYPE: Release - TOOLCHAIN: "Visual Studio 12 2013" - - - BUILD_TYPE: Debug - TOOLCHAIN: "Visual Studio 12 2013 Win64" - - - BUILD_TYPE: Release - TOOLCHAIN: "Visual Studio 12 2013 Win64" - - - BUILD_TYPE: Debug - TOOLCHAIN: "Visual Studio 14 2015" - - - BUILD_TYPE: Release - TOOLCHAIN: "Visual Studio 14 2015" - - - BUILD_TYPE: Debug - TOOLCHAIN: "Visual Studio 14 2015 Win64" - - - BUILD_TYPE: Release - TOOLCHAIN: "Visual Studio 14 2015 Win64" + TOOLCHAIN: "Visual Studio 15 2017 Win64" install: - if "%TOOLCHAIN%"=="MinGW Makefiles" set PATH=%PATH:C:\Program Files\Git\usr\bin;=% diff --git a/CMakeLists.txt b/CMakeLists.txt index bfb4fb5..47e0306 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,7 +234,12 @@ if(NOT ASMJIT_EMBED) "${ASMJIT_PRIVATE_CFLAGS_REL}") foreach(_target asmjit_bench_x86 asmjit_test_opcode asmjit_test_x86_asm asmjit_test_x86_cc) - cxx_add_executable(asmjit ${_target} "test/${_target}.cpp" "${ASMJIT_LIBS}" "${ASMJIT_CFLAGS}" "" "") + cxx_add_executable(asmjit ${_target} + "test/${_target}.cpp" + "${ASMJIT_LIBS}" + "${ASMJIT_CFLAGS}" + "${ASMJIT_PRIVATE_CFLAGS_DBG}" + "${ASMJIT_PRIVATE_CFLAGS_REL}") endforeach() endif() endif() diff --git a/src/asmjit/asmjit_apibegin.h b/src/asmjit/asmjit_apibegin.h index 58d16db..06a3d5a 100644 --- a/src/asmjit/asmjit_apibegin.h +++ b/src/asmjit/asmjit_apibegin.h @@ -53,6 +53,7 @@ // [GCC] #if ASMJIT_CC_GCC # pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wbool-operation" #endif // ASMJIT_CC_GCC // [MSC] @@ -66,6 +67,7 @@ # pragma warning(disable: 4355) // this used in base member initializer list # pragma warning(disable: 4480) // specifying underlying type for enum # pragma warning(disable: 4800) // forcing value to bool 'true' or 'false' +# pragma warning(disable: 4838) // comversion from 'int' to ... # if _MSC_VER < 1900 # if !defined(vsnprintf) # define ASMJIT_UNDEF_VSNPRINTF diff --git a/src/asmjit/base/arch.h b/src/asmjit/base/arch.h index e03c6af..22e95e3 100644 --- a/src/asmjit/base/arch.h +++ b/src/asmjit/base/arch.h @@ -86,7 +86,7 @@ public: // -------------------------------------------------------------------------- ASMJIT_INLINE ArchInfo() noexcept : _signature(0) {} - ASMJIT_INLINE ArchInfo(const ArchInfo& other) noexcept : _signature(other._signature) {} + ASMJIT_INLINE ArchInfo(const ArchInfo& other) noexcept = default; explicit ASMJIT_INLINE ArchInfo(uint32_t type, uint32_t subType = kSubTypeNone) noexcept { init(type, subType); } ASMJIT_INLINE static ArchInfo host() noexcept { return ArchInfo(kTypeHost, kSubTypeHost); } @@ -147,7 +147,7 @@ public: // [Operator Overload] // -------------------------------------------------------------------------- - ASMJIT_INLINE const ArchInfo& operator=(const ArchInfo& other) noexcept { _signature = other._signature; return *this; } + ASMJIT_INLINE ArchInfo& operator=(const ArchInfo& other) noexcept = default; ASMJIT_INLINE bool operator==(const ArchInfo& other) const noexcept { return _signature == other._signature; } ASMJIT_INLINE bool operator!=(const ArchInfo& other) const noexcept { return _signature != other._signature; } diff --git a/src/asmjit/base/cpuinfo.h b/src/asmjit/base/cpuinfo.h index 268d37e..e5dd191 100644 --- a/src/asmjit/base/cpuinfo.h +++ b/src/asmjit/base/cpuinfo.h @@ -38,7 +38,7 @@ public: // -------------------------------------------------------------------------- ASMJIT_INLINE CpuFeatures() noexcept { reset(); } - ASMJIT_INLINE CpuFeatures(const CpuFeatures& other) noexcept { init(other); } + ASMJIT_INLINE CpuFeatures(const CpuFeatures& other) noexcept = default; // -------------------------------------------------------------------------- // [Init / Reset] @@ -249,7 +249,7 @@ public: // -------------------------------------------------------------------------- ASMJIT_INLINE CpuInfo() noexcept { reset(); } - ASMJIT_INLINE CpuInfo(const CpuInfo& other) noexcept { init(other); } + ASMJIT_INLINE CpuInfo(const CpuInfo& other) noexcept = default; // -------------------------------------------------------------------------- // [Init / Reset] diff --git a/src/asmjit/base/operand.h b/src/asmjit/base/operand.h index 1bdb2a5..eaa2c98 100644 --- a/src/asmjit/base/operand.h +++ b/src/asmjit/base/operand.h @@ -1497,11 +1497,11 @@ template struct TypeIdOf { template struct TypeIdOfInt { enum { - kSignatureed = int(~static_cast(0) < static_cast(0)), - kTypeId = (sizeof(T) == 1) ? (int)(kSignatureed ? TypeId::kI8 : TypeId::kU8 ) : - (sizeof(T) == 2) ? (int)(kSignatureed ? TypeId::kI16 : TypeId::kU16) : - (sizeof(T) == 4) ? (int)(kSignatureed ? TypeId::kI32 : TypeId::kU32) : - (sizeof(T) == 8) ? (int)(kSignatureed ? TypeId::kI64 : TypeId::kU64) : (int)TypeId::kVoid + kSigned = int(~T(0) < T(0)), + kTypeId = (sizeof(T) == 1) ? (int)(kSigned ? TypeId::kI8 : TypeId::kU8 ) : + (sizeof(T) == 2) ? (int)(kSigned ? TypeId::kI16 : TypeId::kU16) : + (sizeof(T) == 4) ? (int)(kSigned ? TypeId::kI32 : TypeId::kU32) : + (sizeof(T) == 8) ? (int)(kSigned ? TypeId::kI64 : TypeId::kU64) : (int)TypeId::kVoid }; }; @@ -1524,7 +1524,6 @@ ASMJIT_DEFINE_TYPE_ID(unsigned __int64 , TypeIdOfInt< unsigned __int64 >::kTy ASMJIT_DEFINE_TYPE_ID(long long , TypeIdOfInt< long long >::kTypeId); ASMJIT_DEFINE_TYPE_ID(unsigned long long, TypeIdOfInt< unsigned long long >::kTypeId); #endif -ASMJIT_DEFINE_TYPE_ID(bool , TypeIdOfInt< bool >::kTypeId); #if ASMJIT_CC_HAS_NATIVE_CHAR ASMJIT_DEFINE_TYPE_ID(char , TypeIdOfInt< char >::kTypeId); #endif @@ -1539,6 +1538,7 @@ ASMJIT_DEFINE_TYPE_ID(wchar_t , TypeIdOfInt< wchar_t >::kTy #endif ASMJIT_DEFINE_TYPE_ID(void , TypeId::kVoid); +ASMJIT_DEFINE_TYPE_ID(bool , TypeId::kI8); ASMJIT_DEFINE_TYPE_ID(float , TypeId::kF32); ASMJIT_DEFINE_TYPE_ID(double , TypeId::kF64); diff --git a/src/asmjit/x86/x86builder.h b/src/asmjit/x86/x86builder.h index 0558590..1beab15 100644 --- a/src/asmjit/x86/x86builder.h +++ b/src/asmjit/x86/x86builder.h @@ -71,6 +71,8 @@ public: // [Code-Generation] // -------------------------------------------------------------------------- + using CodeBuilder::_emit; + ASMJIT_API virtual Error _emit(uint32_t instId, const Operand_& o0, const Operand_& o1, const Operand_& o2, const Operand_& o3) override; }; diff --git a/src/asmjit/x86/x86internal.cpp b/src/asmjit/x86/x86internal.cpp index e0b3836..3033aac 100644 --- a/src/asmjit/x86/x86internal.cpp +++ b/src/asmjit/x86/x86internal.cpp @@ -1027,9 +1027,7 @@ ASMJIT_FAVOR_SIZE Error X86Internal::emitProlog(X86Emitter* emitter, const FuncF uint32_t gpSaved = layout.getSavedRegs(X86Reg::kKindGp); X86Gp zsp = emitter->zsp(); // ESP|RSP register. - X86Gp zbp = emitter->zsp(); // EBP|RBP register. - zbp.setId(X86Gp::kIdBp); - + X86Gp zbp = emitter->zbp(); // EBP|RBP register. X86Gp gpReg = emitter->zsp(); // General purpose register (temporary). X86Gp saReg = emitter->zsp(); // Stack-arguments base register. @@ -1100,9 +1098,7 @@ ASMJIT_FAVOR_SIZE Error X86Internal::emitEpilog(X86Emitter* emitter, const FuncF uint32_t gpSaved = layout.getSavedRegs(X86Reg::kKindGp); X86Gp zsp = emitter->zsp(); // ESP|RSP register. - X86Gp zbp = emitter->zsp(); // EBP|RBP register. - zbp.setId(X86Gp::kIdBp); - + X86Gp zbp = emitter->zbp(); // EBP|RBP register. X86Gp gpReg = emitter->zsp(); // General purpose register (temporary). // Don't emit 'pop zbp' in the pop sequence, this case is handled separately.