mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8050972: Concurrency problem in PcDesc cache
The entries of the PcDesc cache in nmethods are not declared as volatile, but they are accessed and modified by several threads concurrently. Reviewed-by: kvn, dholmes, dcubed
This commit is contained in:
parent
33058abb3f
commit
1439e307db
1 changed files with 6 additions and 1 deletions
|
@ -69,7 +69,12 @@ class PcDescCache VALUE_OBJ_CLASS_SPEC {
|
||||||
friend class VMStructs;
|
friend class VMStructs;
|
||||||
private:
|
private:
|
||||||
enum { cache_size = 4 };
|
enum { cache_size = 4 };
|
||||||
PcDesc* _pc_descs[cache_size]; // last cache_size pc_descs found
|
// The array elements MUST be volatile! Several threads may modify
|
||||||
|
// and read from the cache concurrently. find_pc_desc_internal has
|
||||||
|
// returned wrong results. C++ compiler (namely xlC12) may duplicate
|
||||||
|
// C++ field accesses if the elements are not volatile.
|
||||||
|
typedef PcDesc* PcDescPtr;
|
||||||
|
volatile PcDescPtr _pc_descs[cache_size]; // last cache_size pc_descs found
|
||||||
public:
|
public:
|
||||||
PcDescCache() { debug_only(_pc_descs[0] = NULL); }
|
PcDescCache() { debug_only(_pc_descs[0] = NULL); }
|
||||||
void reset_to(PcDesc* initial_pc_desc);
|
void reset_to(PcDesc* initial_pc_desc);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue