Compare commits

..

No commits in common. "2628784ff604bdea0280d12c2f341e323838f9c9" and "2d2523e679705693dda00750f188ff4c1b5059b8" have entirely different histories.

5 changed files with 28 additions and 41 deletions

View File

@ -375,6 +375,16 @@ namespace Aurora::Memory
inline auline AuUInt Write(const void *buffer, AuUInt requestLength);
inline auline AuUInt Read(void *out, AuUInt requestedLength, bool peek = false);
inline auline AuUInt Write(const MemoryViewRead &read)
{
return Write(read.ptr, read.length);
}
inline auline AuUInt Read(const MemoryViewWrite &write)
{
return Read(write.ptr, write.length);
}
// String API
inline bool WriteString(AuROString string, EStringType type = EStringType::eStringDword, Locale::ECodePage codepage = Locale::ECodePage::eUTF8);
@ -401,24 +411,13 @@ namespace Aurora::Memory
T ReadChecked();
template<typename T>
using ReadHack_t = AuConditional_t<AuIsSame_v<MemoryViewWrite, T>, AuUInt, bool>;
bool Write(const T &in);
template<typename T>
using WriteHack_t = AuConditional_t<AuIsSame_v<MemoryViewRead, T>, AuUInt, bool>;
bool Write(T &in);
template<typename T>
WriteHack_t<T> Write(const T &in);
template<typename T>
WriteHack_t<T> Write(T &in);
template<typename T>
ReadHack_t<T> Read(T &out);
inline auline AuUInt Read(const MemoryViewWrite &write)
{
return Read(write.ptr, write.length);
}
bool Read(T &out);
template<typename T>
bool WriteTagged(const T &in);

View File

@ -150,15 +150,11 @@ namespace Aurora::Memory
}
template<typename T>
ByteBuffer::ReadHack_t<T> ByteBuffer::Read(T &out)
bool ByteBuffer::Read(T &out)
{
if constexpr (AuIsClass_v<T>)
{
if constexpr (AuIsSame_v<T, MemoryViewWrite>)
{
return Read(out.ptr, out.length);
}
else if constexpr (__detail::AuHasDeserializeBool<AuRemoveReference_t<T>>::type::value)
if constexpr (__detail::AuHasDeserializeBool<AuRemoveReference_t<T>>::type::value)
{
if (!out.Deserialize(*this))
{
@ -335,16 +331,12 @@ namespace Aurora::Memory
}
template<typename T>
ByteBuffer::WriteHack_t<T> ByteBuffer::Write(T &in)
bool ByteBuffer::Write(T &in)
{
if constexpr (AuIsClass_v<T>)
{
if constexpr (AuIsSame_v<T, MemoryViewRead>)
{
return Write(in.ptr, in.length);
}
else if constexpr (__detail::AuHasSerializeBool<AuRemoveReference_t<T>>::type::value ||
__detail::AuHasSerializeBool2<AuRemoveReference_t<T>>::type::value)
if constexpr (__detail::AuHasSerializeBool<AuRemoveReference_t<T>>::type::value ||
__detail::AuHasSerializeBool2<AuRemoveReference_t<T>>::type::value)
{
if (!in.Serialize(*this))
{
@ -374,15 +366,11 @@ namespace Aurora::Memory
}
template<typename T>
ByteBuffer::WriteHack_t<T> ByteBuffer::Write(const T &in)
bool ByteBuffer::Write(const T &in)
{
if constexpr (AuIsClass_v<T>)
{
if constexpr (AuIsSame_v<T, MemoryViewRead>)
{
return Write(in.ptr, in.length);
}
else if constexpr (__detail::AuHasSerializeBool2<AuRemoveReference_t<T>>::type::value)
if constexpr (__detail::AuHasSerializeBool2<AuRemoveReference_t<T>>::type::value)
{
if (!in.Serialize(*this))
{

View File

@ -11,8 +11,8 @@ namespace Aurora::Memory
{
struct HeapStats
{
AuUInt uBytesAllocatedLifetime {};
AuUInt uBytesFreeLifetime {};
AuUInt64 qwBytesAllocatedLifetime {};
AuUInt64 qwBytesFreeLifetime {};
AuUInt uBytesCapacity {};

View File

@ -26,9 +26,9 @@ namespace Aurora::Memory
auto &stats = this->pHeap->GetStats();
this->stats.uBytesLiveCounter = this->uBytesAllocated;
this->stats.uBytesAllocatedLifetime = this->uBytesLifetime;
this->stats.qwBytesAllocatedLifetime = this->uBytesLifetime;
this->stats.uBytesPeakCounter = this->uBytesPeak;
this->stats.uBytesFreeLifetime = this->uBytesFree;
this->stats.qwBytesFreeLifetime = this->uBytesFree;
this->stats.uBytesCapacity = stats.uBytesCapacity;
}

View File

@ -13,10 +13,10 @@ namespace Aurora::Memory
std::shared_ptr<Heap> pHeap;
LeakFinderAlloc_f pAlloc;
LeakFinderFree_f pFree;
AuUInt uBytesAllocated {}; // current
AuUInt uBytesPeak {}; // max
AuUInt uBytesFree {}; // free count
AuUInt uBytesLifetime {}; // alloc count
AuUInt64 uBytesAllocated {}; // current
AuUInt64 uBytesPeak {}; // max
AuUInt64 uBytesFree {}; // free count
AuUInt64 uBytesLifetime {}; // alloc count
ProxyHeap(std::shared_ptr<Heap> pHeap,
LeakFinderAlloc_f pAlloc = {},