Cleanup unused MOA code.
PiperOrigin-RevId: 495946574
diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc
index b8ce7d8..25ddcc3 100644
--- a/src/google/protobuf/arena.cc
+++ b/src/google/protobuf/arena.cc
@@ -535,17 +535,14 @@
uint64_t ThreadSafeArena::GetNextLifeCycleId() {
ThreadCache& tc = thread_cache();
uint64_t id = tc.next_lifecycle_id;
- // We increment lifecycle_id's by multiples of two so we can use bit 0 as
- // a tag.
- constexpr uint64_t kDelta = 2;
- constexpr uint64_t kInc = ThreadCache::kPerThreadIds * kDelta;
+ constexpr uint64_t kInc = ThreadCache::kPerThreadIds;
if (PROTOBUF_PREDICT_FALSE((id & (kInc - 1)) == 0)) {
// On platforms that don't support uint64_t atomics we can certainly not
// afford to increment by large intervals and expect uniqueness due to
// wrapping, hence we only add by 1.
id = lifecycle_id_.fetch_add(1, std::memory_order_relaxed) * kInc;
}
- tc.next_lifecycle_id = id + kDelta;
+ tc.next_lifecycle_id = id + 1;
return id;
}
diff --git a/src/google/protobuf/thread_safe_arena.h b/src/google/protobuf/thread_safe_arena.h
index fa34d43..b30d85a 100644
--- a/src/google/protobuf/thread_safe_arena.h
+++ b/src/google/protobuf/thread_safe_arena.h
@@ -55,13 +55,6 @@
namespace protobuf {
namespace internal {
-// Tag type used to invoke the constructor of message-owned arena.
-// Only message-owned arenas use this constructor for creation.
-// Such constructors are internal implementation details of the library.
-struct MessageOwned {
- explicit MessageOwned() = default;
-};
-
// This class provides the core Arena memory allocation library. Different
// implementations only need to implement the public interface below.
// Arena is not a template type as that would only be useful if all protos
@@ -72,9 +65,6 @@
public:
ThreadSafeArena();
- // Constructor solely used by message-owned arena.
- explicit ThreadSafeArena(internal::MessageOwned);
-
ThreadSafeArena(char* mem, size_t size);
explicit ThreadSafeArena(void* mem, size_t size,
@@ -134,11 +124,6 @@
// Add object pointer and cleanup function pointer to the list.
void AddCleanup(void* elem, void (*cleanup)(void*));
- // Checks whether this arena is message-owned.
- PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const {
- return tag_and_id_ & kMessageOwnedArena;
- }
-
private:
friend class ArenaBenchmark;
friend class TcParser;
@@ -183,9 +168,6 @@
// user-provided initial block.
SerialArena first_arena_;
- // The LSB of tag_and_id_ indicates if the arena is message-owned.
- enum : uint64_t { kMessageOwnedArena = 1 };
-
static_assert(std::is_trivially_destructible<SerialArena>{},
"SerialArena needs to be trivially destructible.");
@@ -200,10 +182,8 @@
void CleanupList();
inline void CacheSerialArena(SerialArena* serial) {
- if (!IsMessageOwned()) {
- thread_cache().last_serial_arena = serial;
- thread_cache().last_lifecycle_id_seen = tag_and_id_;
- }
+ thread_cache().last_serial_arena = serial;
+ thread_cache().last_lifecycle_id_seen = tag_and_id_;
}
PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(SerialArena** arena) {