20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 #include "precompiled.hpp" |
24 #include "precompiled.hpp" |
25 #include "gc/z/zAddress.inline.hpp" |
|
26 #include "gc/z/zForwarding.inline.hpp" |
25 #include "gc/z/zForwarding.inline.hpp" |
27 #include "gc/z/zForwardingTable.inline.hpp" |
26 #include "gc/z/zForwardingTable.inline.hpp" |
28 #include "gc/z/zGlobals.hpp" |
27 #include "gc/z/zGlobals.hpp" |
29 #include "gc/z/zGranuleMap.inline.hpp" |
28 #include "gc/z/zGranuleMap.inline.hpp" |
30 #include "utilities/debug.hpp" |
29 #include "utilities/debug.hpp" |
31 |
30 |
32 ZForwardingTable::ZForwardingTable() : |
31 ZForwardingTable::ZForwardingTable() : |
33 _map(ZAddressOffsetMax) {} |
32 _map(ZAddressOffsetMax) {} |
34 |
33 |
35 void ZForwardingTable::insert(ZForwarding* forwarding) { |
34 void ZForwardingTable::insert(ZForwarding* forwarding) { |
36 const uintptr_t addr = ZAddress::good(forwarding->start()); |
35 const uintptr_t offset = forwarding->start(); |
37 const size_t size = forwarding->size(); |
36 const size_t size = forwarding->size(); |
38 |
37 |
39 assert(get(addr) == NULL, "Invalid entry"); |
38 assert(_map.get(offset) == NULL, "Invalid entry"); |
40 _map.put(addr, size, forwarding); |
39 _map.put(offset, size, forwarding); |
41 } |
40 } |
42 |
41 |
43 void ZForwardingTable::remove(ZForwarding* forwarding) { |
42 void ZForwardingTable::remove(ZForwarding* forwarding) { |
44 const uintptr_t addr = ZAddress::good(forwarding->start()); |
43 const uintptr_t offset = forwarding->start(); |
45 const size_t size = forwarding->size(); |
44 const size_t size = forwarding->size(); |
46 |
45 |
47 assert(get(addr) == forwarding, "Invalid entry"); |
46 assert(_map.get(offset) == forwarding, "Invalid entry"); |
48 _map.put(addr, size, NULL); |
47 _map.put(offset, size, NULL); |
49 } |
48 } |