Commit 5830d745 by Nicolas Capens Committed by Nicolas Capens

Enable named mmap usage for CMake builds

Naming 'anonymous' mmap memory, which we use for Reactor's executable memory, enables profilers to attribute JIT-compiled routine execution to SwiftShader. Also suppress a GCC warning about not using the result of ftruncate(). Bug: b/174801963 Bug: b/178614275 Change-Id: Iac4938f332f0e75a9b1d995c83f0cbaaf3532651 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52228Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Commit-Queue: Nicolas Capens <nicolascapens@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent 0cbf89c7
...@@ -72,6 +72,8 @@ if(REACTOR_ENABLE_MEMORY_SANITIZER_INSTRUMENTATION) ...@@ -72,6 +72,8 @@ if(REACTOR_ENABLE_MEMORY_SANITIZER_INSTRUMENTATION)
list(APPEND REACTOR_PUBLIC_COMPILE_DEFINITIONS "REACTOR_ENABLE_MEMORY_SANITIZER_INSTRUMENTATION") list(APPEND REACTOR_PUBLIC_COMPILE_DEFINITIONS "REACTOR_ENABLE_MEMORY_SANITIZER_INSTRUMENTATION")
endif() endif()
list(APPEND REACTOR_PRIVATE_COMPILE_DEFINITIONS "REACTOR_ANONYMOUS_MMAP_NAME=swiftshader_jit")
# SubzeroReactor library # SubzeroReactor library
add_library(ReactorSubzero STATIC EXCLUDE_FROM_ALL add_library(ReactorSubzero STATIC EXCLUDE_FROM_ALL
......
...@@ -172,7 +172,8 @@ void ensureAnonFileSize(int anonFd, size_t length) ...@@ -172,7 +172,8 @@ void ensureAnonFileSize(int anonFd, size_t length)
static size_t fileSize = 0; static size_t fileSize = 0;
if(length > fileSize) if(length > fileSize)
{ {
ftruncate(anonFd, length); [[maybe_unused]] int result = ftruncate(anonFd, length);
ASSERT(result == 0);
fileSize = length; fileSize = length;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment