Line data Source code
1 : // Author(s): Maurice Laveaux 2 : // Copyright: see the accompanying file COPYING or copy at 3 : // https://github.com/mCRL2org/mCRL2/blob/master/COPYING 4 : // 5 : // Distributed under the Boost Software License, Version 1.0. 6 : // (See accompanying file LICENSE_1_0.txt or copy at 7 : // http://www.boost.org/LICENSE_1_0.txt) 8 : // 9 : 10 : #include "mcrl2/atermpp/aterm_io.h" 11 : #include "mcrl2/atermpp/detail/global_aterm_pool.h" 12 : #include "mcrl2/utilities/shared_mutex.h" 13 : 14 : using namespace atermpp; 15 : using namespace atermpp::detail; 16 : 17 : /// \brief Check for reasonably sized aterm (32 bits, 4 bytes) 18 : /// This check might break on perfectly valid architectures 19 : /// that have char == 2 bytes, and sizeof(header_type) == 2 20 : static_assert(sizeof(std::size_t) == sizeof(_aterm*), "The size of an aterm pointer is not equal to the size of type std::size_t. Cannot compile the MCRL2 toolset for this platform."); 21 : static_assert(sizeof(std::size_t) >= 4,"The size of std::size_t should at least be four bytes. Cannot compile the toolset for this platform."); 22 : 23 1 : void atermpp::add_deletion_hook(const function_symbol& function, term_callback callback) 24 : { 25 1 : g_term_pool().add_deletion_hook(function, callback); 26 1 : } 27 : 28 : namespace atermpp::detail 29 : { 30 : /// \brief A reference to the thread local term pool storage 31 43230912484 : thread_aterm_pool& g_thread_term_pool() 32 : { 33 : #ifdef MCRL2_ENABLE_MULTITHREADING 34 : static_assert(mcrl2::utilities::detail::GlobalThreadSafe); 35 43230912484 : thread_local thread_aterm_pool instance(g_aterm_pool_instance); 36 : #else 37 : static_assert(!mcrl2::utilities::detail::GlobalThreadSafe); 38 : static thread_aterm_pool instance(g_aterm_pool_instance); 39 : #endif 40 43230912487 : return instance; 41 : } 42 : 43 : } // end namespace atermpp::detail 44 : 45 22853 : aterm_stream::~aterm_stream() {} 46 : 47 10189 : aterm_istream::~aterm_istream() {} 48 : 49 12664 : aterm_ostream::~aterm_ostream() {} 50 : 51 : typename std::aligned_storage<sizeof(aterm_pool), alignof(aterm_pool)>::type atermpp::detail::g_aterm_pool_storage = {};