mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-18 04:54:36 +03:00
Improved JitAllocator to not reiterate the whole block on every allocation
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -207,12 +207,12 @@ public:
|
|||||||
//! Release a memory returned by `alloc()`.
|
//! Release a memory returned by `alloc()`.
|
||||||
//!
|
//!
|
||||||
//! \remarks This function is thread-safe.
|
//! \remarks This function is thread-safe.
|
||||||
ASMJIT_API Error release(void* ro) noexcept;
|
ASMJIT_API Error release(void* roPtr) noexcept;
|
||||||
|
|
||||||
//! Free extra memory allocated with `p` by restricting it to `newSize` size.
|
//! Free extra memory allocated with `p` by restricting it to `newSize` size.
|
||||||
//!
|
//!
|
||||||
//! \remarks This function is thread-safe.
|
//! \remarks This function is thread-safe.
|
||||||
ASMJIT_API Error shrink(void* ro, size_t newSize) noexcept;
|
ASMJIT_API Error shrink(void* roPtr, size_t newSize) noexcept;
|
||||||
|
|
||||||
//! \}
|
//! \}
|
||||||
|
|
||||||
|
|||||||
@@ -1165,6 +1165,30 @@ public:
|
|||||||
T _bitWord;
|
T _bitWord;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// [asmjit::Support - BitWordFlipIterator]
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class BitWordFlipIterator {
|
||||||
|
public:
|
||||||
|
inline explicit BitWordFlipIterator(T bitWord) noexcept
|
||||||
|
: _bitWord(bitWord) {}
|
||||||
|
|
||||||
|
inline void init(T bitWord) noexcept { _bitWord = bitWord; }
|
||||||
|
inline bool hasNext() const noexcept { return _bitWord != 0; }
|
||||||
|
|
||||||
|
inline uint32_t nextAndFlip() noexcept {
|
||||||
|
ASMJIT_ASSERT(_bitWord != 0);
|
||||||
|
uint32_t index = ctz(_bitWord);
|
||||||
|
_bitWord ^= T(1u) << index;
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
T _bitWord;
|
||||||
|
T _xorMask;
|
||||||
|
};
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// [asmjit::Support - BitVectorOps]
|
// [asmjit::Support - BitVectorOps]
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user