# HG changeset patch # Parent e9776bfd185a7afc5e08ef6083b629a5bdc9a0c8 # User tschatzl diff -r e9776bfd185a -r 639984e96cc3 src/share/vm/gc/g1/concurrentG1Refine.hpp --- a/src/share/vm/gc/g1/concurrentG1Refine.hpp Sun Sep 20 02:46:00 2015 +0200 +++ b/src/share/vm/gc/g1/concurrentG1Refine.hpp Sun Sep 20 03:09:14 2015 +0200 @@ -61,11 +61,11 @@ * 2) green = 0. Means no caching. Can be a good way to minimize the * amount of time spent updating rsets during a collection. */ - int _green_zone; - int _yellow_zone; - int _red_zone; + size_t _green_zone; + size_t _yellow_zone; + size_t _red_zone; - int _thread_threshold_step; + size_t _thread_threshold_step; // We delay the refinement of 'hot' cards using the hot card cache. G1HotCardCache _hot_card_cache; @@ -95,17 +95,17 @@ void print_worker_threads_on(outputStream* st) const; - void set_green_zone(int x) { _green_zone = x; } - void set_yellow_zone(int x) { _yellow_zone = x; } - void set_red_zone(int x) { _red_zone = x; } + void set_green_zone(size_t x) { _green_zone = x; } + void set_yellow_zone(size_t x) { _yellow_zone = x; } + void set_red_zone(size_t x) { _red_zone = x; } - int green_zone() const { return _green_zone; } - int yellow_zone() const { return _yellow_zone; } - int red_zone() const { return _red_zone; } + size_t green_zone() const { return _green_zone; } + size_t yellow_zone() const { return _yellow_zone; } + size_t red_zone() const { return _red_zone; } uint worker_thread_num() const { return _n_worker_threads; } - int thread_threshold_step() const { return _thread_threshold_step; } + size_t thread_threshold_step() const { return _thread_threshold_step; } G1HotCardCache* hot_card_cache() { return &_hot_card_cache; } }; diff -r e9776bfd185a -r 639984e96cc3 src/share/vm/gc/g1/concurrentG1RefineThread.cpp --- a/src/share/vm/gc/g1/concurrentG1RefineThread.cpp Sun Sep 20 02:46:00 2015 +0200 +++ b/src/share/vm/gc/g1/concurrentG1RefineThread.cpp Sun Sep 20 03:09:14 2015 +0200 @@ -154,8 +154,8 @@ if (_worker_id > 0) { if (G1TraceConcRefinement) { DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); - gclog_or_tty->print_cr("G1-Refine-activated worker %d, on threshold %d, current %d", - _worker_id, _threshold, (int)dcqs.completed_buffers_num()); + gclog_or_tty->print_cr("G1-Refine-activated worker %d, on threshold " SIZE_FORMAT ", current " SIZE_FORMAT, + _worker_id, _threshold, dcqs.completed_buffers_num()); } set_active(true); } else { @@ -170,8 +170,8 @@ if (_worker_id > 0) { if (G1TraceConcRefinement) { DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); - gclog_or_tty->print_cr("G1-Refine-deactivated worker %d, off threshold %d, current %d", - _worker_id, _deactivation_threshold, (int)dcqs.completed_buffers_num()); + gclog_or_tty->print_cr("G1-Refine-deactivated worker %d, off threshold " SIZE_FORMAT ", current " SIZE_FORMAT, + _worker_id, _deactivation_threshold, dcqs.completed_buffers_num()); } set_active(false); } else { @@ -199,7 +199,7 @@ SuspendibleThreadSetJoiner sts; do { - int curr_buffer_num = (int)dcqs.completed_buffers_num(); + size_t curr_buffer_num = dcqs.completed_buffers_num(); // If the number of the buffers falls down into the yellow zone, // that means that the transition period after the evacuation pause has ended. if (dcqs.completed_queue_padding() > 0 && curr_buffer_num <= cg1r()->yellow_zone()) { diff -r e9776bfd185a -r 639984e96cc3 src/share/vm/gc/g1/concurrentG1RefineThread.hpp --- a/src/share/vm/gc/g1/concurrentG1RefineThread.hpp Sun Sep 20 02:46:00 2015 +0200 +++ b/src/share/vm/gc/g1/concurrentG1RefineThread.hpp Sun Sep 20 03:09:14 2015 +0200 @@ -77,11 +77,11 @@ // The closure applied to completed log buffers. CardTableEntryClosure* _refine_closure; - int _thread_threshold_step; + size_t _thread_threshold_step; // This thread activation threshold - int _threshold; + size_t _threshold; // This thread deactivation threshold - int _deactivation_threshold; + size_t _deactivation_threshold; void wait_for_completed_buffers(); diff -r e9776bfd185a -r 639984e96cc3 src/share/vm/gc/g1/concurrentMark.cpp --- a/src/share/vm/gc/g1/concurrentMark.cpp Sun Sep 20 02:46:00 2015 +0200 +++ b/src/share/vm/gc/g1/concurrentMark.cpp Sun Sep 20 03:09:14 2015 +0200 @@ -2690,7 +2690,7 @@ SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); guarantee(has_overflown() || satb_mq_set.completed_buffers_num() == 0, - err_msg("Invariant: has_overflown = %s, num buffers = %d", + err_msg("Invariant: has_overflown = %s, num buffers = " SIZE_FORMAT, BOOL_TO_STR(has_overflown()), satb_mq_set.completed_buffers_num())); diff -r e9776bfd185a -r 639984e96cc3 src/share/vm/gc/g1/dirtyCardQueue.cpp --- a/src/share/vm/gc/g1/dirtyCardQueue.cpp Sun Sep 20 02:46:00 2015 +0200 +++ b/src/share/vm/gc/g1/dirtyCardQueue.cpp Sun Sep 20 03:09:14 2015 +0200 @@ -158,12 +158,11 @@ } -BufferNode* -DirtyCardQueueSet::get_completed_buffer(int stop_at) { +BufferNode* DirtyCardQueueSet::get_completed_buffer(size_t stop_at) { BufferNode* nd = NULL; MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag); - if ((int)_n_completed_buffers <= stop_at) { + if (_n_completed_buffers <= stop_at) { _process_completed = false; return NULL; } @@ -173,8 +172,8 @@ _completed_buffers_head = nd->next(); if (_completed_buffers_head == NULL) _completed_buffers_tail = NULL; + assert(_n_completed_buffers > 0, "Invariant"); _n_completed_buffers--; - assert(_n_completed_buffers >= 0, "Invariant"); } debug_only(assert_completed_buffer_list_len_correct_locked()); return nd; @@ -205,7 +204,7 @@ bool DirtyCardQueueSet::apply_closure_to_completed_buffer(CardTableEntryClosure* cl, uint worker_i, - int stop_at, + size_t stop_at, bool during_pause) { assert(!during_pause || stop_at == 0, "Should not leave any completed buffers during a pause"); BufferNode* nd = get_completed_buffer(stop_at); diff -r e9776bfd185a -r 639984e96cc3 src/share/vm/gc/g1/dirtyCardQueue.hpp --- a/src/share/vm/gc/g1/dirtyCardQueue.hpp Sun Sep 20 02:46:00 2015 +0200 +++ b/src/share/vm/gc/g1/dirtyCardQueue.hpp Sun Sep 20 03:09:14 2015 +0200 @@ -129,7 +129,7 @@ // is returned to the completed buffer set, and this call returns false. bool apply_closure_to_completed_buffer(CardTableEntryClosure* cl, uint worker_i = 0, - int stop_at = 0, + size_t stop_at = 0, bool during_pause = false); // Helper routine for the above. @@ -137,7 +137,7 @@ uint worker_i, BufferNode* nd); - BufferNode* get_completed_buffer(int stop_at); + BufferNode* get_completed_buffer(size_t stop_at); // Applies the current closure to all completed buffers, // non-consumptively. diff -r e9776bfd185a -r 639984e96cc3 src/share/vm/gc/g1/g1CollectorPolicy.cpp --- a/src/share/vm/gc/g1/g1CollectorPolicy.cpp Sun Sep 20 02:46:00 2015 +0200 +++ b/src/share/vm/gc/g1/g1CollectorPolicy.cpp Sun Sep 20 03:09:14 2015 +0200 @@ -1257,12 +1257,12 @@ const int k_gy = 3, k_gr = 6; const double inc_k = 1.1, dec_k = 0.9; - int g = cg1r->green_zone(); + size_t g = cg1r->green_zone(); if (update_rs_time > goal_ms) { - g = (int)(g * dec_k); // Can become 0, that's OK. That would mean a mutator-only processing. + g = (size_t)(g * dec_k); // Can become 0, that's OK. That would mean a mutator-only processing. } else { if (update_rs_time < goal_ms && update_rs_processed_buffers > g) { - g = (int)MAX2(g * inc_k, g + 1.0); + g = (size_t)MAX2(g * inc_k, g + 1.0); } } // Change the refinement threads params @@ -1271,15 +1271,15 @@ cg1r->set_red_zone(g * k_gr); cg1r->reinitialize_threads(); - int processing_threshold_delta = MAX2((int)(cg1r->green_zone() * sigma()), 1); - int processing_threshold = MIN2(cg1r->green_zone() + processing_threshold_delta, - cg1r->yellow_zone()); + size_t processing_threshold_delta = MAX2((size_t)(cg1r->green_zone() * sigma()), (size_t)1); + size_t processing_threshold = MIN2(cg1r->green_zone() + processing_threshold_delta, + cg1r->yellow_zone()); // Change the barrier params dcqs.set_process_completed_threshold(processing_threshold); dcqs.set_max_completed_queue(cg1r->red_zone()); } - int curr_queue_size = dcqs.completed_buffers_num(); + size_t curr_queue_size = dcqs.completed_buffers_num(); if (curr_queue_size >= cg1r->yellow_zone()) { dcqs.set_completed_queue_padding(curr_queue_size); } else { diff -r e9776bfd185a -r 639984e96cc3 src/share/vm/gc/g1/ptrQueue.cpp --- a/src/share/vm/gc/g1/ptrQueue.cpp Sun Sep 20 02:46:00 2015 +0200 +++ b/src/share/vm/gc/g1/ptrQueue.cpp Sun Sep 20 03:09:14 2015 +0200 @@ -225,17 +225,18 @@ } _n_completed_buffers++; - if (!_process_completed && _process_completed_threshold >= 0 && + if (!_process_completed && _n_completed_buffers >= _process_completed_threshold) { _process_completed = true; - if (_notify_when_complete) + if (_notify_when_complete) { _cbl_mon->notify(); + } } debug_only(assert_completed_buffer_list_len_correct_locked()); } -int PtrQueueSet::completed_buffers_list_length() { - int n = 0; +size_t PtrQueueSet::completed_buffers_list_length() { + size_t n = 0; BufferNode* cbn = _completed_buffers_head; while (cbn != NULL) { n++; diff -r e9776bfd185a -r 639984e96cc3 src/share/vm/gc/g1/ptrQueue.hpp --- a/src/share/vm/gc/g1/ptrQueue.hpp Sun Sep 20 02:46:00 2015 +0200 +++ b/src/share/vm/gc/g1/ptrQueue.hpp Sun Sep 20 03:09:14 2015 +0200 @@ -207,8 +207,8 @@ Monitor* _cbl_mon; // Protects the fields below. BufferNode* _completed_buffers_head; BufferNode* _completed_buffers_tail; - int _n_completed_buffers; - int _process_completed_threshold; + size_t _n_completed_buffers; + size_t _process_completed_threshold; volatile bool _process_completed; // This (and the interpretation of the first element as a "next" @@ -230,10 +230,10 @@ // Maximum number of elements allowed on completed queue: after that, // enqueuer does the work itself. Zero indicates no maximum. - int _max_completed_queue; - int _completed_queue_padding; + size_t _max_completed_queue; + size_t _completed_queue_padding; - int completed_buffers_list_length(); + size_t completed_buffers_list_length(); void assert_completed_buffer_list_len_correct_locked(); void assert_completed_buffer_list_len_correct(); @@ -250,8 +250,8 @@ // Because of init-order concerns, we can't pass these as constructor // arguments. void initialize(Monitor* cbl_mon, Mutex* fl_lock, - int process_completed_threshold, - int max_completed_queue, + size_t process_completed_threshold, + size_t max_completed_queue, PtrQueueSet *fl_owner = NULL) { _max_completed_queue = max_completed_queue; _process_completed_threshold = process_completed_threshold; @@ -292,22 +292,22 @@ size_t buffer_size() { return _sz; } // Get/Set the number of completed buffers that triggers log processing. - void set_process_completed_threshold(int sz) { _process_completed_threshold = sz; } - int process_completed_threshold() const { return _process_completed_threshold; } + void set_process_completed_threshold(size_t sz) { _process_completed_threshold = sz; } + size_t process_completed_threshold() const { return _process_completed_threshold; } // Must only be called at a safe point. Indicates that the buffer free // list size may be reduced, if that is deemed desirable. void reduce_free_list(); - int completed_buffers_num() { return _n_completed_buffers; } + size_t completed_buffers_num() { return _n_completed_buffers; } void merge_bufferlists(PtrQueueSet* src); - void set_max_completed_queue(int m) { _max_completed_queue = m; } - int max_completed_queue() { return _max_completed_queue; } + void set_max_completed_queue(size_t m) { _max_completed_queue = m; } + size_t max_completed_queue() { return _max_completed_queue; } - void set_completed_queue_padding(int padding) { _completed_queue_padding = padding; } - int completed_queue_padding() { return _completed_queue_padding; } + void set_completed_queue_padding(size_t padding) { _completed_queue_padding = padding; } + size_t completed_queue_padding() { return _completed_queue_padding; } // Notify the consumer if the number of buffers crossed the threshold void notify_if_necessary();