13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "gc/g1/g1Arguments.hpp"
28 #include "gc/g1/g1CollectedHeap.inline.hpp"
29 #include "gc/g1/g1CollectorPolicy.hpp"
30 #include "gc/g1/g1HeapVerifier.hpp"
31 #include "gc/g1/heapRegion.hpp"
32 #include "gc/shared/gcArguments.inline.hpp"
33 #include "runtime/globals.hpp"
34 #include "runtime/globals_extension.hpp"
35 #include "runtime/vm_version.hpp"
36
37 size_t G1Arguments::conservative_max_heap_alignment() {
38 return HeapRegion::max_region_size();
39 }
40
41 void G1Arguments::initialize_verification_types() {
42 if (strlen(VerifyGCType) > 0) {
43 const char delimiter[] = " ,\n";
44 size_t length = strlen(VerifyGCType);
45 char* type_list = NEW_C_HEAP_ARRAY(char, length + 1, mtInternal);
46 strncpy(type_list, VerifyGCType, length + 1);
47 char* token = strtok(type_list, delimiter);
48 while (token != NULL) {
49 parse_verification_type(token);
50 token = strtok(NULL, delimiter);
51 }
52 FREE_C_HEAP_ARRAY(char, type_list);
53 }
54 }
55
58 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyYoungNormal);
59 } else if (strcmp(type, "concurrent-start") == 0) {
60 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyConcurrentStart);
61 } else if (strcmp(type, "mixed") == 0) {
62 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyMixed);
63 } else if (strcmp(type, "remark") == 0) {
64 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyRemark);
65 } else if (strcmp(type, "cleanup") == 0) {
66 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyCleanup);
67 } else if (strcmp(type, "full") == 0) {
68 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyFull);
69 } else {
70 log_warning(gc, verify)("VerifyGCType: '%s' is unknown. Available types are: "
71 "young-normal, concurrent-start, mixed, remark, cleanup and full", type);
72 }
73 }
74
75 void G1Arguments::initialize() {
76 GCArguments::initialize();
77 assert(UseG1GC, "Error");
78 FLAG_SET_DEFAULT(ParallelGCThreads, VM_Version::parallel_worker_threads());
79 if (ParallelGCThreads == 0) {
80 assert(!FLAG_IS_DEFAULT(ParallelGCThreads), "The default value for ParallelGCThreads should not be 0.");
81 vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL);
82 }
83
84 if (FLAG_IS_DEFAULT(G1ConcRefinementThreads)) {
85 FLAG_SET_ERGO(uint, G1ConcRefinementThreads, ParallelGCThreads);
86 }
87
88 // MarkStackSize will be set (if it hasn't been set by the user)
89 // when concurrent marking is initialized.
90 // Its value will be based upon the number of parallel marking threads.
91 // But we do set the maximum mark stack size here.
92 if (FLAG_IS_DEFAULT(MarkStackSizeMax)) {
93 FLAG_SET_DEFAULT(MarkStackSizeMax, 128 * TASKQUEUE_SIZE);
94 }
95
96 if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) {
97 // In G1, we want the default GC overhead goal to be higher than
98 // it is for PS, or the heap might be expanded too aggressively.
|
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "gc/g1/g1Arguments.hpp"
28 #include "gc/g1/g1CollectedHeap.inline.hpp"
29 #include "gc/g1/g1CollectorPolicy.hpp"
30 #include "gc/g1/g1HeapVerifier.hpp"
31 #include "gc/g1/heapRegion.hpp"
32 #include "gc/shared/gcArguments.inline.hpp"
33 #include "gc/shared/workerPolicy.hpp"
34 #include "runtime/globals.hpp"
35 #include "runtime/globals_extension.hpp"
36
37 size_t G1Arguments::conservative_max_heap_alignment() {
38 return HeapRegion::max_region_size();
39 }
40
41 void G1Arguments::initialize_verification_types() {
42 if (strlen(VerifyGCType) > 0) {
43 const char delimiter[] = " ,\n";
44 size_t length = strlen(VerifyGCType);
45 char* type_list = NEW_C_HEAP_ARRAY(char, length + 1, mtInternal);
46 strncpy(type_list, VerifyGCType, length + 1);
47 char* token = strtok(type_list, delimiter);
48 while (token != NULL) {
49 parse_verification_type(token);
50 token = strtok(NULL, delimiter);
51 }
52 FREE_C_HEAP_ARRAY(char, type_list);
53 }
54 }
55
58 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyYoungNormal);
59 } else if (strcmp(type, "concurrent-start") == 0) {
60 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyConcurrentStart);
61 } else if (strcmp(type, "mixed") == 0) {
62 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyMixed);
63 } else if (strcmp(type, "remark") == 0) {
64 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyRemark);
65 } else if (strcmp(type, "cleanup") == 0) {
66 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyCleanup);
67 } else if (strcmp(type, "full") == 0) {
68 G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyFull);
69 } else {
70 log_warning(gc, verify)("VerifyGCType: '%s' is unknown. Available types are: "
71 "young-normal, concurrent-start, mixed, remark, cleanup and full", type);
72 }
73 }
74
75 void G1Arguments::initialize() {
76 GCArguments::initialize();
77 assert(UseG1GC, "Error");
78 FLAG_SET_DEFAULT(ParallelGCThreads, WorkerPolicy::parallel_worker_threads());
79 if (ParallelGCThreads == 0) {
80 assert(!FLAG_IS_DEFAULT(ParallelGCThreads), "The default value for ParallelGCThreads should not be 0.");
81 vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL);
82 }
83
84 if (FLAG_IS_DEFAULT(G1ConcRefinementThreads)) {
85 FLAG_SET_ERGO(uint, G1ConcRefinementThreads, ParallelGCThreads);
86 }
87
88 // MarkStackSize will be set (if it hasn't been set by the user)
89 // when concurrent marking is initialized.
90 // Its value will be based upon the number of parallel marking threads.
91 // But we do set the maximum mark stack size here.
92 if (FLAG_IS_DEFAULT(MarkStackSizeMax)) {
93 FLAG_SET_DEFAULT(MarkStackSizeMax, 128 * TASKQUEUE_SIZE);
94 }
95
96 if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) {
97 // In G1, we want the default GC overhead goal to be higher than
98 // it is for PS, or the heap might be expanded too aggressively.
|