83 _result = g1h->attempt_allocation_at_safepoint(_word_size,
84 false /* expect_null_cur_alloc_region */);
85 if (_result != NULL) {
86 // If we can successfully allocate before we actually do the
87 // pause then we will consider this pause successful.
88 _pause_succeeded = true;
89 return;
90 }
91 }
92
93 GCCauseSetter x(g1h, _gc_cause);
94 if (_should_initiate_conc_mark) {
95 // It's safer to read old_marking_cycles_completed() here, given
96 // that noone else will be updating it concurrently. Since we'll
97 // only need it if we're initiating a marking cycle, no point in
98 // setting it earlier.
99 _old_marking_cycles_completed_before = g1h->old_marking_cycles_completed();
100
101 // At this point we are supposed to start a concurrent cycle. We
102 // will do so if one is not already in progress.
103 bool res = g1h->g1_policy()->force_initial_mark_if_outside_cycle(_gc_cause);
104
105 // The above routine returns true if we were able to force the
106 // next GC pause to be an initial mark; it returns false if a
107 // marking cycle is already in progress.
108 //
109 // If a marking cycle is already in progress just return and skip the
110 // pause below - if the reason for requesting this initial mark pause
111 // was due to a System.gc() then the requesting thread should block in
112 // doit_epilogue() until the marking cycle is complete.
113 //
114 // If this initial mark pause was requested as part of a humongous
115 // allocation then we know that the marking cycle must just have
116 // been started by another thread (possibly also allocating a humongous
117 // object) as there was no active marking cycle when the requesting
118 // thread checked before calling collect() in
119 // attempt_allocation_humongous(). Retrying the GC, in this case,
120 // will cause the requesting thread to spin inside collect() until the
121 // just started marking cycle is complete - which may be a while. So
122 // we do NOT retry the GC.
123 if (!res) {
|
83 _result = g1h->attempt_allocation_at_safepoint(_word_size,
84 false /* expect_null_cur_alloc_region */);
85 if (_result != NULL) {
86 // If we can successfully allocate before we actually do the
87 // pause then we will consider this pause successful.
88 _pause_succeeded = true;
89 return;
90 }
91 }
92
93 GCCauseSetter x(g1h, _gc_cause);
94 if (_should_initiate_conc_mark) {
95 // It's safer to read old_marking_cycles_completed() here, given
96 // that noone else will be updating it concurrently. Since we'll
97 // only need it if we're initiating a marking cycle, no point in
98 // setting it earlier.
99 _old_marking_cycles_completed_before = g1h->old_marking_cycles_completed();
100
101 // At this point we are supposed to start a concurrent cycle. We
102 // will do so if one is not already in progress.
103 bool res = g1h->policy()->force_initial_mark_if_outside_cycle(_gc_cause);
104
105 // The above routine returns true if we were able to force the
106 // next GC pause to be an initial mark; it returns false if a
107 // marking cycle is already in progress.
108 //
109 // If a marking cycle is already in progress just return and skip the
110 // pause below - if the reason for requesting this initial mark pause
111 // was due to a System.gc() then the requesting thread should block in
112 // doit_epilogue() until the marking cycle is complete.
113 //
114 // If this initial mark pause was requested as part of a humongous
115 // allocation then we know that the marking cycle must just have
116 // been started by another thread (possibly also allocating a humongous
117 // object) as there was no active marking cycle when the requesting
118 // thread checked before calling collect() in
119 // attempt_allocation_humongous(). Retrying the GC, in this case,
120 // will cause the requesting thread to spin inside collect() until the
121 // just started marking cycle is complete - which may be a while. So
122 // we do NOT retry the GC.
123 if (!res) {
|