summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2006-04-11 01:28:00 +0000
committerMichi Henning <michi@zeroc.com>2006-04-11 01:28:00 +0000
commitafefa6776c6000312634422762ac4b14a2d81671 (patch)
treea90fab5898210bcf56dcf98d5393f7e8c43138ac /cpp/src/slice2cpp
parentchanging logger usage (diff)
downloadice-afefa6776c6000312634422762ac4b14a2d81671.tar.bz2
ice-afefa6776c6000312634422762ac4b14a2d81671.tar.xz
ice-afefa6776c6000312634422762ac4b14a2d81671.zip
Changes to garbage collector to speed it up for highly-connected graphs.
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index c0b4019fe7e..7810f96eb64 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -3449,11 +3449,19 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
C << eb;
C << eb;
- H << nl << "virtual void __addObject(::IceInternal::GCObjectMultiSet&);";
+ H << nl << "virtual void __addObject(::IceInternal::GCCountMap&);";
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__addObject(::IceInternal::GCObjectMultiSet& _c)";
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__addObject(::IceInternal::GCCountMap& _c)";
C << sb;
- C << nl << "_c.insert(this);";
+ C << nl << "::IceInternal::GCCountMap::iterator pos = _c.find(this);";
+ C << nl << "if(pos == _c.end())";
+ C << sb;
+ C << nl << "_c[this] = 1;";
+ C << eb;
+ C << nl << "else";
+ C << sb;
+ C << nl << "++pos->second;";
+ C << eb;
C << eb;
H << nl << "virtual bool __usesClasses();";
@@ -3470,9 +3478,9 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
//
if(canBeCyclic)
{
- H << nl << "virtual void __gcReachable(::IceInternal::GCObjectMultiSet&) const;";
+ H << nl << "virtual void __gcReachable(::IceInternal::GCCountMap&) const;";
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__gcReachable(::IceInternal::GCObjectMultiSet& _c) const";
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__gcReachable(::IceInternal::GCCountMap& _c) const";
C << sb;
string vc6Prefix;