diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-03-14 18:25:43 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-03-14 18:25:43 +0300 |
commit | c7783ffcebf50c210ca2b469f3a52f59eb9045f8 (patch) | |
tree | 6c0885079aaefb96aa502108f458659aa66570de /library/cpp/coroutine/engine/stack/stack_utils.cpp | |
parent | 831543961b2710a44df149e1d363638bc008d265 (diff) | |
download | ydb-c7783ffcebf50c210ca2b469f3a52f59eb9045f8.tar.gz |
intermediate changes
ref:e520cbb2bc5359a80a7e56e636d1404e61f0c48c
Diffstat (limited to 'library/cpp/coroutine/engine/stack/stack_utils.cpp')
-rw-r--r-- | library/cpp/coroutine/engine/stack/stack_utils.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/library/cpp/coroutine/engine/stack/stack_utils.cpp b/library/cpp/coroutine/engine/stack/stack_utils.cpp index 1548529b66..d3076be2c5 100644 --- a/library/cpp/coroutine/engine/stack/stack_utils.cpp +++ b/library/cpp/coroutine/engine/stack/stack_utils.cpp @@ -16,7 +16,7 @@ namespace NCoro::NStack { #ifdef _linux_ - bool GetAlignedMemory(uint64_t sizeInPages, char*& rawPtr, char*& alignedPtr) noexcept { + bool GetAlignedMemory(size_t sizeInPages, char*& rawPtr, char*& alignedPtr) noexcept { Y_ASSERT(sizeInPages); void* ptr = nullptr; @@ -25,18 +25,18 @@ namespace NCoro::NStack { return rawPtr && alignedPtr && !error; } #else - bool GetAlignedMemory(uint64_t sizeInPages, char*& rawPtr, char*& alignedPtr) noexcept { + bool GetAlignedMemory(size_t sizeInPages, char*& rawPtr, char*& alignedPtr) noexcept { Y_ASSERT(sizeInPages); rawPtr = (char*) malloc((sizeInPages + 1) * PageSize); // +1 in case result would be unaligned - alignedPtr = (char*)( ((uint64_t)rawPtr + PageSize - 1) & ~PageSizeMask); + alignedPtr = (char*)( ((size_t)rawPtr + PageSize - 1) & ~PageSizeMask); return rawPtr && alignedPtr; } #endif #ifdef _linux_ - void ReleaseRss(char* alignedPtr, uint64_t numOfPages) noexcept { - Y_VERIFY( !((uint64_t)alignedPtr & PageSizeMask), "Not aligned pointer to release RSS memory"); + void ReleaseRss(char* alignedPtr, size_t numOfPages) noexcept { + Y_VERIFY( !((size_t)alignedPtr & PageSizeMask), "Not aligned pointer to release RSS memory"); if (!numOfPages) { return; } @@ -45,16 +45,16 @@ namespace NCoro::NStack { } } #else - void ReleaseRss(char*, uint64_t) noexcept { + void ReleaseRss(char*, size_t) noexcept { } #endif #ifdef _linux_ - uint64_t CountMapped(char* alignedPtr, uint64_t numOfPages) noexcept { - Y_VERIFY( !((uint64_t)alignedPtr & PageSizeMask) ); + size_t CountMapped(char* alignedPtr, size_t numOfPages) noexcept { + Y_VERIFY( !((size_t)alignedPtr & PageSizeMask) ); Y_ASSERT(numOfPages); - uint64_t result = 0; + size_t result = 0; unsigned char* mappedPages = (unsigned char*) calloc(numOfPages, numOfPages); Y_VERIFY(mappedPages); Y_DEFER { @@ -62,7 +62,7 @@ namespace NCoro::NStack { }; if (!mincore((void*)alignedPtr, numOfPages * PageSize, mappedPages)) { - for (uint64_t i = 0; i < numOfPages; ++i) { + for (size_t i = 0; i < numOfPages; ++i) { if (mappedPages[i] & 1) { ++result; } @@ -76,7 +76,7 @@ namespace NCoro::NStack { } #else - uint64_t CountMapped(char*, uint64_t) noexcept { + size_t CountMapped(char*, size_t) noexcept { return 0; // stub for Windows tests } #endif |