mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-25 07:09:55 +00:00
8222034: Thread-SMR functions should be updated to remove work around
Reviewed-by: mdoerr, eosterlund
This commit is contained in:
parent
11c8caf157
commit
a8e94de188
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -590,12 +590,9 @@ ThreadsList *ThreadsList::add_thread(ThreadsList *list, JavaThread *java_thread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThreadsList::dec_nested_handle_cnt() {
|
void ThreadsList::dec_nested_handle_cnt() {
|
||||||
// The decrement needs to be MO_ACQ_REL. At the moment, the Atomic::dec
|
// The decrement only needs to be MO_ACQ_REL since the reference
|
||||||
// backend on PPC does not yet conform to these requirements. Therefore
|
// counter is volatile (and the hazard ptr is already NULL).
|
||||||
// the decrement is simulated with an Atomic::sub(1, &addr).
|
Atomic::dec(&_nested_handle_cnt);
|
||||||
// Without this MO_ACQ_REL Atomic::dec simulation, the nested SMR mechanism
|
|
||||||
// is not generally safe to use.
|
|
||||||
Atomic::sub(1, &_nested_handle_cnt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ThreadsList::find_index_of_JavaThread(JavaThread *target) {
|
int ThreadsList::find_index_of_JavaThread(JavaThread *target) {
|
||||||
@ -626,19 +623,9 @@ JavaThread* ThreadsList::find_JavaThread_from_java_tid(jlong java_tid) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThreadsList::inc_nested_handle_cnt() {
|
void ThreadsList::inc_nested_handle_cnt() {
|
||||||
// The increment needs to be MO_SEQ_CST. At the moment, the Atomic::inc
|
// The increment needs to be MO_SEQ_CST so that the reference counter
|
||||||
// backend on PPC does not yet conform to these requirements. Therefore
|
// update is seen before the subsequent hazard ptr update.
|
||||||
// the increment is simulated with a load phi; cas phi + 1; loop.
|
Atomic::inc(&_nested_handle_cnt);
|
||||||
// Without this MO_SEQ_CST Atomic::inc simulation, the nested SMR mechanism
|
|
||||||
// is not generally safe to use.
|
|
||||||
intx sample = OrderAccess::load_acquire(&_nested_handle_cnt);
|
|
||||||
for (;;) {
|
|
||||||
if (Atomic::cmpxchg(sample + 1, &_nested_handle_cnt, sample) == sample) {
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
sample = OrderAccess::load_acquire(&_nested_handle_cnt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThreadsList::includes(const JavaThread * const p) const {
|
bool ThreadsList::includes(const JavaThread * const p) const {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user