mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-10-16 08:45:21 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ce7ef78c0 | |||
| 0e8c88022b |
@@ -0,0 +1,13 @@
|
||||
diff --git a/include/jwt/algorithm.hpp b/include/jwt/algorithm.hpp
|
||||
index 35347fe..183fcc2 100644
|
||||
--- a/include/jwt/algorithm.hpp
|
||||
+++ b/include/jwt/algorithm.hpp
|
||||
@@ -484,7 +484,7 @@ public:
|
||||
{
|
||||
std::error_code ec{};
|
||||
|
||||
- std::string ii{data.data(), data.length()};
|
||||
+ //std::string ii{data.data(), data.length()};
|
||||
|
||||
EC_PKEY_uptr pkey{load_key(key, ec), ev_pkey_deletor};
|
||||
if (ec) return { std::string{}, ec };
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/src/stream.h b/src/stream.h
|
||||
index 31c2680..1b6c0e8 100644
|
||||
--- a/src/stream.h
|
||||
+++ b/src/stream.h
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
+#include <cstdlib>
|
||||
|
||||
#ifndef __cpp_lib_bit_cast
|
||||
#include <cstring>
|
||||
+5
-1
@@ -38,7 +38,8 @@
|
||||
"CPP_JWT_USE_VENDORED_NLOHMANN_JSON OFF"
|
||||
],
|
||||
"patches": [
|
||||
"0001-fix-missing-decl.patch"
|
||||
"0001-fix-missing-decl.patch",
|
||||
"0002-libcxx.patch"
|
||||
],
|
||||
"repo": "arun11299/cpp-jwt",
|
||||
"version": "7f24eb4c32"
|
||||
@@ -270,6 +271,9 @@
|
||||
"options": [
|
||||
"SIRIT_USE_SYSTEM_SPIRV_HEADERS ON"
|
||||
],
|
||||
"patches": [
|
||||
"0001-libcxx.patch"
|
||||
],
|
||||
"repo": "eden-emulator/sirit",
|
||||
"version": "v1.0.5"
|
||||
},
|
||||
|
||||
@@ -7,27 +7,34 @@
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
||||
#include "common/assert.h"
|
||||
|
||||
#include "dynarmic/backend/x64/block_of_code.h"
|
||||
#include "dynarmic/backend/x64/constant_pool.h"
|
||||
|
||||
namespace Dynarmic::Backend::X64 {
|
||||
|
||||
ConstantPool::ConstantPool(BlockOfCode& code, size_t size) noexcept {
|
||||
auto const align_size = 64; //always align to cacheline
|
||||
code.EnsureMemoryCommitted(2 * align_size + size);
|
||||
ConstantPool::ConstantPool(BlockOfCode& code, size_t size)
|
||||
: insertion_point(0)
|
||||
{
|
||||
code.EnsureMemoryCommitted(align_size + size);
|
||||
code.int3();
|
||||
code.align(align_size);
|
||||
pool = std::span<u128>(static_cast<u128*>(code.AllocateFromCodeSpace(size)), size / sizeof(u128));
|
||||
pool = std::span<ConstantT>(reinterpret_cast<ConstantT*>(code.AllocateFromCodeSpace(size)), size / align_size);
|
||||
}
|
||||
|
||||
Xbyak::Address ConstantPool::GetConstant(BlockOfCode& code, const Xbyak::AddressFrame& frame, u64 lo, u64 hi) noexcept {
|
||||
// offset grows iff new constant is added
|
||||
auto const key = std::make_pair(lo, hi);
|
||||
auto const val = u32(constant_info.size());
|
||||
auto const [it, _] = constant_info.insert({key, val});
|
||||
// if it != constant_info.end(): assume(pool[it->second] == c);
|
||||
pool[it->second] = u128{lo, hi};
|
||||
return frame[code.rip + std::addressof(pool[it->second])];
|
||||
Xbyak::Address ConstantPool::GetConstant(BlockOfCode& code, const Xbyak::AddressFrame& frame, u64 lower, u64 upper) {
|
||||
const auto constant = ConstantT(lower, upper);
|
||||
auto it = constant_info.find(constant);
|
||||
if (it == constant_info.end()) {
|
||||
ASSERT(insertion_point < pool.size());
|
||||
ConstantT& target_constant = pool[insertion_point];
|
||||
target_constant = constant;
|
||||
it = constant_info.insert({constant, &target_constant}).first;
|
||||
++insertion_point;
|
||||
}
|
||||
return frame[code.rip + it->second];
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::Backend::X64
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
#include <utility>
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/container/unordered_map.h"
|
||||
@@ -22,17 +21,31 @@ namespace Dynarmic::Backend::X64 {
|
||||
|
||||
class BlockOfCode;
|
||||
|
||||
/// @brief ConstantPool allocates a block of memory from BlockOfCode.
|
||||
/// ConstantPool allocates a block of memory from BlockOfCode.
|
||||
/// It places constants into this block of memory, returning the address
|
||||
/// of the memory location where the constant is placed. If the constant
|
||||
/// already exists, its memory location is reused.
|
||||
class ConstantPool final {
|
||||
public:
|
||||
ConstantPool(BlockOfCode& code, size_t size) noexcept;
|
||||
Xbyak::Address GetConstant(BlockOfCode& code, const Xbyak::AddressFrame& frame, u64 lower, u64 upper = 0) noexcept;
|
||||
// key = identity hash, value = offset from pool.data()
|
||||
::Common::unordered_map<std::pair<u64, u64>, u32, boost::hash<std::pair<u64, u64>>> constant_info;
|
||||
std::span<u128> pool;
|
||||
ConstantPool(BlockOfCode& code, size_t size);
|
||||
|
||||
Xbyak::Address GetConstant(BlockOfCode& code, const Xbyak::AddressFrame& frame, u64 lower, u64 upper = 0);
|
||||
|
||||
private:
|
||||
static constexpr size_t align_size = 16; // bytes
|
||||
|
||||
using ConstantT = std::pair<u64, u64>;
|
||||
static_assert(sizeof(ConstantT) == align_size);
|
||||
|
||||
struct ConstantHash {
|
||||
std::size_t operator()(const ConstantT& constant) const noexcept {
|
||||
return constant.first ^ std::rotl<u64>(constant.second, 1);
|
||||
}
|
||||
};
|
||||
|
||||
::Common::unordered_map<ConstantT, void*, ConstantHash> constant_info;
|
||||
std::span<ConstantT> pool;
|
||||
std::size_t insertion_point;
|
||||
};
|
||||
|
||||
} // namespace Dynarmic::Backend::X64
|
||||
|
||||
Reference in New Issue
Block a user