Mercurial > hg > graal-compiler
annotate src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.hpp @ 20808:d3cec14f33f3
Remove G1 heap hack
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 07 Apr 2015 19:00:45 +0200 |
parents | ae52ee069062 |
children |
rev | line source |
---|---|
20337 | 1 /* |
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 | |
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1PAGEBASEDVIRTUALSPACE_HPP | |
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1PAGEBASEDVIRTUALSPACE_HPP | |
27 | |
28 #include "memory/allocation.hpp" | |
29 #include "memory/memRegion.hpp" | |
30 #include "runtime/virtualspace.hpp" | |
31 #include "utilities/bitMap.hpp" | |
32 | |
33 // Virtual space management helper for a virtual space with an OS page allocation | |
34 // granularity. | |
35 // (De-)Allocation requests are always OS page aligned by passing a page index | |
36 // and multiples of pages. | |
37 // The implementation gives an error when trying to commit or uncommit pages that | |
38 // have already been committed or uncommitted. | |
39 class G1PageBasedVirtualSpace VALUE_OBJ_CLASS_SPEC { | |
40 friend class VMStructs; | |
41 private: | |
42 // Reserved area addresses. | |
43 char* _low_boundary; | |
44 char* _high_boundary; | |
45 | |
46 // The commit/uncommit granularity in bytes. | |
47 size_t _page_size; | |
48 | |
49 // Bitmap used for verification of commit/uncommit operations. | |
50 BitMap _committed; | |
51 | |
20795
ae52ee069062
8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
sjohanss
parents:
20337
diff
changeset
|
52 // Bitmap used to keep track of which pages are dirty or not for _special |
ae52ee069062
8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
sjohanss
parents:
20337
diff
changeset
|
53 // spaces. This is needed because for those spaces the underlying memory |
ae52ee069062
8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
sjohanss
parents:
20337
diff
changeset
|
54 // will only be zero filled the first time it is committed. Calls to commit |
ae52ee069062
8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
sjohanss
parents:
20337
diff
changeset
|
55 // will use this bitmap and return whether or not the memory is zero filled. |
ae52ee069062
8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
sjohanss
parents:
20337
diff
changeset
|
56 BitMap _dirty; |
ae52ee069062
8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
sjohanss
parents:
20337
diff
changeset
|
57 |
20337 | 58 // Indicates that the entire space has been committed and pinned in memory, |
59 // os::commit_memory() or os::uncommit_memory() have no function. | |
60 bool _special; | |
61 | |
62 // Indicates whether the committed space should be executable. | |
63 bool _executable; | |
64 | |
65 // Returns the index of the page which contains the given address. | |
66 uintptr_t addr_to_page_index(char* addr) const; | |
67 // Returns the address of the given page index. | |
68 char* page_start(uintptr_t index); | |
69 // Returns the byte size of the given number of pages. | |
70 size_t byte_size_for_pages(size_t num); | |
71 | |
72 // Returns true if the entire area is backed by committed memory. | |
73 bool is_area_committed(uintptr_t start, size_t size_in_pages) const; | |
74 // Returns true if the entire area is not backed by committed memory. | |
75 bool is_area_uncommitted(uintptr_t start, size_t size_in_pages) const; | |
76 | |
77 public: | |
78 | |
79 // Commit the given area of pages starting at start being size_in_pages large. | |
20795
ae52ee069062
8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
sjohanss
parents:
20337
diff
changeset
|
80 // Returns true if the given area is zero filled upon completion. |
ae52ee069062
8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
sjohanss
parents:
20337
diff
changeset
|
81 bool commit(uintptr_t start, size_t size_in_pages); |
20337 | 82 |
83 // Uncommit the given area of pages starting at start being size_in_pages large. | |
20795
ae52ee069062
8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
sjohanss
parents:
20337
diff
changeset
|
84 void uncommit(uintptr_t start, size_t size_in_pages); |
20337 | 85 |
86 // Initialization | |
87 G1PageBasedVirtualSpace(); | |
88 bool initialize_with_granularity(ReservedSpace rs, size_t page_size); | |
89 | |
90 // Destruction | |
91 ~G1PageBasedVirtualSpace(); | |
92 | |
93 // Amount of reserved memory. | |
94 size_t reserved_size() const; | |
95 // Memory used in this virtual space. | |
96 size_t committed_size() const; | |
97 // Memory left to use/expand in this virtual space. | |
98 size_t uncommitted_size() const; | |
99 | |
100 bool contains(const void* p) const; | |
101 | |
102 MemRegion reserved() { | |
103 MemRegion x((HeapWord*)_low_boundary, reserved_size() / HeapWordSize); | |
104 return x; | |
105 } | |
106 | |
107 void release(); | |
108 | |
109 void check_for_contiguity() PRODUCT_RETURN; | |
110 | |
111 // Debugging | |
112 void print_on(outputStream* out) PRODUCT_RETURN; | |
113 void print(); | |
114 }; | |
115 | |
116 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1PAGEBASEDVIRTUALSPACE_HPP |