PersistentTable.cc (11025:4872dbdea907) PersistentTable.cc (12890:2dcd62e80e96)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 16 unchanged lines hidden (view full) ---

25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include "mem/ruby/structures/PersistentTable.hh"
30
31using namespace std;
32
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 16 unchanged lines hidden (view full) ---

25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include "mem/ruby/structures/PersistentTable.hh"
30
31using namespace std;
32
33// randomize so that handoffs are not locality-aware
34#if 0
35int persistent_randomize[] = {0, 4, 8, 12, 1, 5, 9, 13, 2, 6,
36 10, 14, 3, 7, 11, 15};
37int persistent_randomize[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
38 10, 11, 12, 13, 14, 15};
39#endif
40
41PersistentTable::PersistentTable()
42{
43}
44
45PersistentTable::~PersistentTable()
46{
47}
48
49void
50PersistentTable::persistentRequestLock(Addr address,
51 MachineID locker,
52 AccessType type)
53{
33
34PersistentTable::PersistentTable()
35{
36}
37
38PersistentTable::~PersistentTable()
39{
40}
41
42void
43PersistentTable::persistentRequestLock(Addr address,
44 MachineID locker,
45 AccessType type)
46{
54#if 0
55 if (locker == m_chip_ptr->getID())
56 cout << "Chip " << m_chip_ptr->getID() << ": " << llocker
57 << " requesting lock for " << address << endl;
58
59 MachineID locker = (MachineID) persistent_randomize[llocker];
60#endif
61
62 assert(address == makeLineAddress(address));
63
64 static const PersistentTableEntry dflt;
65 pair<AddressMap::iterator, bool> r =
66 m_map.insert(AddressMap::value_type(address, dflt));
67 bool present = !r.second;
68 AddressMap::iterator i = r.first;
69 PersistentTableEntry &entry = i->second;

--- 10 unchanged lines hidden (view full) ---

80 if (present)
81 assert(entry.m_marked.isSubset(entry.m_starving));
82}
83
84void
85PersistentTable::persistentRequestUnlock(Addr address,
86 MachineID unlocker)
87{
47 assert(address == makeLineAddress(address));
48
49 static const PersistentTableEntry dflt;
50 pair<AddressMap::iterator, bool> r =
51 m_map.insert(AddressMap::value_type(address, dflt));
52 bool present = !r.second;
53 AddressMap::iterator i = r.first;
54 PersistentTableEntry &entry = i->second;

--- 10 unchanged lines hidden (view full) ---

65 if (present)
66 assert(entry.m_marked.isSubset(entry.m_starving));
67}
68
69void
70PersistentTable::persistentRequestUnlock(Addr address,
71 MachineID unlocker)
72{
88#if 0
89 if (unlocker == m_chip_ptr->getID())
90 cout << "Chip " << m_chip_ptr->getID() << ": " << uunlocker
91 << " requesting unlock for " << address << endl;
92
93 MachineID unlocker = (MachineID) persistent_randomize[uunlocker];
94#endif
95
96 assert(address == makeLineAddress(address));
97 assert(m_map.count(address));
98 PersistentTableEntry& entry = m_map[address];
99
100 //
101 // Make sure we're in the locked set
102 //
103 assert(entry.m_starving.isElement(unlocker));

--- 116 unchanged lines hidden ---
73 assert(address == makeLineAddress(address));
74 assert(m_map.count(address));
75 PersistentTableEntry& entry = m_map[address];
76
77 //
78 // Make sure we're in the locked set
79 //
80 assert(entry.m_starving.isElement(unlocker));

--- 116 unchanged lines hidden ---