diff --git a/anabatic/src/Edge.cpp b/anabatic/src/Edge.cpp index 5323bf4a..d55439d9 100644 --- a/anabatic/src/Edge.cpp +++ b/anabatic/src/Edge.cpp @@ -88,9 +88,9 @@ namespace Anabatic { Edge* edge = new Edge ( source, target, flags ); edge->_postCreate(); - cdebug_log(110,1) << "Edge::create(): " << (void*)edge << ":" << edge << endl; - cdebug_log(110,0) << "source:" << (void*)source << ":" << edge->getSource() << endl; - cdebug_log(110,0) << "target:" << (void*)target << ":" << edge->getTarget() << endl; + cdebug_log(110,1) << "Edge::create(): " << /*(void*)edge << ":" <<*/ edge << endl; + cdebug_log(110,0) << "source:" << /*(void*)source << ":" <<*/ edge->getSource() << endl; + cdebug_log(110,0) << "target:" << /*(void*)target << ":" <<*/ edge->getTarget() << endl; cdebug_tabw(110,-1); return edge; } diff --git a/crlcore/etc/common/display.conf b/crlcore/etc/common/display.conf index 7209b8e4..24bf85fe 100644 --- a/crlcore/etc/common/display.conf +++ b/crlcore/etc/common/display.conf @@ -192,7 +192,7 @@ stylesTable = \ , (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 }) , (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 }) , (Drawing, 'Anabatic::Edge' , { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4, 'threshold':0.02*scale }) - , (Drawing, 'Anabatic::GCell', { 'color':'128,128,128', 'pattern':'0000000000000000', 'border':4, 'threshold':0.10*scale }) + , (Drawing, 'Anabatic::GCell', { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4, 'threshold':0.10*scale }) ) # ---------------------------------------------------------------------- diff --git a/crlcore/src/cyclop/Cyclop.cpp b/crlcore/src/cyclop/Cyclop.cpp index 3fdc92f5..70ee6adf 100644 --- a/crlcore/src/cyclop/Cyclop.cpp +++ b/crlcore/src/cyclop/Cyclop.cpp @@ -77,7 +77,7 @@ namespace CRL { _stressDisplayAction->setStatusTip ( tr("Intensive use of display redrawing") ); connect ( _stressDisplayAction, SIGNAL(triggered()), this, SLOT(stressDisplay()) ); - debugMenu->addAction ( _stressDisplayAction ); + //debugMenu->addAction ( _stressDisplayAction ); getCellWidget()->addDrawExtensionGo ( DemoGo::staticGetName() , DemoGo::initDrawDemoGo diff --git a/hurricane/src/hurricane/Component.cpp b/hurricane/src/hurricane/Component.cpp index cdd355c5..e93aa66c 100644 --- a/hurricane/src/hurricane/Component.cpp +++ b/hurricane/src/hurricane/Component.cpp @@ -408,58 +408,50 @@ void Component::_postCreate() void Component::_preDestroy() // ************************* { - cdebug_log(18,1) << "entering Component::_Predestroy: " << this << endl; + cdebug_log(18,1) << "entering Component::_preDestroy: " << this << endl; clearProperties(); - set componentSet; - getSlaveComponents().fill(componentSet); + set components; + getSlaveComponents().fill( components ); + components.insert( this ); - set masterHookSet; - componentSet.insert(this); - for_each_component(component, getCollection(componentSet)) { - component->unmaterialize(); - for_each_hook(hook, component->getHooks()) { - for_each_hook(hook, hook->getHooks()) { - if (hook->isMaster() && (componentSet.find(hook->getComponent()) == componentSet.end())) - masterHookSet.insert(hook); - end_for; - } - if (!hook->isMaster()) hook->detach(); - end_for; + vector masterHooks; + + for ( Component* component : components ) { + component->unmaterialize(); + for ( Hook* chook : component->getHooks() ) { + for ( Hook* shook : chook->getHooks() ) { + if (shook->isMaster() and (components.find(shook->getComponent()) == components.end()) ) + masterHooks.push_back( shook ); } - end_for; + if (not chook->isMaster()) chook->detach(); + } } - componentSet.erase(this); - for_each_component(component, getCollection(componentSet)) { - component->destroy(); - end_for; - } + components.erase( this ); + for ( Component* component : components ) component->destroy(); - set rubberSet; - set mainMasterHookSet; - for_each_hook(hook, getCollection(masterHookSet)) { - Rubber* rubber = hook->getComponent()->getRubber(); - if (!rubber) - mainMasterHookSet.insert(hook); - else { - if (rubberSet.find(rubber) == rubberSet.end()) { - rubberSet.insert(rubber); - mainMasterHookSet.insert(hook); - } + set rubbers; + vector mainMasterHooks; + + for ( Hook* mhook : masterHooks ) { + Rubber* rubber = mhook->getComponent()->getRubber(); + if (not rubber) + mainMasterHooks.push_back( mhook ); + else { + if (rubbers.find(rubber) == rubbers.end()) { + rubbers.insert( rubber ); + mainMasterHooks.push_back( mhook ); } - end_for; + } } + Hook* masterHook = NULL; - for_each_hook(hook, getCollection(mainMasterHookSet)) { - if (!masterHook) - masterHook = hook; - else - hook->merge(masterHook); - end_for; + for ( Hook* hook : mainMasterHooks ) { + if (not masterHook) masterHook = hook; + else hook->merge( masterHook ); } - /**/ _bodyHook.detach(); @@ -467,7 +459,6 @@ void Component::_preDestroy() if (_net) _net->_getComponentSet()._remove(this); - cdebug_log(18,0) << "exiting Component::_Predestroy:" << endl; cdebug_tabw(18,-1); } diff --git a/hurricane/src/hurricane/DBo.cpp b/hurricane/src/hurricane/DBo.cpp index 88045cf0..15c02d8a 100644 --- a/hurricane/src/hurricane/DBo.cpp +++ b/hurricane/src/hurricane/DBo.cpp @@ -53,7 +53,9 @@ namespace Hurricane { void DBo::_postCreate () - { } + { + cdebug_log(0,0) << "DBo::_postCreate() " << this << endl; + } void DBo::_preDestroy () @@ -64,7 +66,9 @@ namespace Hurricane { void DBo::destroy () { + cdebug_log(0,1) << "DBo::destroy() " << this << endl; _preDestroy(); + cdebug_tabw(0,-1); delete this; } diff --git a/hurricane/src/hurricane/Hook.cpp b/hurricane/src/hurricane/Hook.cpp index 5c6d75a7..79fd5e22 100644 --- a/hurricane/src/hurricane/Hook.cpp +++ b/hurricane/src/hurricane/Hook.cpp @@ -362,6 +362,8 @@ Hook* Hook::merge(Hook* hook) if (hook == this) throw Error("Can't merge : itself"); + cdebug_log(0,0) << "Hook::merge() hook:" << hook->getComponent() << endl; + Hook* masterHook = hook->getPreviousMasterHook(); Hook* nextHook = masterHook->_nextHook; masterHook->_nextHook = _nextHook; diff --git a/hurricane/src/hurricane/Property.cpp b/hurricane/src/hurricane/Property.cpp index c29667db..0e6c20b2 100644 --- a/hurricane/src/hurricane/Property.cpp +++ b/hurricane/src/hurricane/Property.cpp @@ -226,25 +226,53 @@ namespace Hurricane { void SharedProperty::_preDestroy () { - Property::_preDestroy(); + for ( size_t i=0 ; i<_ownerSet.size() ; ++i ) { + _ownerSet[i]->_onDestroyed(this); + _ownerSet[i] = NULL; + } + _ownerSet.clear(); - while (!_ownerSet.empty()) { - DBo* owner = *_ownerSet.begin(); - _ownerSet.erase(owner); - owner->_onDestroyed(this); + // while (!_ownerSet.empty()) { + // DBo* owner = *_ownerSet.begin(); + // _ownerSet.erase(owner); + // owner->_onDestroyed(this); + // } + + Property::_preDestroy(); + } + + + void SharedProperty::_erase ( DBo* owner ) + { + for ( size_t i=0 ; i<_ownerSet.size() ; ++i ) { + if (_ownerSet[i] == owner) { + std::swap( _ownerSet[i], _ownerSet[_ownerSet.size()-1] ); + _ownerSet.pop_back(); + } } } void SharedProperty::onCapturedBy ( DBo* owner ) { - _ownerSet.insert(owner); + for ( DBo* dbo : _ownerSet ) { + if (dbo == owner) return; + } + _ownerSet.push_back( owner ); + + //_ownerSet.insert(owner); } void SharedProperty::onReleasedBy ( DBo* owner ) { - _ownerSet.erase(owner); + for ( size_t i=0 ; i<_ownerSet.size() ; ++i ) { + if (_ownerSet[i] == owner) { + std::swap( _ownerSet[i], _ownerSet[_ownerSet.size()-1] ); + _ownerSet.pop_back(); + } + } + //_ownerSet.erase(owner); if (_ownerSet.empty()) onNotOwned(); } diff --git a/hurricane/src/hurricane/Relation.cpp b/hurricane/src/hurricane/Relation.cpp index 3a34cc07..d97f1744 100644 --- a/hurricane/src/hurricane/Relation.cpp +++ b/hurricane/src/hurricane/Relation.cpp @@ -99,7 +99,8 @@ DBos Relation::getSlaveOwners() const void Relation::onReleasedBy(DBo* owner) // ************************************ { - _getOwnerSet().erase(owner); + _erase( owner ); +//_getOwnerSet().erase(owner); if (owner == _masterOwner) destroy(); } diff --git a/hurricane/src/hurricane/hurricane/IntrusiveSet.h b/hurricane/src/hurricane/hurricane/IntrusiveSet.h index 44faeb35..48106d88 100644 --- a/hurricane/src/hurricane/hurricane/IntrusiveSet.h +++ b/hurricane/src/hurricane/hurricane/IntrusiveSet.h @@ -433,14 +433,23 @@ template class IntrusiveSet { _length = newLength; _array = new Element*[_length]; memset(_array, 0, _length * sizeof(Element*)); + cdebug_log(0,0) << "IntrusiveSet::_resize() " << oldLength << " -> " << newLength << endl; + for (unsigned index = 0; index < oldLength; index++) { Element* element = oldArray[index]; + if (not element) + cdebug_log(0,0) << "| bucket:" << setw(4) << index << " empty" << endl; + while (element) { Element* nextElement = _getNextElement(element); unsigned newIndex = (_getHashValue(element) / 8) % _length; _setNextElement(element, _array[newIndex]); _array[newIndex] = element; element = nextElement; + + cdebug_log(0,0) << "| bucket:" << setw(4) << index + << " -> " << setw(4) << newIndex + << " + " << element << endl; } } delete[] oldArray; diff --git a/hurricane/src/hurricane/hurricane/Property.h b/hurricane/src/hurricane/hurricane/Property.h index da90d18a..a0e2d7a2 100644 --- a/hurricane/src/hurricane/hurricane/Property.h +++ b/hurricane/src/hurricane/hurricane/Property.h @@ -396,7 +396,7 @@ namespace Hurricane { unsigned int _count; }; public: - typedef set DBoSet; + typedef vector DBoSet; typedef map OrphanedMap; public: static const OrphanedMap& getOrphaneds (); @@ -411,6 +411,7 @@ namespace Hurricane { virtual void onCapturedBy ( DBo* owner ); virtual void onReleasedBy ( DBo* owner ); virtual void onNotOwned (); + void _erase ( DBo* owner ); inline DBoSet& _getOwnerSet (); virtual string _getString () const; virtual Record* _getRecord () const;