From 8c8a4c1d7d49f7f55e2d3b30f638b53b7c890273 Mon Sep 17 00:00:00 2001
From: ivanmorozov <ivanmorozov@yandex-team.com>
Date: Tue, 18 Jul 2023 13:46:54 +0300
Subject: guard for memory markers + split actor type operators

---
 library/cpp/actors/CMakeLists.txt                  |  1 +
 .../actors/actor_type/CMakeLists.darwin-x86_64.txt | 33 +++++++++++
 .../actors/actor_type/CMakeLists.linux-aarch64.txt | 34 +++++++++++
 .../actors/actor_type/CMakeLists.linux-x86_64.txt  | 34 +++++++++++
 library/cpp/actors/actor_type/CMakeLists.txt       | 17 ++++++
 .../actor_type/CMakeLists.windows-x86_64.txt       | 33 +++++++++++
 library/cpp/actors/actor_type/common.cpp           |  5 ++
 library/cpp/actors/actor_type/common.h             | 34 +++++++++++
 .../cpp/actors/actor_type/index_constructor.cpp    |  5 ++
 library/cpp/actors/actor_type/index_constructor.h  | 12 ++++
 library/cpp/actors/actor_type/indexes.cpp          |  5 ++
 library/cpp/actors/actor_type/indexes.h            | 31 ++++++++++
 library/cpp/actors/actor_type/ya.make              | 16 +++++
 .../cpp/actors/core/CMakeLists.darwin-x86_64.txt   | 14 +----
 .../cpp/actors/core/CMakeLists.linux-aarch64.txt   | 14 +----
 .../cpp/actors/core/CMakeLists.linux-x86_64.txt    | 14 +----
 .../cpp/actors/core/CMakeLists.windows-x86_64.txt  | 14 +----
 library/cpp/actors/core/actor.h                    |  2 +-
 library/cpp/actors/core/event_load.cpp             |  5 ++
 library/cpp/actors/core/executor_pool_basic.h      |  2 +-
 library/cpp/actors/core/executor_pool_io.h         |  2 +-
 .../cpp/actors/core/executor_pool_united_workers.h |  2 +-
 library/cpp/actors/core/indexes.cpp                |  0
 library/cpp/actors/core/indexes.h                  | 68 ----------------------
 library/cpp/actors/core/ya.make                    |  5 +-
 library/cpp/actors/prof/tag.cpp                    | 12 ++++
 library/cpp/actors/prof/tag.h                      | 13 ++++-
 library/cpp/actors/util/local_process_key.h        |  1 -
 28 files changed, 303 insertions(+), 125 deletions(-)
 create mode 100644 library/cpp/actors/actor_type/CMakeLists.darwin-x86_64.txt
 create mode 100644 library/cpp/actors/actor_type/CMakeLists.linux-aarch64.txt
 create mode 100644 library/cpp/actors/actor_type/CMakeLists.linux-x86_64.txt
 create mode 100644 library/cpp/actors/actor_type/CMakeLists.txt
 create mode 100644 library/cpp/actors/actor_type/CMakeLists.windows-x86_64.txt
 create mode 100644 library/cpp/actors/actor_type/common.cpp
 create mode 100644 library/cpp/actors/actor_type/common.h
 create mode 100644 library/cpp/actors/actor_type/index_constructor.cpp
 create mode 100644 library/cpp/actors/actor_type/index_constructor.h
 create mode 100644 library/cpp/actors/actor_type/indexes.cpp
 create mode 100644 library/cpp/actors/actor_type/indexes.h
 create mode 100644 library/cpp/actors/actor_type/ya.make
 create mode 100644 library/cpp/actors/core/event_load.cpp
 delete mode 100644 library/cpp/actors/core/indexes.cpp
 delete mode 100644 library/cpp/actors/core/indexes.h

(limited to 'library')

diff --git a/library/cpp/actors/CMakeLists.txt b/library/cpp/actors/CMakeLists.txt
index 583970ecf5..45fe46a94d 100644
--- a/library/cpp/actors/CMakeLists.txt
+++ b/library/cpp/actors/CMakeLists.txt
@@ -6,6 +6,7 @@
 # original buildsystem will not be accepted.
 
 
