This commit is contained in:
lizzie 2026-05-19 07:06:12 +00:00
parent e875a3196b
commit d013f7cf96
4 changed files with 9 additions and 16 deletions

View file

@ -24,14 +24,13 @@
// You must ensure this matches with src/common/x64/xbyak.h on root dir
#include <ankerl/unordered_dense.h>
#include <boost/unordered_map.hpp>
#define XBYAK_NO_EXCEPTION 1
#define XBYAK_STD_UNORDERED_SET ankerl::unordered_dense::set
#define XBYAK_STD_UNORDERED_MAP ankerl::unordered_dense::map
#define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap
#include <xbyak/xbyak.h>
#include <xbyak/xbyak_util.h>
#include <xbyak/xbyak.h>
namespace Common::X64 {
constexpr size_t RegToIndex(const Xbyak::Reg& reg) {

View file

@ -113,6 +113,10 @@ else()
# Clang mistakenly blames CMake for using unused arguments during compilation
list(APPEND DYNARMIC_CXX_FLAGS -Wno-unused-command-line-argument)
endif()
# TODO: oaknut exceptions
if ("x86_64" IN_LIST ARCHITECTURE)
list(APPEND DYNARMIC_CXX_FLAGS -fno-exceptions)
endif()
endif()
if (NOT Boost_FOUND)

View file

@ -66,10 +66,7 @@ public:
#ifdef _WIN32
uint8_t* alloc(size_t size) override {
void* p = VirtualAlloc(nullptr, size, MEM_RESERVE, PAGE_READWRITE);
if (p == nullptr) {
using Xbyak::Error;
XBYAK_THROW(Xbyak::ERR_CANT_ALLOC);
}
ASSERT(p != nullptr);
return static_cast<uint8_t*>(p);
}
@ -105,10 +102,7 @@ public:
prot |= PROT_MPROTECT(PROT_READ) | PROT_MPROTECT(PROT_WRITE) | PROT_MPROTECT(PROT_EXEC);
#endif
void* p = mmap(nullptr, size, prot, mode, -1, 0);
if (p == MAP_FAILED) {
using Xbyak::Error;
XBYAK_THROW(Xbyak::ERR_CANT_ALLOC);
}
ASSERT(p != MAP_FAILED);
std::memcpy(p, &size, sizeof(size_t));
return static_cast<uint8_t*>(p) + DYNARMIC_PAGE_SIZE;
}
@ -532,13 +526,8 @@ size_t BlockOfCode::GetTotalCodeSize() const {
}
void* BlockOfCode::AllocateFromCodeSpace(size_t alloc_size) {
if (size_ + alloc_size >= maxSize_) {
using Xbyak::Error;
XBYAK_THROW(Xbyak::ERR_CODE_IS_TOO_BIG);
}
ASSERT(size_ + alloc_size < maxSize_);
EnsureMemoryCommitted(alloc_size);
void* ret = getCurr<void*>();
size_ += alloc_size;
memset(ret, 0, alloc_size);

View file

@ -6,6 +6,7 @@
// You must ensure this matches with src/common/x64/xbyak.h on root dir
#include <ankerl/unordered_dense.h>
#include <boost/unordered_map.hpp>
#define XBYAK_NO_EXCEPTION 1
#define XBYAK_STD_UNORDERED_SET ankerl::unordered_dense::set
#define XBYAK_STD_UNORDERED_MAP ankerl::unordered_dense::map
#define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap