--- a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp Tue Jan 12 21:01:22 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp Tue Jan 12 22:50:57 2016 +0000
@@ -190,47 +190,19 @@
bool DirtyCardQueueSet::mut_process_buffer(void** buf) {
guarantee(_free_ids != NULL, "must be");
- // Used to determine if we had already claimed a par_id
- // before entering this method.
- bool already_claimed = false;
- // We grab the current JavaThread.
- JavaThread* thread = JavaThread::current();
-
- // We get the the number of any par_id that this thread
- // might have already claimed.
- uint worker_i = thread->get_claimed_par_id();
+ // claim a par id
+ uint worker_i = _free_ids->claim_par_id();
- // If worker_i is not UINT_MAX then the thread has already claimed
- // a par_id. We make note of it using the already_claimed value
- if (worker_i != UINT_MAX) {
- already_claimed = true;
- } else {
-
- // Otherwise we need to claim a par id
- worker_i = _free_ids->claim_par_id();
-
- // And store the par_id value in the thread
- thread->set_claimed_par_id(worker_i);
+ bool b = DirtyCardQueue::apply_closure_to_buffer(_mut_process_closure, buf, 0,
+ _sz, true, worker_i);
+ if (b) {
+ Atomic::inc(&_processed_buffers_mut);
}
- bool b = false;
- if (worker_i != UINT_MAX) {
- b = DirtyCardQueue::apply_closure_to_buffer(_mut_process_closure, buf, 0,
- _sz, true, worker_i);
- if (b) Atomic::inc(&_processed_buffers_mut);
+ // release the id
+ _free_ids->release_par_id(worker_i);
- // If we had not claimed an id before entering the method
- // then we must release the id.
- if (!already_claimed) {
-
- // we release the id
- _free_ids->release_par_id(worker_i);
-
- // and set the claimed_id in the thread to UINT_MAX
- thread->set_claimed_par_id(UINT_MAX);
- }
- }
return b;
}
--- a/hotspot/src/share/vm/runtime/thread.cpp Tue Jan 12 21:01:22 2016 +0000
+++ b/hotspot/src/share/vm/runtime/thread.cpp Tue Jan 12 22:50:57 2016 +0000
@@ -1419,9 +1419,6 @@
void JavaThread::initialize() {
// Initialize fields
- // Set the claimed par_id to UINT_MAX (ie not claiming any par_ids)
- set_claimed_par_id(UINT_MAX);
-
set_saved_exception_pc(NULL);
set_threadObj(NULL);
_anchor.clear();
--- a/hotspot/src/share/vm/runtime/thread.hpp Tue Jan 12 21:01:22 2016 +0000
+++ b/hotspot/src/share/vm/runtime/thread.hpp Tue Jan 12 22:50:57 2016 +0000
@@ -1964,14 +1964,6 @@
bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; }
bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; }
inline void set_done_attaching_via_jni();
- private:
- // This field is used to determine if a thread has claimed
- // a par_id: it is UINT_MAX if the thread has not claimed a par_id;
- // otherwise its value is the par_id that has been claimed.
- uint _claimed_par_id;
- public:
- uint get_claimed_par_id() { return _claimed_par_id; }
- void set_claimed_par_id(uint id) { _claimed_par_id = id; }
};
// Inline implementation of JavaThread::current