diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/GC.cpp | 56 | ||||
-rw-r--r-- | cpp/src/Ice/Object.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 22 |
3 files changed, 23 insertions, 57 deletions
diff --git a/cpp/src/Ice/GC.cpp b/cpp/src/Ice/GC.cpp index 40372534131..83b282c9473 100644 --- a/cpp/src/Ice/GC.cpp +++ b/cpp/src/Ice/GC.cpp @@ -78,52 +78,11 @@ using namespace IceInternal; // // GCShared // - void IceInternal::GCShared::__incRef() { IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); assert(_ref >= 0); - ++_ref; -} - -void -IceInternal::GCShared::__decRef() -{ - IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); - bool doDelete = false; - assert(_ref > 0); - if(--_ref == 0) - { - doDelete = !_noDelete; - _noDelete = true; - } - lock.release(); - if(doDelete) - { - delete this; - } -} - -int -IceInternal::GCShared::__getRef() const -{ - IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); - return _ref; -} - -void -IceInternal::GCShared::__setNoDelete(bool b) -{ - IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); - _noDelete = b; -} - -void -IceInternal::GCShared::__gcIncRef() -{ - IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); - assert(_ref >= 0); if(_ref == 0 && gcObjects != 0) { #ifdef NDEBUG // To avoid annoying warnings about variables that are not used... @@ -137,7 +96,7 @@ IceInternal::GCShared::__gcIncRef() } void -IceInternal::GCShared::__gcDecRef() +IceInternal::GCShared::__decRef() { IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); bool doDelete = false; @@ -160,6 +119,19 @@ IceInternal::GCShared::__gcDecRef() } } +int +IceInternal::GCShared::__getRef() const +{ + IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); + return _ref; +} + +void +IceInternal::GCShared::__setNoDelete(bool b) +{ + IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); + _noDelete = b; +} // // GC diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 0d102ae1a63..0fd4c42c0a1 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -19,7 +19,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -IceInternal::GCShared* IceInternal::upCast(Object* p) { return p; } +IceUtil::Shared* IceInternal::upCast(Object* p) { return p; } bool Ice::Object::operator==(const Object& r) const diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 6822f587487..3533a2a790b 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -3822,6 +3822,14 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) } } } + + bool hasBaseClass = !bases.empty() && !bases.front()->isInterface(); + bool override = p->canBeCyclic() && (!hasBaseClass || !bases.front()->canBeCyclic()); + if(override) + { + H << ", private IceInternal::GCShared"; + } + H.restoreIndent(); H << sb; H.dec(); @@ -4827,20 +4835,6 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p) if(override) { - H << nl << "virtual void __incRef();"; - - C << sp << nl << "void" << nl << scoped.substr(2) << "::__incRef()"; - C << sb; - C << nl << "__gcIncRef();"; - C << eb; - - H << nl << "virtual void __decRef();"; - - C << sp << nl << "void" << nl << scoped.substr(2) << "::__decRef()"; - C << sb; - C << nl << "__gcDecRef();"; - C << eb; - H << nl << "virtual void __addObject(::IceInternal::GCCountMap&);"; C << sp << nl << "void" << nl << scoped.substr(2) << "::__addObject(::IceInternal::GCCountMap& _c)"; |