+add_subdirectory(actor_type)
 add_subdirectory(core)
 add_subdirectory(dnscachelib)
 add_subdirectory(dnsresolver)
diff --git a/library/cpp/actors/actor_type/CMakeLists.darwin-x86_64.txt b/library/cpp/actors/actor_type/CMakeLists.darwin-x86_64.txt
new file mode 100644
index 0000000000..825e96d2d8
--- /dev/null
+++ b/library/cpp/actors/actor_type/CMakeLists.darwin-x86_64.txt
@@ -0,0 +1,33 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+get_built_tool_path(
+  TOOL_enum_parser_bin
+  TOOL_enum_parser_dependency
+  tools/enum_parser/enum_parser
+  enum_parser
+)
+
+add_library(cpp-actors-actor_type)
+target_link_libraries(cpp-actors-actor_type PUBLIC
+  contrib-libs-cxxsupp
+  yutil
+  cpp-actors-util
+  cpp-actors-prof
+  tools-enum_parser-enum_serialization_runtime
+)
+target_sources(cpp-actors-actor_type PRIVATE
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/common.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/indexes.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/index_constructor.cpp
+)
+generate_enum_serilization(cpp-actors-actor_type
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/common.h
+  INCLUDE_HEADERS
+  library/cpp/actors/actor_type/common.h
+)
diff --git a/library/cpp/actors/actor_type/CMakeLists.linux-aarch64.txt b/library/cpp/actors/actor_type/CMakeLists.linux-aarch64.txt
new file mode 100644
index 0000000000..dc1ebb7a22
--- /dev/null
+++ b/library/cpp/actors/actor_type/CMakeLists.linux-aarch64.txt
@@ -0,0 +1,34 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+get_built_tool_path(
+  TOOL_enum_parser_bin
+  TOOL_enum_parser_dependency
+  tools/enum_parser/enum_parser
+  enum_parser
+)
+
+add_library(cpp-actors-actor_type)
+target_link_libraries(cpp-actors-actor_type PUBLIC
+  contrib-libs-linux-headers
+  contrib-libs-cxxsupp
+  yutil
+  cpp-actors-util
+  cpp-actors-prof
+  tools-enum_parser-enum_serialization_runtime
+)
+target_sources(cpp-actors-actor_type PRIVATE
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/common.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/indexes.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/index_constructor.cpp
+)
+generate_enum_serilization(cpp-actors-actor_type
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/common.h
+  INCLUDE_HEADERS
+  library/cpp/actors/actor_type/common.h
+)
diff --git a/library/cpp/actors/actor_type/CMakeLists.linux-x86_64.txt b/library/cpp/actors/actor_type/CMakeLists.linux-x86_64.txt
new file mode 100644
index 0000000000..dc1ebb7a22
--- /dev/null
+++ b/library/cpp/actors/actor_type/CMakeLists.linux-x86_64.txt
@@ -0,0 +1,34 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+get_built_tool_path(
+  TOOL_enum_parser_bin
+  TOOL_enum_parser_dependency
+  tools/enum_parser/enum_parser
+  enum_parser
+)
+
+add_library(cpp-actors-actor_type)
+target_link_libraries(cpp-actors-actor_type PUBLIC
+  contrib-libs-linux-headers
+  contrib-libs-cxxsupp
+  yutil
+  cpp-actors-util
+  cpp-actors-prof
+  tools-enum_parser-enum_serialization_runtime
+)
+target_sources(cpp-actors-actor_type PRIVATE
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/common.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/indexes.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/index_constructor.cpp
+)
+generate_enum_serilization(cpp-actors-actor_type
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/common.h
+  INCLUDE_HEADERS
+  library/cpp/actors/actor_type/common.h
+)
diff --git a/library/cpp/actors/actor_type/CMakeLists.txt b/library/cpp/actors/actor_type/CMakeLists.txt
new file mode 100644
index 0000000000..f8b31df0c1
--- /dev/null
+++ b/library/cpp/actors/actor_type/CMakeLists.txt
@@ -0,0 +1,17 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA)
+  include(CMakeLists.linux-aarch64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+  include(CMakeLists.darwin-x86_64.txt)
+elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA)
+  include(CMakeLists.windows-x86_64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA)
+  include(CMakeLists.linux-x86_64.txt)
+endif()
diff --git a/library/cpp/actors/actor_type/CMakeLists.windows-x86_64.txt b/library/cpp/actors/actor_type/CMakeLists.windows-x86_64.txt
new file mode 100644
index 0000000000..825e96d2d8
--- /dev/null
+++ b/library/cpp/actors/actor_type/CMakeLists.windows-x86_64.txt
@@ -0,0 +1,33 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+get_built_tool_path(
+  TOOL_enum_parser_bin
+  TOOL_enum_parser_dependency
+  tools/enum_parser/enum_parser
+  enum_parser
+)
+
+add_library(cpp-actors-actor_type)
+target_link_libraries(cpp-actors-actor_type PUBLIC
+  contrib-libs-cxxsupp
+  yutil
+  cpp-actors-util
+  cpp-actors-prof
+  tools-enum_parser-enum_serialization_runtime
+)
+target_sources(cpp-actors-actor_type PRIVATE
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/common.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/indexes.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/index_constructor.cpp
+)
+generate_enum_serilization(cpp-actors-actor_type
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/actor_type/common.h
+  INCLUDE_HEADERS
+  library/cpp/actors/actor_type/common.h
+)
diff --git a/library/cpp/actors/actor_type/common.cpp b/library/cpp/actors/actor_type/common.cpp
new file mode 100644
index 0000000000..be8569b7f5
--- /dev/null
+++ b/library/cpp/actors/actor_type/common.cpp
@@ -0,0 +1,5 @@
+#include "common.h"
+
+namespace NActors {
+
+}
diff --git a/library/cpp/actors/actor_type/common.h b/library/cpp/actors/actor_type/common.h
new file mode 100644
index 0000000000..cfda827c3f
--- /dev/null
+++ b/library/cpp/actors/actor_type/common.h
@@ -0,0 +1,34 @@
+#pragma once
+namespace NActors {
+
+struct TActorActivityTag {};
+
+}
+
+namespace NActors {
+enum class EInternalActorType {
+    OTHER = 0,
+    INCORRECT_ACTOR_TYPE_INDEX,
+    ACTOR_SYSTEM,
+    ACTORLIB_COMMON,
+    ACTORLIB_STATS,
+    LOG_ACTOR,
+    INTERCONNECT_PROXY_TCP,
+    INTERCONNECT_SESSION_TCP,
+    INTERCONNECT_COMMON,
+    SELF_PING_ACTOR,
+    TEST_ACTOR_RUNTIME,
+    INTERCONNECT_HANDSHAKE,
+    INTERCONNECT_POLLER,
+    INTERCONNECT_SESSION_KILLER,
+    ACTOR_SYSTEM_SCHEDULER_ACTOR,
+    ACTOR_FUTURE_CALLBACK,
+    INTERCONNECT_MONACTOR,
+    INTERCONNECT_LOAD_ACTOR,
+    INTERCONNECT_LOAD_RESPONDER,
+    NAMESERVICE,
+    DNS_RESOLVER,
+    INTERCONNECT_PROXY_WRAPPER,
+    ACTOR_COROUTINE
+};
+}
diff --git a/library/cpp/actors/actor_type/index_constructor.cpp b/library/cpp/actors/actor_type/index_constructor.cpp
new file mode 100644
index 0000000000..667d3617c3
--- /dev/null
+++ b/library/cpp/actors/actor_type/index_constructor.cpp
@@ -0,0 +1,5 @@
+#include "index_constructor.h"
+
+namespace NActors {
+
+}
diff --git a/library/cpp/actors/actor_type/index_constructor.h b/library/cpp/actors/actor_type/index_constructor.h
new file mode 100644
index 0000000000..b533643a61
--- /dev/null
+++ b/library/cpp/actors/actor_type/index_constructor.h
@@ -0,0 +1,12 @@
+#pragma once
+#include "common.h"
+#include <library/cpp/actors/util/local_process_key.h>
+#include <library/cpp/actors/prof/tag.h>
+
+template <>
+class TLocalProcessKeyStateIndexConstructor<NActors::TActorActivityTag> {
+public:
+    static ui32 BuildCurrentIndex(const TStringBuf name, const ui32 /*currentNamesCount*/) {
+        return NProfiling::MakeTag(name.data());
+    }
+};
diff --git a/library/cpp/actors/actor_type/indexes.cpp b/library/cpp/actors/actor_type/indexes.cpp
new file mode 100644
index 0000000000..628eae08d8
--- /dev/null
+++ b/library/cpp/actors/actor_type/indexes.cpp
@@ -0,0 +1,5 @@
+#include "indexes.h"
+
+namespace NActors {
+
+}
diff --git a/library/cpp/actors/actor_type/indexes.h b/library/cpp/actors/actor_type/indexes.h
new file mode 100644
index 0000000000..a971847056
--- /dev/null
+++ b/library/cpp/actors/actor_type/indexes.h
@@ -0,0 +1,31 @@
+#pragma once
+#include "common.h"
+#include "index_constructor.h"
+#include <library/cpp/actors/util/local_process_key.h>
+
+namespace NActors {
+
+class TActorTypeOperator {
+public:
+    static constexpr ui32 GetMaxAvailableActorsCount() {
+        return TLocalProcessKeyStateIndexLimiter::GetMaxKeysCount();
+    }
+
+    template <class TEnum>
+    static ui32 GetEnumActivityType(const TEnum enumValue) {
+        return TEnumProcessKey<TActorActivityTag, TEnum>::GetIndex(enumValue);
+    }
+
+    static ui32 GetActorSystemIndex() {
+        return TEnumProcessKey<TActorActivityTag, EInternalActorType>::GetIndex(EInternalActorType::ACTOR_SYSTEM);
+    }
+
+    static ui32 GetOtherActivityIndex() {
+        return TEnumProcessKey<TActorActivityTag, EInternalActorType>::GetIndex(EInternalActorType::OTHER);
+    }
+
+    static ui32 GetActorActivityIncorrectIndex() {
+        return TEnumProcessKey<TActorActivityTag, EInternalActorType>::GetIndex(EInternalActorType::INCORRECT_ACTOR_TYPE_INDEX);
+    }
+};
+}
diff --git a/library/cpp/actors/actor_type/ya.make b/library/cpp/actors/actor_type/ya.make
new file mode 100644
index 0000000000..736e99cf49
--- /dev/null
+++ b/library/cpp/actors/actor_type/ya.make
@@ -0,0 +1,16 @@
+LIBRARY()
+
+SRCS(
+    common.cpp
+    indexes.cpp
+    index_constructor.cpp
+)
+
+PEERDIR(
+    library/cpp/actors/util
+    library/cpp/actors/prof
+)
+
+GENERATE_ENUM_SERIALIZATION(common.h)
+
+END()
diff --git a/library/cpp/actors/core/CMakeLists.darwin-x86_64.txt b/library/cpp/actors/core/CMakeLists.darwin-x86_64.txt
index ad0db0f571..c5c1629513 100644
--- a/library/cpp/actors/core/CMakeLists.darwin-x86_64.txt
+++ b/library/cpp/actors/core/CMakeLists.darwin-x86_64.txt
@@ -25,18 +25,13 @@ get_built_tool_path(
   tools/enum_parser/enum_parser
   enum_parser
 )
