Mercurial > hg > graal-compiler
annotate src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.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 | 7baf47cb97cb |
children |
rev | line source |
---|---|
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
1 /* |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
4 * |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
8 * |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
13 * accompanied this code). |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
14 * |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
18 * |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
21 * questions. |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
22 * |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
23 */ |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
24 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1CODECACHEREMSET_HPP |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1CODECACHEREMSET_HPP |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
27 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
28 #include "memory/allocation.hpp" |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
29 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
30 class CodeBlobClosure; |
20494 | 31 class CodeRootSetTable; |
32 class HeapRegion; | |
33 class nmethod; | |
20211
82693fb204a5
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
17753
diff
changeset
|
34 |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
35 // Implements storage for a set of code roots. |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
36 // All methods that modify the set are not thread-safe except if otherwise noted. |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
37 class G1CodeRootSet VALUE_OBJ_CLASS_SPEC { |
20494 | 38 friend class G1CodeRootSetTest; |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
39 private: |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
40 |
20494 | 41 const static size_t SmallSize = 32; |
42 const static size_t Threshold = 24; | |
43 const static size_t LargeSize = 512; | |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
44 |
20494 | 45 CodeRootSetTable* _table; |
46 CodeRootSetTable* load_acquire_table(); | |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
47 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
48 size_t _length; |
20494 | 49 |
50 void move_to_large(); | |
51 void allocate_small_table(); | |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
52 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
53 public: |
20494 | 54 G1CodeRootSet() : _table(NULL), _length(0) {} |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
55 ~G1CodeRootSet(); |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
56 |
20494 | 57 static void purge(); |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
58 |
20494 | 59 static size_t static_mem_size(); |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
60 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
61 void add(nmethod* method); |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
62 |
20494 | 63 bool remove(nmethod* method); |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
64 |
20494 | 65 // Safe to call without synchronization, but may return false negatives. |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
66 bool contains(nmethod* method); |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
67 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
68 void clear(); |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
69 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
70 void nmethods_do(CodeBlobClosure* blk) const; |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
71 |
20494 | 72 // Remove all nmethods which no longer contain pointers into our "owner" region |
73 void clean(HeapRegion* owner); | |
74 | |
75 bool is_empty() { | |
76 bool empty = length() == 0; | |
77 assert(empty == (_table == NULL), "is empty only if table is deallocated"); | |
78 return empty; | |
79 } | |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
80 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
81 // Length in elements |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
82 size_t length() const { return _length; } |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
83 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
84 // Memory size in bytes taken by this set. |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
85 size_t mem_size(); |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
86 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
87 }; |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
88 |
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
89 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1CODECACHEREMSET_HPP |