Commit 43cd3bda authored by Robert Ricci's avatar Robert Ricci
Browse files

Fix a bug when both -P and -d are given: we were subtracting out node

type counts for dynamic pclasses, which (correctly) never got added to
those counts in the first place.

Explicitly mark dynamically-created pclasses as such, so that we can
treat them specially in a few circumstances.
parent c57615b1
...@@ -368,27 +368,32 @@ void prune_unusable_pclasses() { ...@@ -368,27 +368,32 @@ void prune_unusable_pclasses() {
/* /*
* For every node with this type, we want to remove its slot * For every node with this type, we want to remove its slot
* count from the total slot count for the type, since we know * count from the total slot count for the type, since we know
* we will never use this particular node * we will never use this particular node.
* Note: We only have to do this for pclasses that are "real",
* not dynamic ones.
*/ */
tb_pnodelist::list_iter pnode_iterator = if (!(*pclass_iterator)->is_dynamic) {
ptype_iterator->second->L.begin(); tb_pnodelist::list_iter pnode_iterator =
while (pnode_iterator != ptype_iterator->second->L.end()) { ptype_iterator->second->L.begin();
/* while (pnode_iterator != ptype_iterator->second->L.end()) {
* Get the slotcount for this ptype /*
*/ * Get the slotcount for this ptype
tb_pnode::types_map::iterator tm_iterator; */
tm_iterator = (*pnode_iterator)->types.find(this_type); tb_pnode::types_map::iterator tm_iterator;
assert(tm_iterator != (*pnode_iterator)->types.end()); tm_iterator = (*pnode_iterator)->types.find(this_type);
assert(tm_iterator != (*pnode_iterator)->types.end());
/*
* Remove it from the current ptype /*
*/ * Remove it from the current ptype
this_type_p->remove_slots(tm_iterator->second->get_max_load()); */
this_type_p->remove_slots(
/* tm_iterator->second->get_max_load());
* Move on to the next node
*/ /*
pnode_iterator++; * Move on to the next node
*/
pnode_iterator++;
}
} }
ptype_iterator++; ptype_iterator++;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* All rights reserved. * All rights reserved.
*/ */
static const char rcsid[] = "$Id: pclass.cc,v 1.30 2009-05-20 18:06:08 tarunp Exp $"; static const char rcsid[] = "$Id: pclass.cc,v 1.31 2009-06-15 19:42:26 ricci Exp $";
#include "port.h" #include "port.h"
...@@ -282,6 +282,7 @@ int generate_pclasses(tb_pgraph &pg, bool pclass_for_each_pnode, ...@@ -282,6 +282,7 @@ int generate_pclasses(tb_pgraph &pg, bool pclass_for_each_pnode,
n->name = pnode->name + "-own"; n->name = pnode->name + "-own";
n->add_member(pnode,true); n->add_member(pnode,true);
n->disabled = true; n->disabled = true;
n->is_dynamic = true;
} }
} }
......
...@@ -68,8 +68,8 @@ public: ...@@ -68,8 +68,8 @@ public:
class tb_pclass { class tb_pclass {
public: public:
tb_pclass() : name(), size(0), used_members(0), refcount(0), disabled(false) tb_pclass() : name(), size(0), used_members(0), refcount(0), disabled(false),
{;} is_dynamic(false) {;}
typedef map<fstring,tb_pnodelist*> pclass_members_map; typedef map<fstring,tb_pnodelist*> pclass_members_map;
typedef hash_set<tb_pnode*,hashptr<tb_pnode*> > tb_pnodeset; typedef hash_set<tb_pnode*,hashptr<tb_pnode*> > tb_pnodeset;
...@@ -91,13 +91,14 @@ public: ...@@ -91,13 +91,14 @@ public:
// For use with PRUNE_PCLASSES // For use with PRUNE_PCLASSES
int refcount; int refcount;
// Just used for debugging // Is this a dynamic plcass? If false, it's a "real" one
bool is_own_class; bool is_dynamic;
friend ostream &operator<<(ostream &o, const tb_pclass& p) friend ostream &operator<<(ostream &o, const tb_pclass& p)
{ {
o << p.name << " size=" << p.size << o << p.name << " size=" << p.size <<
" used_members=" << p.used_members << " disabled=" << p.disabled << "\n"; " used_members=" << p.used_members << " disabled=" << p.disabled <<
" is_dynamic=" << p.is_dynamic << "\n";
pclass_members_map::const_iterator dit; pclass_members_map::const_iterator dit;
for (dit=p.members.begin();dit!=p.members.end();++dit) { for (dit=p.members.begin();dit!=p.members.end();++dit) {
o << " " << (*dit).first << ":\n"; o << " " << (*dit).first << ":\n";
......
...@@ -134,9 +134,13 @@ class tb_ptype { ...@@ -134,9 +134,13 @@ class tb_ptype {
max_users = _max_users; max_users = _max_users;
} }
inline void add_slots(int additional_slots) { inline void add_slots(int additional_slots) {
//cerr << "Adding " << additional_slots << " to " << my_name
//<< endl;
slots += additional_slots; slots += additional_slots;
} }
inline void remove_slots(int slots_to_remove) { inline void remove_slots(int slots_to_remove) {
//cerr << "Removing " << slots_to_remove << " from " << my_name
//<< endl;
slots -= slots_to_remove; slots -= slots_to_remove;
} }
private: private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment