summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/pmt
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2019-03-25 11:04:50 +0100
committerMarcus Müller <marcus.mueller@ettus.com>2019-04-19 17:37:26 +0200
commitaa9e2ec7abd4f70f73ca9b83dc00c59cd7ba45d1 (patch)
treef4814d1ab025814986ccf1fc979fbff69540c80b /gnuradio-runtime/lib/pmt
parent59c27e8bfac3c03fe1efdf9d45538941d3638df1 (diff)
pmt: remove intrusive_ptr
Diffstat (limited to 'gnuradio-runtime/lib/pmt')
-rw-r--r--gnuradio-runtime/lib/pmt/pmt.cc97
-rw-r--r--gnuradio-runtime/lib/pmt/pmt_int.h45
2 files changed, 2 insertions, 140 deletions
diff --git a/gnuradio-runtime/lib/pmt/pmt.cc b/gnuradio-runtime/lib/pmt/pmt.cc
index 763007132f..e0f50b5b0b 100644
--- a/gnuradio-runtime/lib/pmt/pmt.cc
+++ b/gnuradio-runtime/lib/pmt/pmt.cc
@@ -34,47 +34,6 @@
namespace pmt {
-# if (PMT_LOCAL_ALLOCATOR)
-
-static const int
-get_cache_line_size()
-{
- static const int CACHE_LINE_SIZE = 64; // good guess
- return CACHE_LINE_SIZE;
-}
-
-static pmt_pool global_pmt_pool(sizeof(pmt_pair), get_cache_line_size());
-
-void *
-pmt_base::operator new(size_t size)
-{
- void *p = global_pmt_pool.malloc();
-
- // fprintf(stderr, "pmt_base::new p = %p\n", p);
- assert((reinterpret_cast<intptr_t>(p) & (get_cache_line_size() - 1)) == 0);
- return p;
-}
-
-void
-pmt_base::operator delete(void *p, size_t size)
-{
- global_pmt_pool.free(p);
-}
-
-#endif
-
-void intrusive_ptr_add_ref(pmt_base* p)
-{
- p->refcount_.fetch_add(1, boost::memory_order_relaxed);
-}
-
-void intrusive_ptr_release(pmt_base* p) {
- if (p->refcount_.fetch_sub(1, boost::memory_order_release) == 1) {
- boost::atomic_thread_fence(boost::memory_order_acquire);
- delete p;
- }
-}
-
pmt_base::~pmt_base()
{
// nop -- out of line virtual destructor
@@ -290,7 +249,7 @@ string_to_symbol(const std::string &name)
if (name == _symbol(sym)->name())
return sym; // Yes. Return it
}
-
+
// Lock the table on insert for thread safety:
static boost::mutex thread_safety;
boost::mutex::scoped_lock lock(thread_safety);
@@ -300,7 +259,7 @@ string_to_symbol(const std::string &name)
if (name == _symbol(sym)->name())
return sym; // Yes. Return it
}
-
+
// Nope. Make a new one.
pmt_t sym = pmt_t(new pmt_symbol(name));
_symbol(sym)->set_next((*get_symbol_hash_table())[hash]);
@@ -1088,27 +1047,6 @@ eqv(const pmt_t& x, const pmt_t& y)
}
bool
-eqv_raw(pmt_base *x, pmt_base *y)
-{
- if (x == y)
- return true;
-
- if (x->is_integer() && y->is_integer())
- return _integer(x)->value() == _integer(y)->value();
-
- if (x->is_uint64() && y->is_uint64())
- return _uint64(x)->value() == _uint64(y)->value();
-
- if (x->is_real() && y->is_real())
- return _real(x)->value() == _real(y)->value();
-
- if (x->is_complex() && y->is_complex())
- return _complex(x)->value() == _complex(y)->value();
-
- return false;
-}
-
-bool
equal(const pmt_t& x, const pmt_t& y)
{
if (eqv(x, y))
@@ -1213,35 +1151,6 @@ assq(pmt_t obj, pmt_t alist)
return PMT_F;
}
-/*
- * This avoids a bunch of shared_pointer reference count manipulation.
- */
-pmt_t
-assv_raw(pmt_base *obj, pmt_base *alist)
-{
- while (alist->is_pair()){
- pmt_base *p = ((pmt_pair *)alist)->d_car.get();
- if (!p->is_pair()) // malformed alist
- return PMT_F;
-
- if (eqv_raw(obj, ((pmt_pair *)p)->d_car.get()))
- return ((pmt_pair *)alist)->d_car;
-
- alist = (((pmt_pair *)alist)->d_cdr).get();
- }
- return PMT_F;
-}
-
-#if 1
-
-pmt_t
-assv(pmt_t obj, pmt_t alist)
-{
- return assv_raw(obj.get(), alist.get());
-}
-
-#else
-
pmt_t
assv(pmt_t obj, pmt_t alist)
{
@@ -1258,8 +1167,6 @@ assv(pmt_t obj, pmt_t alist)
return PMT_F;
}
-#endif
-
pmt_t
assoc(pmt_t obj, pmt_t alist)
diff --git a/gnuradio-runtime/lib/pmt/pmt_int.h b/gnuradio-runtime/lib/pmt/pmt_int.h
index ead058598d..5f02518a62 100644
--- a/gnuradio-runtime/lib/pmt/pmt_int.h
+++ b/gnuradio-runtime/lib/pmt/pmt_int.h
@@ -33,53 +33,8 @@
* See pmt.h for the public interface
*/
-#define PMT_LOCAL_ALLOCATOR 0 // define to 0 or 1
namespace pmt {
-class PMT_API pmt_base : boost::noncopyable {
- mutable boost::atomic<int> refcount_;
-
-protected:
- pmt_base() : refcount_(0) {};
- virtual ~pmt_base();
-
-public:
- virtual bool is_bool() const { return false; }
- virtual bool is_symbol() const { return false; }
- virtual bool is_number() const { return false; }
- virtual bool is_integer() const { return false; }
- virtual bool is_uint64() const { return false; }
- virtual bool is_real() const { return false; }
- virtual bool is_complex() const { return false; }
- virtual bool is_null() const { return false; }
- virtual bool is_pair() const { return false; }
- virtual bool is_tuple() const { return false; }
- virtual bool is_vector() const { return false; }
- virtual bool is_dict() const { return false; }
- virtual bool is_any() const { return false; }
-
- virtual bool is_uniform_vector() const { return false; }
- virtual bool is_u8vector() const { return false; }
- virtual bool is_s8vector() const { return false; }
- virtual bool is_u16vector() const { return false; }
- virtual bool is_s16vector() const { return false; }
- virtual bool is_u32vector() const { return false; }
- virtual bool is_s32vector() const { return false; }
- virtual bool is_u64vector() const { return false; }
- virtual bool is_s64vector() const { return false; }
- virtual bool is_f32vector() const { return false; }
- virtual bool is_f64vector() const { return false; }
- virtual bool is_c32vector() const { return false; }
- virtual bool is_c64vector() const { return false; }
-
- friend void intrusive_ptr_add_ref(pmt_base* p);
- friend void intrusive_ptr_release(pmt_base* p);
-
-# if (PMT_LOCAL_ALLOCATOR)
- void *operator new(size_t);
- void operator delete(void *, size_t);
-#endif
-};
class pmt_bool : public pmt_base
{