1 /* |
1 /* |
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
22 */ |
22 */ |
23 |
23 |
24 #ifndef SHARE_GC_Z_ZFORWARDINGTABLE_HPP |
24 #ifndef SHARE_GC_Z_ZFORWARDINGTABLE_HPP |
25 #define SHARE_GC_Z_ZFORWARDINGTABLE_HPP |
25 #define SHARE_GC_Z_ZFORWARDINGTABLE_HPP |
26 |
26 |
27 #include "gc/z/zForwardingTableEntry.hpp" |
27 #include "gc/z/zGranuleMap.hpp" |
28 #include "memory/allocation.hpp" |
|
29 |
28 |
30 typedef size_t ZForwardingTableCursor; |
29 class ZForwarding; |
31 |
30 |
32 class ZForwardingTable { |
31 class ZForwardingTable { |
33 friend class VMStructs; |
|
34 friend class ZForwardingTableTest; |
|
35 |
|
36 private: |
32 private: |
37 ZForwardingTableEntry* _table; |
33 ZGranuleMap<ZForwarding*> _map; |
38 size_t _size; |
|
39 |
|
40 ZForwardingTableEntry at(ZForwardingTableCursor* cursor) const; |
|
41 ZForwardingTableEntry first(uintptr_t from_index, ZForwardingTableCursor* cursor) const; |
|
42 ZForwardingTableEntry next(ZForwardingTableCursor* cursor) const; |
|
43 |
34 |
44 public: |
35 public: |
45 ZForwardingTable(); |
36 ZForwardingTable(); |
46 ~ZForwardingTable(); |
|
47 |
37 |
48 bool is_null() const; |
38 ZForwarding* get(uintptr_t addr) const; |
49 void setup(size_t live_objects); |
|
50 void reset(); |
|
51 |
39 |
52 ZForwardingTableEntry find(uintptr_t from_index) const; |
40 void insert(uintptr_t start, |
53 ZForwardingTableEntry find(uintptr_t from_index, ZForwardingTableCursor* cursor) const; |
41 size_t size, |
54 uintptr_t insert(uintptr_t from_index, uintptr_t to_offset, ZForwardingTableCursor* cursor); |
42 size_t object_alignment_shift, |
55 |
43 uint32_t live_objects); |
56 void verify(size_t object_max_count, size_t live_objects) const; |
44 void clear(); |
57 }; |
45 }; |
58 |
46 |
59 #endif // SHARE_GC_Z_ZFORWARDINGTABLE_HPP |
47 #endif // SHARE_GC_Z_ZFORWARDINGTABLE_HPP |