From e945f28a86c8145d1862837e03dd8b94555cf10f Mon Sep 17 00:00:00 2001 From: Tim Quatmann Date: Mon, 2 Mar 2020 08:00:20 +0100 Subject: [PATCH] Using raw pointers for manager in Variable.h since weak_ptr::lock() often seems to be a bottle neck during, e.g., model building. --- src/storm/storage/expressions/Variable.cpp | 7 ++++--- src/storm/storage/expressions/Variable.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/storm/storage/expressions/Variable.cpp b/src/storm/storage/expressions/Variable.cpp index 0cccde8e0..5cd1716ca 100644 --- a/src/storm/storage/expressions/Variable.cpp +++ b/src/storm/storage/expressions/Variable.cpp @@ -3,11 +3,11 @@ namespace storm { namespace expressions { - Variable::Variable() { + Variable::Variable() : manager(nullptr) { // Intentionally left empty. } - Variable::Variable(std::shared_ptr const& manager, uint_fast64_t index) : manager(manager), index(index) { + Variable::Variable(std::shared_ptr const& manager, uint_fast64_t index) : manager(manager.get()), index(index) { // Intentionally left empty. } @@ -52,7 +52,8 @@ namespace storm { } ExpressionManager const& Variable::getManager() const { - return *manager.lock(); + STORM_LOG_ASSERT(manager != nullptr, "The variable does not have a manager."); + return *manager; } bool Variable::hasBooleanType() const { diff --git a/src/storm/storage/expressions/Variable.h b/src/storm/storage/expressions/Variable.h index 3ecea02c0..3fe77467c 100644 --- a/src/storm/storage/expressions/Variable.h +++ b/src/storm/storage/expressions/Variable.h @@ -138,7 +138,7 @@ namespace storm { private: // The manager that is responsible for this variable. - std::weak_ptr manager; + ExpressionManager const* manager; // The index of the variable. uint_fast64_t index;