[dynarmic] support -fno-exception compilations to reduce unwind table overheads

Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2026-03-25 20:49:07 +00:00 committed by crueter
parent 425b7ae7a8
commit 82dcc717e2
7 changed files with 9 additions and 15 deletions

View file

@ -5,6 +5,7 @@
#include <bitset>
#include <initializer_list>
#define XBYAK_NO_EXCEPTION 1
#include <xbyak/xbyak.h>
#include "common/assert.h"

View file

@ -4,6 +4,7 @@
#pragma once
#include <type_traits>
#define XBYAK_NO_EXCEPTION 1
#include <xbyak/xbyak.h>
#include "common/x64/xbyak_abi.h"

View file

@ -95,7 +95,7 @@ else()
-pedantic
-Wno-missing-braces
-fno-rtti
#-fno-exceptions
-fno-exceptions
)
if (CXX_GCC)
# GCC produces bogus -Warray-bounds warnings from xbyak headers for code paths that are not

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

@ -8,6 +8,7 @@
#pragma once
#include <bitset>
#define XBYAK_NO_EXCEPTION 1
#include <xbyak/xbyak.h>
#include "dynarmic/common/assert.h"

View file

@ -11,5 +11,6 @@
// #define XBYAK_STD_UNORDERED_MAP ankerl::unordered_dense::map
// #define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap
#define XBYAK_NO_EXCEPTION 1
#include <xbyak/xbyak.h>
#include <xbyak/xbyak_util.h>

View file

@ -21,6 +21,7 @@
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wshadow"
#endif
#define XBYAK_NO_EXCEPTION 1
#include <xbyak/xbyak.h>
#endif