This commit is contained in:
Jon Masamitsu 2016-01-12 22:50:57 +00:00
commit 93fe673dad
3 changed files with 8 additions and 47 deletions

View File

@ -190,47 +190,19 @@ void DirtyCardQueueSet::handle_zero_index_for_thread(JavaThread* t) {
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();
// claim a par id
uint worker_i = _free_ids->claim_par_id();
// We get the the number of any par_id that this thread
// might have already claimed.
uint worker_i = thread->get_claimed_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;
}

View File

@ -1419,9 +1419,6 @@ void JavaThread::collect_counters(typeArrayOop array) {
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();

View File

@ -1964,14 +1964,6 @@ class JavaThread: public Thread {
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