author | pliden |
Tue, 03 Jun 2014 10:37:46 +0200 | |
changeset 24844 | d1345c68cea9 |
parent 24108 | dfc2242fc6b0 |
child 25490 | 59f226da8d81 |
permissions | -rw-r--r-- |
23451
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
1 |
/* |
ed2b8bb28fed
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. |
ed2b8bb28fed
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. |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
4 |
* |
ed2b8bb28fed
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 |
ed2b8bb28fed
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 |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
8 |
* |
ed2b8bb28fed
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 |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ed2b8bb28fed
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 |
ed2b8bb28fed
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 |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
13 |
* accompanied this code). |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
14 |
* |
ed2b8bb28fed
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 |
ed2b8bb28fed
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, |
ed2b8bb28fed
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. |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
18 |
* |
ed2b8bb28fed
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 |
ed2b8bb28fed
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 |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
21 |
* questions. |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
22 |
* |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
23 |
*/ |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
24 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1CODECACHEREMSET_HPP |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
26 |
#define SHARE_VM_GC_IMPLEMENTATION_G1_G1CODECACHEREMSET_HPP |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
27 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
28 |
#include "memory/allocation.hpp" |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
29 |
#include "memory/freeList.hpp" |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
30 |
#include "runtime/globals.hpp" |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
31 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
32 |
class CodeBlobClosure; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
33 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
34 |
class G1CodeRootChunk : public CHeapObj<mtGC> { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
35 |
private: |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
36 |
static const int NUM_ENTRIES = 32; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
37 |
public: |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
38 |
G1CodeRootChunk* _next; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
39 |
G1CodeRootChunk* _prev; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
40 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
41 |
nmethod** _top; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
42 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
43 |
nmethod* _data[NUM_ENTRIES]; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
44 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
45 |
nmethod** bottom() const { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
46 |
return (nmethod**) &(_data[0]); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
47 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
48 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
49 |
nmethod** end() const { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
50 |
return (nmethod**) &(_data[NUM_ENTRIES]); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
51 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
52 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
53 |
public: |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
54 |
G1CodeRootChunk(); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
55 |
~G1CodeRootChunk() {} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
56 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
57 |
static size_t word_size() { return (size_t)(align_size_up_(sizeof(G1CodeRootChunk), HeapWordSize) / HeapWordSize); } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
58 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
59 |
// FreeList "interface" methods |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
60 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
61 |
G1CodeRootChunk* next() const { return _next; } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
62 |
G1CodeRootChunk* prev() const { return _prev; } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
63 |
void set_next(G1CodeRootChunk* v) { _next = v; assert(v != this, "Boom");} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
64 |
void set_prev(G1CodeRootChunk* v) { _prev = v; assert(v != this, "Boom");} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
65 |
void clear_next() { set_next(NULL); } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
66 |
void clear_prev() { set_prev(NULL); } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
67 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
68 |
size_t size() const { return word_size(); } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
69 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
70 |
void link_next(G1CodeRootChunk* ptr) { set_next(ptr); } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
71 |
void link_prev(G1CodeRootChunk* ptr) { set_prev(ptr); } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
72 |
void link_after(G1CodeRootChunk* ptr) { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
73 |
link_next(ptr); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
74 |
if (ptr != NULL) ptr->link_prev((G1CodeRootChunk*)this); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
75 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
76 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
77 |
bool is_free() { return true; } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
78 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
79 |
// New G1CodeRootChunk routines |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
80 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
81 |
void reset(); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
82 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
83 |
bool is_empty() const { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
84 |
return _top == bottom(); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
85 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
86 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
87 |
bool is_full() const { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
88 |
return _top == (nmethod**)end(); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
89 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
90 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
91 |
bool contains(nmethod* method) { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
92 |
nmethod** cur = bottom(); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
93 |
while (cur != _top) { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
94 |
if (*cur == method) return true; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
95 |
cur++; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
96 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
97 |
return false; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
98 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
99 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
100 |
bool add(nmethod* method) { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
101 |
if (is_full()) return false; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
102 |
*_top = method; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
103 |
_top++; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
104 |
return true; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
105 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
106 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
107 |
bool remove(nmethod* method) { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
108 |
nmethod** cur = bottom(); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
109 |
while (cur != _top) { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
110 |
if (*cur == method) { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
111 |
memmove(cur, cur + 1, (_top - (cur + 1)) * sizeof(nmethod**)); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
112 |
_top--; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
113 |
return true; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
114 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
115 |
cur++; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
116 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
117 |
return false; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
118 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
119 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
120 |
void nmethods_do(CodeBlobClosure* blk); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
121 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
122 |
nmethod* pop() { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
123 |
if (is_empty()) { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
124 |
return NULL; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
125 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
126 |
_top--; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
127 |
return *_top; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
128 |
} |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
129 |
}; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
130 |
|
24099
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
131 |
// Manages free chunks. |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
132 |
class G1CodeRootChunkManager VALUE_OBJ_CLASS_SPEC { |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
133 |
private: |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
134 |
// Global free chunk list management |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
135 |
FreeList<G1CodeRootChunk> _free_list; |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
136 |
// Total number of chunks handed out |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
137 |
size_t _num_chunks_handed_out; |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
138 |
|
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
139 |
public: |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
140 |
G1CodeRootChunkManager(); |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
141 |
|
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
142 |
G1CodeRootChunk* new_chunk(); |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
143 |
void free_chunk(G1CodeRootChunk* chunk); |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
144 |
// Free all elements of the given list. |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
145 |
void free_all_chunks(FreeList<G1CodeRootChunk>* list); |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
146 |
|
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
147 |
void initialize(); |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
148 |
void purge_chunks(size_t keep_ratio); |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
149 |
|
24108
dfc2242fc6b0
8040792: G1: Memory usage calculation uses sizeof(this) instead of sizeof(classname)
tschatzl
parents:
24099
diff
changeset
|
150 |
static size_t static_mem_size(); |
24099
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
151 |
size_t fl_mem_size(); |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
152 |
|
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
153 |
#ifndef PRODUCT |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
154 |
size_t num_chunks_handed_out() const; |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
155 |
size_t num_free_chunks() const; |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
156 |
#endif |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
157 |
}; |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
158 |
|
23451
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
159 |
// Implements storage for a set of code roots. |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
160 |
// All methods that modify the set are not thread-safe except if otherwise noted. |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
161 |
class G1CodeRootSet VALUE_OBJ_CLASS_SPEC { |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
162 |
private: |
24099
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
163 |
// Global default free chunk manager instance. |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
164 |
static G1CodeRootChunkManager _default_chunk_manager; |
23451
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
165 |
|
24099
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
166 |
G1CodeRootChunk* new_chunk() { return _manager->new_chunk(); } |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
167 |
void free_chunk(G1CodeRootChunk* chunk) { _manager->free_chunk(chunk); } |
23451
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
168 |
// Free all elements of the given list. |
24099
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
169 |
void free_all_chunks(FreeList<G1CodeRootChunk>* list) { _manager->free_all_chunks(list); } |
23451
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
170 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
171 |
// Return the chunk that contains the given nmethod, NULL otherwise. |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
172 |
// Scans the list of chunks backwards, as this method is used to add new |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
173 |
// entries, which are typically added in bulk for a single nmethod. |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
174 |
G1CodeRootChunk* find(nmethod* method); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
175 |
void free(G1CodeRootChunk* chunk); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
176 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
177 |
size_t _length; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
178 |
FreeList<G1CodeRootChunk> _list; |
24099
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
179 |
G1CodeRootChunkManager* _manager; |
23451
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
180 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
181 |
public: |
24099
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
182 |
// If an instance is initialized with a chunk manager of NULL, use the global |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
183 |
// default one. |
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
184 |
G1CodeRootSet(G1CodeRootChunkManager* manager = NULL); |
23451
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
185 |
~G1CodeRootSet(); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
186 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
187 |
static void purge_chunks(size_t keep_ratio); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
188 |
|
24108
dfc2242fc6b0
8040792: G1: Memory usage calculation uses sizeof(this) instead of sizeof(classname)
tschatzl
parents:
24099
diff
changeset
|
189 |
static size_t free_chunks_static_mem_size(); |
24099
9c132a88935d
8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
tschatzl
parents:
23451
diff
changeset
|
190 |
static size_t free_chunks_mem_size(); |
23451
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
191 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
192 |
// Search for the code blob from the recently allocated ones to find duplicates more quickly, as this |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
193 |
// method is likely to be repeatedly called with the same nmethod. |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
194 |
void add(nmethod* method); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
195 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
196 |
void remove(nmethod* method); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
197 |
nmethod* pop(); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
198 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
199 |
bool contains(nmethod* method); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
200 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
201 |
void clear(); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
202 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
203 |
void nmethods_do(CodeBlobClosure* blk) const; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
204 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
205 |
bool is_empty() { return length() == 0; } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
206 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
207 |
// Length in elements |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
208 |
size_t length() const { return _length; } |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
209 |
|
24108
dfc2242fc6b0
8040792: G1: Memory usage calculation uses sizeof(this) instead of sizeof(classname)
tschatzl
parents:
24099
diff
changeset
|
210 |
// Static data memory size in bytes of this set. |
dfc2242fc6b0
8040792: G1: Memory usage calculation uses sizeof(this) instead of sizeof(classname)
tschatzl
parents:
24099
diff
changeset
|
211 |
static size_t static_mem_size(); |
23451
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
212 |
// Memory size in bytes taken by this set. |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
213 |
size_t mem_size(); |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
214 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
215 |
static void test() PRODUCT_RETURN; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
216 |
}; |
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
217 |
|
ed2b8bb28fed
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff
changeset
|
218 |
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1CODECACHEREMSET_HPP |