comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 23029:0f8f1250fed5

8078023: verify_no_cset_oops found reclaimed humongous object in SATB buffer Summary: Removed no longer valid checking of SATB buffers Reviewed-by: jmasa, pliden
author kbarrett
date Wed, 22 Apr 2015 14:06:49 -0400
parents b5d14ef905b5
children 399885e13e90
comparison
equal deleted inserted replaced
23028:b5d14ef905b5 23029:0f8f1250fed5
3057 } 3057 }
3058 3058
3059 #ifndef PRODUCT 3059 #ifndef PRODUCT
3060 enum VerifyNoCSetOopsPhase { 3060 enum VerifyNoCSetOopsPhase {
3061 VerifyNoCSetOopsStack, 3061 VerifyNoCSetOopsStack,
3062 VerifyNoCSetOopsQueues, 3062 VerifyNoCSetOopsQueues
3063 VerifyNoCSetOopsSATBCompleted,
3064 VerifyNoCSetOopsSATBThread
3065 }; 3063 };
3066 3064
3067 class VerifyNoCSetOopsClosure : public OopClosure, public ObjectClosure { 3065 class VerifyNoCSetOopsClosure : public OopClosure, public ObjectClosure {
3068 private: 3066 private:
3069 G1CollectedHeap* _g1h; 3067 G1CollectedHeap* _g1h;
3072 3070
3073 const char* phase_str() { 3071 const char* phase_str() {
3074 switch (_phase) { 3072 switch (_phase) {
3075 case VerifyNoCSetOopsStack: return "Stack"; 3073 case VerifyNoCSetOopsStack: return "Stack";
3076 case VerifyNoCSetOopsQueues: return "Queue"; 3074 case VerifyNoCSetOopsQueues: return "Queue";
3077 case VerifyNoCSetOopsSATBCompleted: return "Completed SATB Buffers";
3078 case VerifyNoCSetOopsSATBThread: return "Thread SATB Buffers";
3079 default: ShouldNotReachHere(); 3075 default: ShouldNotReachHere();
3080 } 3076 }
3081 return NULL; 3077 return NULL;
3082 } 3078 }
3083 3079
3100 do_object_work(obj); 3096 do_object_work(obj);
3101 } 3097 }
3102 3098
3103 virtual void do_oop(narrowOop* p) { 3099 virtual void do_oop(narrowOop* p) {
3104 // We should not come across narrow oops while scanning marking 3100 // We should not come across narrow oops while scanning marking
3105 // stacks and SATB buffers. 3101 // stacks
3106 ShouldNotReachHere(); 3102 ShouldNotReachHere();
3107 } 3103 }
3108 3104
3109 virtual void do_object(oop obj) { 3105 virtual void do_object(oop obj) {
3110 do_object_work(obj); 3106 do_object_work(obj);
3111 } 3107 }
3112 }; 3108 };
3113 3109
3114 void ConcurrentMark::verify_no_cset_oops(bool verify_stacks, 3110 void ConcurrentMark::verify_no_cset_oops() {
3115 bool verify_enqueued_buffers,
3116 bool verify_thread_buffers,
3117 bool verify_fingers) {
3118 assert(SafepointSynchronize::is_at_safepoint(), "should be at a safepoint"); 3111 assert(SafepointSynchronize::is_at_safepoint(), "should be at a safepoint");
3119 if (!G1CollectedHeap::heap()->mark_in_progress()) { 3112 if (!G1CollectedHeap::heap()->mark_in_progress()) {
3120 return; 3113 return;
3121 } 3114 }
3122 3115
3123 VerifyNoCSetOopsClosure cl; 3116 VerifyNoCSetOopsClosure cl;
3124 3117
3125 if (verify_stacks) { 3118 // Verify entries on the global mark stack
3126 // Verify entries on the global mark stack 3119 cl.set_phase(VerifyNoCSetOopsStack);
3127 cl.set_phase(VerifyNoCSetOopsStack); 3120 _markStack.oops_do(&cl);
3128 _markStack.oops_do(&cl); 3121
3129 3122 // Verify entries on the task queues
3130 // Verify entries on the task queues 3123 for (uint i = 0; i < _max_worker_id; i += 1) {
3131 for (uint i = 0; i < _max_worker_id; i += 1) { 3124 cl.set_phase(VerifyNoCSetOopsQueues, i);
3132 cl.set_phase(VerifyNoCSetOopsQueues, i); 3125 CMTaskQueue* queue = _task_queues->queue(i);
3133 CMTaskQueue* queue = _task_queues->queue(i); 3126 queue->oops_do(&cl);
3134 queue->oops_do(&cl); 3127 }
3135 } 3128
3136 } 3129 // Verify the global finger
3137 3130 HeapWord* global_finger = finger();
3138 SATBMarkQueueSet& satb_qs = JavaThread::satb_mark_queue_set(); 3131 if (global_finger != NULL && global_finger < _heap_end) {
3139 3132 // The global finger always points to a heap region boundary. We
3140 // Verify entries on the enqueued SATB buffers 3133 // use heap_region_containing_raw() to get the containing region
3141 if (verify_enqueued_buffers) { 3134 // given that the global finger could be pointing to a free region
3142 cl.set_phase(VerifyNoCSetOopsSATBCompleted); 3135 // which subsequently becomes continues humongous. If that
3143 satb_qs.iterate_completed_buffers_read_only(&cl); 3136 // happens, heap_region_containing() will return the bottom of the
3144 } 3137 // corresponding starts humongous region and the check below will
3145 3138 // not hold any more.
3146 // Verify entries on the per-thread SATB buffers 3139 // Since we always iterate over all regions, we might get a NULL HeapRegion
3147 if (verify_thread_buffers) { 3140 // here.
3148 cl.set_phase(VerifyNoCSetOopsSATBThread); 3141 HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger);
3149 satb_qs.iterate_thread_buffers_read_only(&cl); 3142 guarantee(global_hr == NULL || global_finger == global_hr->bottom(),
3150 } 3143 err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT,
3151 3144 p2i(global_finger), HR_FORMAT_PARAMS(global_hr)));
3152 if (verify_fingers) { 3145 }
3153 // Verify the global finger 3146
3154 HeapWord* global_finger = finger(); 3147 // Verify the task fingers
3155 if (global_finger != NULL && global_finger < _heap_end) { 3148 assert(parallel_marking_threads() <= _max_worker_id, "sanity");
3156 // The global finger always points to a heap region boundary. We 3149 for (int i = 0; i < (int) parallel_marking_threads(); i += 1) {
3157 // use heap_region_containing_raw() to get the containing region 3150 CMTask* task = _tasks[i];
3158 // given that the global finger could be pointing to a free region 3151 HeapWord* task_finger = task->finger();
3159 // which subsequently becomes continues humongous. If that 3152 if (task_finger != NULL && task_finger < _heap_end) {
3160 // happens, heap_region_containing() will return the bottom of the 3153 // See above note on the global finger verification.
3161 // corresponding starts humongous region and the check below will 3154 HeapRegion* task_hr = _g1h->heap_region_containing_raw(task_finger);
3162 // not hold any more. 3155 guarantee(task_hr == NULL || task_finger == task_hr->bottom() ||
3163 // Since we always iterate over all regions, we might get a NULL HeapRegion 3156 !task_hr->in_collection_set(),
3164 // here. 3157 err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT,
3165 HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger); 3158 p2i(task_finger), HR_FORMAT_PARAMS(task_hr)));
3166 guarantee(global_hr == NULL || global_finger == global_hr->bottom(),
3167 err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT,
3168 p2i(global_finger), HR_FORMAT_PARAMS(global_hr)));
3169 }
3170
3171 // Verify the task fingers
3172 assert(parallel_marking_threads() <= _max_worker_id, "sanity");
3173 for (int i = 0; i < (int) parallel_marking_threads(); i += 1) {
3174 CMTask* task = _tasks[i];
3175 HeapWord* task_finger = task->finger();
3176 if (task_finger != NULL && task_finger < _heap_end) {
3177 // See above note on the global finger verification.
3178 HeapRegion* task_hr = _g1h->heap_region_containing_raw(task_finger);
3179 guarantee(task_hr == NULL || task_finger == task_hr->bottom() ||
3180 !task_hr->in_collection_set(),
3181 err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT,
3182 p2i(task_finger), HR_FORMAT_PARAMS(task_hr)));
3183 }
3184 } 3159 }
3185 } 3160 }
3186 } 3161 }
3187 #endif // PRODUCT 3162 #endif // PRODUCT
3188 3163