#include "absl/base/attributes.h"
#include "absl/base/internal/low_level_alloc.h"
#ifndef ABSL_LOW_LEVEL_ALLOC_MISSING
#include "absl/synchronization/internal/graphcycles.h"
#include <algorithm>
#include <array>
#include <cinttypes>
#include <limits>
#include "absl/base/internal/hide_ptr.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/internal/spinlock.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace synchronization_internal {
namespace {
ABSL_CONST_INIT static absl::base_internal::SpinLock arena_mu(
absl::kConstInit, base_internal::SCHEDULE_KERNEL_ONLY);
ABSL_CONST_INIT static base_internal::LowLevelAlloc::Arena* arena;
static void InitArenaIfNecessary() { … }
static const uint32_t kInline = …;
template <typename T>
class Vec { … };
class NodeSet { … };
inline GraphId MakeId(int32_t index, uint32_t version) { … }
inline int32_t NodeIndex(GraphId id) { … }
inline uint32_t NodeVersion(GraphId id) { … }
struct Node { … };
class PointerMap { … };
}
struct GraphCycles::Rep { … };
static Node* FindNode(GraphCycles::Rep* rep, GraphId id) { … }
void GraphCycles::TestOnlyAddNodes(uint32_t n) { … }
GraphCycles::GraphCycles() { … }
GraphCycles::~GraphCycles() { … }
bool GraphCycles::CheckInvariants() const { … }
GraphId GraphCycles::GetId(void* ptr) { … }
void GraphCycles::RemoveNode(void* ptr) { … }
void* GraphCycles::Ptr(GraphId id) { … }
bool GraphCycles::HasNode(GraphId node) { … }
bool GraphCycles::HasEdge(GraphId x, GraphId y) const { … }
void GraphCycles::RemoveEdge(GraphId x, GraphId y) { … }
static bool ForwardDFS(GraphCycles::Rep* r, int32_t n, int32_t upper_bound);
static void BackwardDFS(GraphCycles::Rep* r, int32_t n, int32_t lower_bound);
static void Reorder(GraphCycles::Rep* r);
static void Sort(const Vec<Node*>&, Vec<int32_t>* delta);
static void MoveToList(
GraphCycles::Rep* r, Vec<int32_t>* src, Vec<int32_t>* dst);
bool GraphCycles::InsertEdge(GraphId idx, GraphId idy) { … }
static bool ForwardDFS(GraphCycles::Rep* r, int32_t n, int32_t upper_bound) { … }
static void BackwardDFS(GraphCycles::Rep* r, int32_t n, int32_t lower_bound) { … }
static void Reorder(GraphCycles::Rep* r) { … }
static void Sort(const Vec<Node*>& nodes, Vec<int32_t>* delta) { … }
static void MoveToList(
GraphCycles::Rep* r, Vec<int32_t>* src, Vec<int32_t>* dst) { … }
int GraphCycles::FindPath(GraphId idx, GraphId idy, int max_path_len,
GraphId path[]) const { … }
bool GraphCycles::IsReachable(GraphId x, GraphId y) const { … }
void GraphCycles::UpdateStackTrace(GraphId id, int priority,
int (*get_stack_trace)(void** stack, int)) { … }
int GraphCycles::GetStackTrace(GraphId id, void*** ptr) { … }
}
ABSL_NAMESPACE_END
}
#endif