#ifndef MRT_CENTRAL_CACHE_H
#define MRT_CENTRAL_CACHE_H
#include "Base/ImmortalWrapper.h"
#include "MemCommon.h"
namespace MapleRuntime {
class CentralCache {
public:
static CentralCache* GetInstance() { return &*instance; }
size_t FetchRangeObj(void*& start, void*& end, size_t batchNum, size_t alignBytes);
void ReleaseListToSpans(void* start, size_t index);
private:
friend class ImmortalWrapper<CentralCache>;
Span* GetOneSpan(SpanList& list, size_t alignBytes);
SpanList centralCacheSpans[NFREELIST];
private:
CentralCache() noexcept {}
CentralCache(const CentralCache&) = delete;
CentralCache& operator=(const CentralCache&) = delete;
static ImmortalWrapper<CentralCache> instance;
};
}
#endif