annotate src/share/vm/memory/restore.cpp @ 1994:6cd6d394f280

7001033: assert(gch->gc_cause() == GCCause::_scavenge_alot || !gch->incremental_collection_failed()) 7002546: regression on SpecJbb2005 on 7b118 comparing to 7b117 on small heaps Summary: Relaxed assertion checking related to incremental_collection_failed flag to allow for ExplicitGCInvokesConcurrent behaviour where we do not want a failing scavenge to bail to a stop-world collection. Parameterized incremental_collection_will_fail() so we can selectively use, or not use, as appropriate, the statistical prediction at specific use sites. This essentially reverts the scavenge bail-out logic to what it was prior to some recent changes that had inadvertently started using the statistical prediction which can be noisy in the presence of bursty loads. Added some associated verbose non-product debugging messages. Reviewed-by: johnc, tonyp
author ysr
date Tue, 07 Dec 2010 21:55:53 -0800
parents f95d63e2154a
children 3582bf76420e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "classfile/symbolTable.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "classfile/systemDictionary.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "memory/filemap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "utilities/hashtable.inline.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // Closure for serializing initialization data in from a data area
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // (oop_array) read from the shared file.
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 class ReadClosure : public SerializeOopClosure {
a61af66fc99e Initial load
duke
parents:
diff changeset
37 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
38 oop** _oop_array;
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 inline oop nextOop() {
a61af66fc99e Initial load
duke
parents:
diff changeset
41 return *(*_oop_array)++;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 }
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
45 ReadClosure(oop** oop_array) { _oop_array = oop_array; }
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 void do_oop(oop* p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 assert(SharedSkipVerify || *p == NULL || *p == Universe::klassKlassObj(),
a61af66fc99e Initial load
duke
parents:
diff changeset
49 "initializing previously initialized oop.");
a61af66fc99e Initial load
duke
parents:
diff changeset
50 oop obj = nextOop();
a61af66fc99e Initial load
duke
parents:
diff changeset
51 assert(SharedSkipVerify || (intptr_t)obj >= 0 || (intptr_t)obj < -100,
a61af66fc99e Initial load
duke
parents:
diff changeset
52 "hit tag while initializing oops.");
a61af66fc99e Initial load
duke
parents:
diff changeset
53 assert(SharedSkipVerify || obj->is_oop_or_null(), "invalid oop");
a61af66fc99e Initial load
duke
parents:
diff changeset
54 *p = obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
55 }
a61af66fc99e Initial load
duke
parents:
diff changeset
56
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
57 void do_oop(narrowOop* p) { ShouldNotReachHere(); }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
58
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59 void do_ptr(void** p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
60 assert(*p == NULL, "initializing previous initialized pointer.");
a61af66fc99e Initial load
duke
parents:
diff changeset
61 void* obj = nextOop();
a61af66fc99e Initial load
duke
parents:
diff changeset
62 assert((intptr_t)obj >= 0 || (intptr_t)obj < -100,
a61af66fc99e Initial load
duke
parents:
diff changeset
63 "hit tag while initializing ptrs.");
a61af66fc99e Initial load
duke
parents:
diff changeset
64 *p = obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 }
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 void do_ptr(HeapWord** p) { do_ptr((void **) p); }
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 void do_int(int* p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 *p = (int)(intptr_t)nextOop();
a61af66fc99e Initial load
duke
parents:
diff changeset
71 }
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 void do_size_t(size_t* p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // Assumes that size_t and pointers are the same size.
a61af66fc99e Initial load
duke
parents:
diff changeset
75 *p = (size_t)nextOop();
a61af66fc99e Initial load
duke
parents:
diff changeset
76 }
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 void do_tag(int tag) {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 int old_tag;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 do_int(&old_tag);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 FileMapInfo::assert_mark(tag == old_tag);
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 void do_region(u_char* start, size_t size) {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 assert((intptr_t)start % sizeof(oop) == 0, "bad alignment");
a61af66fc99e Initial load
duke
parents:
diff changeset
86 assert(size % sizeof(oop) == 0, "bad size");
a61af66fc99e Initial load
duke
parents:
diff changeset
87 do_tag((int)size);
a61af66fc99e Initial load
duke
parents:
diff changeset
88 while (size > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
89 *(oop*)start = nextOop();
a61af66fc99e Initial load
duke
parents:
diff changeset
90 start += sizeof(oop);
a61af66fc99e Initial load
duke
parents:
diff changeset
91 size -= sizeof(oop);
a61af66fc99e Initial load
duke
parents:
diff changeset
92 }
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 bool reading() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
96 };
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Read the oop and miscellaneous data from the shared file, and
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // serialize it out to its various destinations.
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 void CompactingPermGenGen::initialize_oops() {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 FileMapInfo *mapinfo = FileMapInfo::current_info();
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 char* buffer = mapinfo->region_base(md);
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // Skip over (reserve space for) a list of addresses of C++ vtables
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // for Klass objects. They get filled in later.
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // Skip over (reserve space for) dummy C++ vtables Klass objects.
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // They are used as is.
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 void** vtbl_list = (void**)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
114 buffer += vtbl_list_size * sizeof(void*);
a61af66fc99e Initial load
duke
parents:
diff changeset
115 intptr_t vtable_size = *(intptr_t*)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
116 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
117 buffer += vtable_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // Create the symbol table using the bucket array at this spot in the
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // misc data space. Since the symbol table is often modified, this
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // region (of mapped pages) will be copy-on-write.
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 int symbolTableLen = *(intptr_t*)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
125 int number_of_entries = *(intptr_t*)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
126 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 SymbolTable::create_table((HashtableBucket*)buffer, symbolTableLen,
a61af66fc99e Initial load
duke
parents:
diff changeset
128 number_of_entries);
a61af66fc99e Initial load
duke
parents:
diff changeset
129 buffer += symbolTableLen;
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // Create the string table using the bucket array at this spot in the
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // misc data space. Since the string table is often modified, this
a61af66fc99e Initial load
duke
parents:
diff changeset
133 // region (of mapped pages) will be copy-on-write.
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 int stringTableLen = *(intptr_t*)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
136 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
137 number_of_entries = *(intptr_t*)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
138 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
139 StringTable::create_table((HashtableBucket*)buffer, stringTableLen,
a61af66fc99e Initial load
duke
parents:
diff changeset
140 number_of_entries);
a61af66fc99e Initial load
duke
parents:
diff changeset
141 buffer += stringTableLen;
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // Create the shared dictionary using the bucket array at this spot in
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // the misc data space. Since the shared dictionary table is never
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // modified, this region (of mapped pages) will be (effectively, if
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // not explicitly) read-only.
a61af66fc99e Initial load
duke
parents:
diff changeset
147
a61af66fc99e Initial load
duke
parents:
diff changeset
148 int sharedDictionaryLen = *(intptr_t*)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
149 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
150 number_of_entries = *(intptr_t*)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
151 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
152 SystemDictionary::set_shared_dictionary((HashtableBucket*)buffer,
a61af66fc99e Initial load
duke
parents:
diff changeset
153 sharedDictionaryLen,
a61af66fc99e Initial load
duke
parents:
diff changeset
154 number_of_entries);
a61af66fc99e Initial load
duke
parents:
diff changeset
155 buffer += sharedDictionaryLen;
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // Create the package info table using the bucket array at this spot in
a61af66fc99e Initial load
duke
parents:
diff changeset
158 // the misc data space. Since the package info table is never
a61af66fc99e Initial load
duke
parents:
diff changeset
159 // modified, this region (of mapped pages) will be (effectively, if
a61af66fc99e Initial load
duke
parents:
diff changeset
160 // not explicitly) read-only.
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 int pkgInfoLen = *(intptr_t*)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
163 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
164 number_of_entries = *(intptr_t*)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
165 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
166 ClassLoader::create_package_info_table((HashtableBucket*)buffer, pkgInfoLen,
a61af66fc99e Initial load
duke
parents:
diff changeset
167 number_of_entries);
a61af66fc99e Initial load
duke
parents:
diff changeset
168 buffer += pkgInfoLen;
a61af66fc99e Initial load
duke
parents:
diff changeset
169 ClassLoader::verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
170
a61af66fc99e Initial load
duke
parents:
diff changeset
171 // The following data in the shared misc data region are the linked
a61af66fc99e Initial load
duke
parents:
diff changeset
172 // list elements (HashtableEntry objects) for the symbol table, string
a61af66fc99e Initial load
duke
parents:
diff changeset
173 // table, and shared dictionary. The heap objects refered to by the
a61af66fc99e Initial load
duke
parents:
diff changeset
174 // symbol table, string table, and shared dictionary are permanent and
a61af66fc99e Initial load
duke
parents:
diff changeset
175 // unmovable. Since new entries added to the string and symbol tables
a61af66fc99e Initial load
duke
parents:
diff changeset
176 // are always added at the beginning of the linked lists, THESE LINKED
a61af66fc99e Initial load
duke
parents:
diff changeset
177 // LIST ELEMENTS ARE READ-ONLY.
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179 int len = *(intptr_t*)buffer; // skip over symbol table entries
a61af66fc99e Initial load
duke
parents:
diff changeset
180 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
181 buffer += len;
a61af66fc99e Initial load
duke
parents:
diff changeset
182
a61af66fc99e Initial load
duke
parents:
diff changeset
183 len = *(intptr_t*)buffer; // skip over string table entries
a61af66fc99e Initial load
duke
parents:
diff changeset
184 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
185 buffer += len;
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 len = *(intptr_t*)buffer; // skip over shared dictionary entries
a61af66fc99e Initial load
duke
parents:
diff changeset
188 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
189 buffer += len;
a61af66fc99e Initial load
duke
parents:
diff changeset
190
a61af66fc99e Initial load
duke
parents:
diff changeset
191 len = *(intptr_t*)buffer; // skip over package info table entries
a61af66fc99e Initial load
duke
parents:
diff changeset
192 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
193 buffer += len;
a61af66fc99e Initial load
duke
parents:
diff changeset
194
a61af66fc99e Initial load
duke
parents:
diff changeset
195 len = *(intptr_t*)buffer; // skip over package info table char[] arrays.
a61af66fc99e Initial load
duke
parents:
diff changeset
196 buffer += sizeof(intptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
197 buffer += len;
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199 oop* oop_array = (oop*)buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
200 ReadClosure rc(&oop_array);
a61af66fc99e Initial load
duke
parents:
diff changeset
201 serialize_oops(&rc);
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }