25 #include "precompiled.hpp"
26 #include "code/codeCache.hpp"
27 #include "compiler/compileTask.hpp"
28 #include "runtime/advancedThresholdPolicy.hpp"
29 #include "runtime/simpleThresholdPolicy.inline.hpp"
30
31 #ifdef TIERED
32 // Print an event.
33 void AdvancedThresholdPolicy::print_specific(EventType type, methodHandle mh, methodHandle imh,
34 int bci, CompLevel level) {
35 tty->print(" rate=");
36 if (mh->prev_time() == 0) tty->print("n/a");
37 else tty->print("%f", mh->rate());
38
39 tty->print(" k=%.2lf,%.2lf", threshold_scale(CompLevel_full_profile, Tier3LoadFeedback),
40 threshold_scale(CompLevel_full_optimization, Tier4LoadFeedback));
41
42 }
43
44 void AdvancedThresholdPolicy::initialize() {
45 // Turn on ergonomic compiler count selection
46 if (FLAG_IS_DEFAULT(CICompilerCountPerCPU) && FLAG_IS_DEFAULT(CICompilerCount)) {
47 FLAG_SET_DEFAULT(CICompilerCountPerCPU, true);
48 }
49 int count = CICompilerCount;
50 if (CICompilerCountPerCPU) {
51 // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
52 int log_cpu = log2_intptr(os::active_processor_count());
53 int loglog_cpu = log2_intptr(MAX2(log_cpu, 1));
54 count = MAX2(log_cpu * loglog_cpu, 1) * 3 / 2;
55 }
56
57 set_c1_count(MAX2(count / 3, 1));
58 set_c2_count(MAX2(count - c1_count(), 1));
59 FLAG_SET_ERGO(intx, CICompilerCount, c1_count() + c2_count());
60
61 // Some inlining tuning
62 #ifdef X86
63 if (FLAG_IS_DEFAULT(InlineSmallCode)) {
64 FLAG_SET_DEFAULT(InlineSmallCode, 2000);
65 }
66 #endif
67
68 #if defined SPARC || defined AARCH64
69 if (FLAG_IS_DEFAULT(InlineSmallCode)) {
70 FLAG_SET_DEFAULT(InlineSmallCode, 2500);
71 }
72 #endif
73
74 set_increase_threshold_at_ratio();
75 set_start_time(os::javaTimeMillis());
|
25 #include "precompiled.hpp"
26 #include "code/codeCache.hpp"
27 #include "compiler/compileTask.hpp"
28 #include "runtime/advancedThresholdPolicy.hpp"
29 #include "runtime/simpleThresholdPolicy.inline.hpp"
30
31 #ifdef TIERED
32 // Print an event.
33 void AdvancedThresholdPolicy::print_specific(EventType type, methodHandle mh, methodHandle imh,
34 int bci, CompLevel level) {
35 tty->print(" rate=");
36 if (mh->prev_time() == 0) tty->print("n/a");
37 else tty->print("%f", mh->rate());
38
39 tty->print(" k=%.2lf,%.2lf", threshold_scale(CompLevel_full_profile, Tier3LoadFeedback),
40 threshold_scale(CompLevel_full_optimization, Tier4LoadFeedback));
41
42 }
43
44 void AdvancedThresholdPolicy::initialize() {
45 int count = CICompilerCount;
46 #ifdef _LP64
47 // Turn on ergonomic compiler count selection
48 if (FLAG_IS_DEFAULT(CICompilerCountPerCPU) && FLAG_IS_DEFAULT(CICompilerCount)) {
49 FLAG_SET_DEFAULT(CICompilerCountPerCPU, true);
50 }
51 if (CICompilerCountPerCPU) {
52 // Simple log n seems to grow too slowly for tiered, try something faster: log n * log log n
53 int log_cpu = log2_intptr(os::active_processor_count());
54 int loglog_cpu = log2_intptr(MAX2(log_cpu, 1));
55 count = MAX2(log_cpu * loglog_cpu, 1) * 3 / 2;
56 }
57 #else
58 // On 32-bit systems, the number of compiler threads is limited to 3.
59 // On these systems, the virtual address space available to the JVM
60 // is usually limited to 2-4 GB (the exact value depends on the platform).
61 // As the compilers (especially C2) can consume a large amount of
62 // memory, scaling the number of compiler threads with the number of
63 // available cores can result in the exhaustion of the address space
64 /// available to the VM and thus cause the VM to crash.
65 if (FLAG_IS_DEFAULT(CICompilerCount)) {
66 count = 3;
67 }
68 #endif
69
70 set_c1_count(MAX2(count / 3, 1));
71 set_c2_count(MAX2(count - c1_count(), 1));
72 FLAG_SET_ERGO(intx, CICompilerCount, c1_count() + c2_count());
73
74 // Some inlining tuning
75 #ifdef X86
76 if (FLAG_IS_DEFAULT(InlineSmallCode)) {
77 FLAG_SET_DEFAULT(InlineSmallCode, 2000);
78 }
79 #endif
80
81 #if defined SPARC || defined AARCH64
82 if (FLAG_IS_DEFAULT(InlineSmallCode)) {
83 FLAG_SET_DEFAULT(InlineSmallCode, 2500);
84 }
85 #endif
86
87 set_increase_threshold_at_ratio();
88 set_start_time(os::javaTimeMillis());
|