#include "Base/ImmortalWrapper.h"
#include "Heap/Allocator/RegionInfo.h"
#include "Heap/Allocator/RegionSpace.h"
#include "ForwardDataManager.h"
#include "LiveInfo.h"
namespace MapleRuntime {
uintptr_t RouteInfo::GetRoute(uint64_t preLiveBytes)
{
if (preLiveBytes < toRegion1UsedBytes) {
return toRegion1StartAddress + preLiveBytes;
} else {
CHECK(toRegion2Idx != INVALID_VALUE);
RegionInfo* toRegion2 = reinterpret_cast<RegionInfo*>(RegionInfo::GetRegionInfo(toRegion2Idx));
return toRegion2->GetRegionStart() + (preLiveBytes - toRegion1UsedBytes);
}
}
}