diff options
author | alexvru <alexvru@ydb.tech> | 2023-11-09 11:40:47 +0300 |
---|---|---|
committer | alexvru <alexvru@ydb.tech> | 2023-11-09 12:12:45 +0300 |
commit | c576fbcfb493c33a2342baeef87219b1839889c5 (patch) | |
tree | 1569ecdf367aa7b15329cbf6f010f7388757b473 /library/cpp/actors/core/actor.cpp | |
parent | 271de17955e199c5c8c7775734d3ac519c06c497 (diff) | |
download | ydb-c576fbcfb493c33a2342baeef87219b1839889c5.tar.gz |
Fix TlsActivationContext caching by compiler KIKIMR-19993
Diffstat (limited to 'library/cpp/actors/core/actor.cpp')
-rw-r--r-- | library/cpp/actors/core/actor.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/library/cpp/actors/core/actor.cpp b/library/cpp/actors/core/actor.cpp index ddd849d285..6d6c92f431 100644 --- a/library/cpp/actors/core/actor.cpp +++ b/library/cpp/actors/core/actor.cpp @@ -6,7 +6,34 @@ namespace NActors { Y_POD_THREAD(TThreadContext*) TlsThreadContext(nullptr); - Y_POD_THREAD(TActivationContext*) TlsActivationContext(nullptr); + thread_local TActivationContext *TActivationContextHolder::Value = nullptr; + TActivationContextHolder TlsActivationContext; + + [[gnu::noinline]] TActivationContextHolder::operator bool() const { + asm volatile(""); + return Value != nullptr; + } + + [[gnu::noinline]] TActivationContextHolder::operator TActivationContext*() const { + asm volatile(""); + return Value; + } + + [[gnu::noinline]] TActivationContext *TActivationContextHolder::operator ->() { + asm volatile(""); + return Value; + } + + [[gnu::noinline]] TActivationContext& TActivationContextHolder::operator *() { + asm volatile(""); + return *Value; + } + + [[gnu::noinline]] TActivationContextHolder& TActivationContextHolder::operator =(TActivationContext *context) { + asm volatile(""); + Value = context; + return *this; + } template<i64 Increment> static void UpdateQueueSizeAndTimestamp(TActorUsageImpl<true>& impl, ui64 time) { |