FEXCore: Move JITSymbolBuffer to internal header

This definition doesn't need to be exposed in the public API.
This commit is contained in:
Ryan Houdek committed 2024-09-05 13:28:45 -07:00
1 parent d5db8948db
commit f09d511ac8
3 files changed
+31 -31

No files matched your search

@@ -10,13 +10,13 @@
#include <FEXCore/fextl/memory.h>
#include <FEXCore/fextl/vector.h>
#include <chrono>
#include <shared_mutex>
#include <type_traits>
namespace FEXCore {
class LookupCache;
class CompileService;
struct JITSymbolBuffer;
} // namespace FEXCore
namespace FEXCore::Context {
@@ -60,26 +60,6 @@ struct DebugData : public FEXCore::Allocator::FEXAllocOperators {
fextl::vector<FEXCore::CPU::Relocation>* Relocations;
};
// Buffered JIT symbol tracking.
struct JITSymbolBuffer {
// Maximum buffer size to ensure we are a page in size.
constexpr static size_t BUFFER_SIZE = 4096 - (8 * 2);
// Maximum distance until the end of the buffer to do a write.
constexpr static size_t NEEDS_WRITE_DISTANCE = BUFFER_SIZE - 64;
// Maximum time threshhold to wait before a buffer write occurs.
constexpr static std::chrono::milliseconds MAXIMUM_THRESHOLD {100};
JITSymbolBuffer()
: LastWrite {std::chrono::steady_clock::now()} {}
// stead_clock to ensure a monotonic increasing clock.
// In highly stressed situations this can still cause >2% CPU time in vdso_clock_gettime.
// If we need lower CPU time when JIT symbols are enabled then FEX can read the cycle counter directly.
std::chrono::steady_clock::time_point LastWrite {};
size_t Offset {};
char Buffer[BUFFER_SIZE] {};
};
static_assert(sizeof(JITSymbolBuffer) == 4096, "Ensure this is one page in size");
// Special-purpose replacement for std::unique_ptr to allow InternalThreadState to be standard layout.
// Since a NonMovableUniquePtr is neither copyable nor movable, its only function is to own and release the contained object.
template<typename T>