-get_built_tool_path(
-  TOOL_enum_parser_bin
-  TOOL_enum_parser_dependency
-  tools/enum_parser/enum_parser
-  enum_parser
-)
 
 add_library(cpp-actors-core)
 target_link_libraries(cpp-actors-core PUBLIC
   contrib-libs-cxxsupp
   yutil
   tools-enum_parser-enum_serialization_runtime
+  cpp-actors-actor_type
   cpp-actors-memory_log
   cpp-actors-prof
   cpp-actors-protos
@@ -64,6 +59,7 @@ target_sources(cpp-actors-core PRIVATE
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/callstack.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/cpu_manager.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event_load.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event_pb.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/events_undelivered.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/executor_pool_base.cpp
@@ -73,7 +69,6 @@ target_sources(cpp-actors-core PRIVATE
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/executor_thread.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/harmonizer.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/interconnect.cpp
-  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/indexes.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/io_dispatcher.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log_settings.cpp
@@ -98,11 +93,6 @@ generate_enum_serilization(cpp-actors-core
   INCLUDE_HEADERS
   library/cpp/actors/core/actor.h
 )
-generate_enum_serilization(cpp-actors-core
-  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/indexes.h
-  INCLUDE_HEADERS
-  library/cpp/actors/core/indexes.h
-)
 generate_enum_serilization(cpp-actors-core
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log_iface.h
   INCLUDE_HEADERS
diff --git a/library/cpp/actors/core/CMakeLists.linux-aarch64.txt b/library/cpp/actors/core/CMakeLists.linux-aarch64.txt
index 25276b5598..23f4e3ba64 100644
--- a/library/cpp/actors/core/CMakeLists.linux-aarch64.txt
+++ b/library/cpp/actors/core/CMakeLists.linux-aarch64.txt
@@ -25,12 +25,6 @@ get_built_tool_path(
   tools/enum_parser/enum_parser
   enum_parser
 )
-get_built_tool_path(
-  TOOL_enum_parser_bin
-  TOOL_enum_parser_dependency
-  tools/enum_parser/enum_parser
-  enum_parser
-)
 
 add_library(cpp-actors-core)
 target_link_libraries(cpp-actors-core PUBLIC
@@ -38,6 +32,7 @@ target_link_libraries(cpp-actors-core PUBLIC
   contrib-libs-cxxsupp
   yutil
   tools-enum_parser-enum_serialization_runtime
+  cpp-actors-actor_type
   cpp-actors-memory_log
   cpp-actors-prof
   cpp-actors-protos
@@ -65,6 +60,7 @@ target_sources(cpp-actors-core PRIVATE
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/callstack.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/cpu_manager.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event_load.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event_pb.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/events_undelivered.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/executor_pool_base.cpp
@@ -74,7 +70,6 @@ target_sources(cpp-actors-core PRIVATE
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/executor_thread.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/harmonizer.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/interconnect.cpp
-  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/indexes.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/io_dispatcher.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log_settings.cpp
@@ -99,11 +94,6 @@ generate_enum_serilization(cpp-actors-core
   INCLUDE_HEADERS
   library/cpp/actors/core/actor.h
 )
-generate_enum_serilization(cpp-actors-core
-  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/indexes.h
-  INCLUDE_HEADERS
-  library/cpp/actors/core/indexes.h
-)
 generate_enum_serilization(cpp-actors-core
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log_iface.h
   INCLUDE_HEADERS
diff --git a/library/cpp/actors/core/CMakeLists.linux-x86_64.txt b/library/cpp/actors/core/CMakeLists.linux-x86_64.txt
index 25276b5598..23f4e3ba64 100644
--- a/library/cpp/actors/core/CMakeLists.linux-x86_64.txt
+++ b/library/cpp/actors/core/CMakeLists.linux-x86_64.txt
@@ -25,12 +25,6 @@ get_built_tool_path(
   tools/enum_parser/enum_parser
   enum_parser
 )
-get_built_tool_path(
-  TOOL_enum_parser_bin
-  TOOL_enum_parser_dependency
-  tools/enum_parser/enum_parser
-  enum_parser
-)
 
 add_library(cpp-actors-core)
 target_link_libraries(cpp-actors-core PUBLIC
@@ -38,6 +32,7 @@ target_link_libraries(cpp-actors-core PUBLIC
   contrib-libs-cxxsupp
   yutil
   tools-enum_parser-enum_serialization_runtime
+  cpp-actors-actor_type
   cpp-actors-memory_log
   cpp-actors-prof
   cpp-actors-protos
@@ -65,6 +60,7 @@ target_sources(cpp-actors-core PRIVATE
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/callstack.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/cpu_manager.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event_load.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event_pb.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/events_undelivered.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/executor_pool_base.cpp
@@ -74,7 +70,6 @@ target_sources(cpp-actors-core PRIVATE
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/executor_thread.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/harmonizer.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/interconnect.cpp
-  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/indexes.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/io_dispatcher.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log_settings.cpp
@@ -99,11 +94,6 @@ generate_enum_serilization(cpp-actors-core
   INCLUDE_HEADERS
   library/cpp/actors/core/actor.h
 )
-generate_enum_serilization(cpp-actors-core
-  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/indexes.h
-  INCLUDE_HEADERS
-  library/cpp/actors/core/indexes.h
-)
 generate_enum_serilization(cpp-actors-core
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log_iface.h
   INCLUDE_HEADERS
diff --git a/library/cpp/actors/core/CMakeLists.windows-x86_64.txt b/library/cpp/actors/core/CMakeLists.windows-x86_64.txt
index ad0db0f571..c5c1629513 100644
--- a/library/cpp/actors/core/CMakeLists.windows-x86_64.txt
+++ b/library/cpp/actors/core/CMakeLists.windows-x86_64.txt
@@ -25,18 +25,13 @@ get_built_tool_path(
   tools/enum_parser/enum_parser
   enum_parser
 )
-get_built_tool_path(
-  TOOL_enum_parser_bin
-  TOOL_enum_parser_dependency
-  tools/enum_parser/enum_parser
-  enum_parser
-)
 
 add_library(cpp-actors-core)
 target_link_libraries(cpp-actors-core PUBLIC
   contrib-libs-cxxsupp
   yutil
   tools-enum_parser-enum_serialization_runtime
+  cpp-actors-actor_type
   cpp-actors-memory_log
   cpp-actors-prof
   cpp-actors-protos
@@ -64,6 +59,7 @@ target_sources(cpp-actors-core PRIVATE
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/callstack.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/cpu_manager.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event.cpp
+  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event_load.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/event_pb.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/events_undelivered.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/executor_pool_base.cpp
@@ -73,7 +69,6 @@ target_sources(cpp-actors-core PRIVATE
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/executor_thread.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/harmonizer.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/interconnect.cpp
-  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/indexes.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/io_dispatcher.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log.cpp
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log_settings.cpp
@@ -98,11 +93,6 @@ generate_enum_serilization(cpp-actors-core
   INCLUDE_HEADERS
   library/cpp/actors/core/actor.h
 )
-generate_enum_serilization(cpp-actors-core
-  ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/indexes.h
-  INCLUDE_HEADERS
-  library/cpp/actors/core/indexes.h
-)
 generate_enum_serilization(cpp-actors-core
   ${CMAKE_SOURCE_DIR}/library/cpp/actors/core/log_iface.h
   INCLUDE_HEADERS
diff --git a/library/cpp/actors/core/actor.h b/library/cpp/actors/core/actor.h
index d80feb195d..9fbb942ed2 100644
--- a/library/cpp/actors/core/actor.h
+++ b/library/cpp/actors/core/actor.h
@@ -4,7 +4,7 @@
 #include "event.h"
 #include "executor_thread.h"
 #include "monotonic.h"
-#include "indexes.h"
+#include <library/cpp/actors/actor_type/indexes.h>
 
 #include <library/cpp/actors/util/local_process_key.h>
 
diff --git a/library/cpp/actors/core/event_load.cpp b/library/cpp/actors/core/event_load.cpp
new file mode 100644
index 0000000000..2171678bfb
--- /dev/null
+++ b/library/cpp/actors/core/event_load.cpp
@@ -0,0 +1,5 @@
+#include "event_load.h"
+
+namespace NActors {
+
+}
diff --git a/library/cpp/actors/core/executor_pool_basic.h b/library/cpp/actors/core/executor_pool_basic.h
index e58718a225..2a727fafd5 100644
--- a/library/cpp/actors/core/executor_pool_basic.h
+++ b/library/cpp/actors/core/executor_pool_basic.h
@@ -4,8 +4,8 @@
 #include "executor_thread.h"
 #include "scheduler_queue.h"
 #include "executor_pool_base.h"
-#include "indexes.h"
 #include "harmonizer.h"
+#include <library/cpp/actors/actor_type/indexes.h>
 #include <library/cpp/actors/util/unordered_cache.h>
 #include <library/cpp/actors/util/threadparkpad.h>
 #include <library/cpp/monlib/dynamic_counters/counters.h>
diff --git a/library/cpp/actors/core/executor_pool_io.h b/library/cpp/actors/core/executor_pool_io.h
index 6b37d095ac..f3f1a11819 100644
--- a/library/cpp/actors/core/executor_pool_io.h
+++ b/library/cpp/actors/core/executor_pool_io.h
@@ -4,7 +4,7 @@
 #include "executor_thread.h"
 #include "scheduler_queue.h"
 #include "executor_pool_base.h"
-#include "indexes.h"
+#include <library/cpp/actors/actor_type/indexes.h>
 #include <library/cpp/actors/util/ticket_lock.h>
 #include <library/cpp/actors/util/unordered_cache.h>
 #include <library/cpp/actors/util/threadparkpad.h>
diff --git a/library/cpp/actors/core/executor_pool_united_workers.h b/library/cpp/actors/core/executor_pool_united_workers.h
index 2b96eda762..b088b582f6 100644
--- a/library/cpp/actors/core/executor_pool_united_workers.h
+++ b/library/cpp/actors/core/executor_pool_united_workers.h
@@ -2,9 +2,9 @@
 
 #include "defs.h"
 #include "balancer.h"
-#include "indexes.h"
 #include "scheduler_queue.h"
 
+#include <library/cpp/actors/actor_type/indexes.h>
 #include <library/cpp/actors/util/cpu_load_log.h>
 #include <library/cpp/actors/util/datetime.h>
 #include <util/generic/noncopyable.h>
diff --git a/library/cpp/actors/core/indexes.cpp b/library/cpp/actors/core/indexes.cpp
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/library/cpp/actors/core/indexes.h b/library/cpp/actors/core/indexes.h
deleted file mode 100644
index 2bac5370de..0000000000
--- a/library/cpp/actors/core/indexes.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#pragma once
-#include <library/cpp/actors/util/local_process_key.h>
-#include <library/cpp/actors/prof/tag.h>
-
-namespace NActors {
-
-struct TActorActivityTag {};
-
-}
-
-template <>
-class TLocalProcessKeyStateIndexConstructor<NActors::TActorActivityTag> {
-public:
-    static ui32 BuildCurrentIndex(const TStringBuf name, const ui32 /*currentNamesCount*/) {
-        return NProfiling::MakeTag(name.data());
-    }
-};
-namespace NActors {
-enum class EInternalActorType {
-    OTHER = 0,
-    INCORRECT_ACTOR_TYPE_INDEX,
-    ACTOR_SYSTEM,
-    ACTORLIB_COMMON,
-    ACTORLIB_STATS,
-    LOG_ACTOR,
-    INTERCONNECT_PROXY_TCP,
-    INTERCONNECT_SESSION_TCP,
-    INTERCONNECT_COMMON,
-    SELF_PING_ACTOR,
-    TEST_ACTOR_RUNTIME,
-    INTERCONNECT_HANDSHAKE,
-    INTERCONNECT_POLLER,
-    INTERCONNECT_SESSION_KILLER,
-    ACTOR_SYSTEM_SCHEDULER_ACTOR,
-    ACTOR_FUTURE_CALLBACK,
-    INTERCONNECT_MONACTOR,
-    INTERCONNECT_LOAD_ACTOR,
-    INTERCONNECT_LOAD_RESPONDER,
-    NAMESERVICE,
-    DNS_RESOLVER,
-    INTERCONNECT_PROXY_WRAPPER,
-    ACTOR_COROUTINE
-};
-
-class TActorTypeOperator {
-public:
-    static constexpr ui32 GetMaxAvailableActorsCount() {
-        return TLocalProcessKeyStateIndexLimiter::GetMaxKeysCount();
-    }
-
-    template <class TEnum>
-    static ui32 GetEnumActivityType(const TEnum enumValue) {
-        return TEnumProcessKey<TActorActivityTag, TEnum>::GetIndex(enumValue);
-    }
-
-    static ui32 GetActorSystemIndex() {
-        return TEnumProcessKey<TActorActivityTag, EInternalActorType>::GetIndex(EInternalActorType::ACTOR_SYSTEM);
-    }
-
-    static ui32 GetOtherActivityIndex() {
-        return TEnumProcessKey<TActorActivityTag, EInternalActorType>::GetIndex(EInternalActorType::OTHER);
-    }
-
-    static ui32 GetActorActivityIncorrectIndex() {
-        return TEnumProcessKey<TActorActivityTag, EInternalActorType>::GetIndex(EInternalActorType::INCORRECT_ACTOR_TYPE_INDEX);
-    }
-};
-}
diff --git a/library/cpp/actors/core/ya.make b/library/cpp/actors/core/ya.make
index 7dcfdd7c3d..649effd22f 100644
--- a/library/cpp/actors/core/ya.make
+++ b/library/cpp/actors/core/ya.make
@@ -40,7 +40,7 @@ SRCS(
     defs.h
     event.cpp
     event.h
-    event_load.h
+    event_load.cpp
     event_local.h
     event_pb.cpp
     event_pb.h
@@ -63,7 +63,6 @@ SRCS(
     interconnect.cpp
     interconnect.h
     invoke.h
-    indexes.cpp
     io_dispatcher.cpp
     io_dispatcher.h
     lease.h
@@ -102,10 +101,10 @@ SRCS(
 
 GENERATE_ENUM_SERIALIZATION(defs.h)
 GENERATE_ENUM_SERIALIZATION(actor.h)
-GENERATE_ENUM_SERIALIZATION(indexes.h)
 GENERATE_ENUM_SERIALIZATION(log_iface.h)
 
 PEERDIR(
+    library/cpp/actors/actor_type
     library/cpp/actors/memory_log
     library/cpp/actors/prof
     library/cpp/actors/protos
diff --git a/library/cpp/actors/prof/tag.cpp b/library/cpp/actors/prof/tag.cpp
index 488d79e4d2..e755ed8ca9 100644
--- a/library/cpp/actors/prof/tag.cpp
+++ b/library/cpp/actors/prof/tag.cpp
@@ -15,6 +15,8 @@
 #include <util/generic/string.h>
 #include <util/generic/vector.h>
 #include <util/system/mutex.h>
+#include <library/cpp/actors/util/local_process_key.h>
+#include <library/cpp/actors/actor_type/index_constructor.h>
 
 namespace NProfiling {
     class TStringAtoms {
@@ -118,3 +120,13 @@ namespace NProfiling {
 
     TSetThreadAllocTag* SetThreadAllocTag = SetThreadAllocTagFn();
 }
+
+TMemoryProfileGuard::TMemoryProfileGuard(const TString& id)
+    : Id(id)
+{
+    NProfiling::TMemoryTagScope::Reset(TLocalProcessKeyState<NActors::TActorActivityTag>::GetInstance().Register(Id + "-Start"));
+}
+
+TMemoryProfileGuard::~TMemoryProfileGuard() {
+    NProfiling::TMemoryTagScope::Reset(TLocalProcessKeyState<NActors::TActorActivityTag>::GetInstance().Register(Id + "-Finish"));
+}
diff --git a/library/cpp/actors/prof/tag.h b/library/cpp/actors/prof/tag.h
index 357e264a22..8549b34e35 100644
--- a/library/cpp/actors/prof/tag.h
+++ b/library/cpp/actors/prof/tag.h
@@ -1,6 +1,8 @@
 #pragma once
 
-#include <util/generic/fwd.h>
+#include <util/generic/string.h>
+#include <util/generic/noncopyable.h>
+#include <util/generic/vector.h>
 
 /*
   Common registry for tagging memory profiler.
@@ -71,3 +73,12 @@ namespace NProfiling {
         bool Released = false;
     };
 }
+
+class TMemoryProfileGuard: TNonCopyable {
+private:
+    const TString Id;
+public:
+    TMemoryProfileGuard(const TString& id);
+    ~TMemoryProfileGuard();
+
+};
diff --git a/library/cpp/actors/util/local_process_key.h b/library/cpp/actors/util/local_process_key.h
index 6b330751a7..077de8cddc 100644
--- a/library/cpp/actors/util/local_process_key.h
+++ b/library/cpp/actors/util/local_process_key.h
@@ -7,7 +7,6 @@
 #include <util/generic/hash.h>
 #include <util/generic/singleton.h>
 #include <util/generic/serialized_enum.h>
-#include <library/cpp/actors/prof/tag.h>
 
 class TLocalProcessKeyStateIndexLimiter {
 public:
-- 
cgit v1.2.3