The whole chain of Rdtsc uses static block scope variables which are guaranteed to be constructed only once (implements some sort of double checked locking).
However the current implementation does not do this correctly in all places, where it does:
```
static bool initialized = false;
if (!initialized) {
...
initialized = true;
}
```
It should do
```
static bool initialized = initialize_impl(); // Do the logic inside a function call
```
to guarantee that initialize is only called once.
We have observed this from some GC threads if we start using Ticks to early.
However the current implementation does not do this correctly in all places, where it does:
```
static bool initialized = false;
if (!initialized) {
...
initialized = true;
}
```
It should do
```
static bool initialized = initialize_impl(); // Do the logic inside a function call
```
to guarantee that initialize is only called once.
We have observed this from some GC threads if we start using Ticks to early.
- links to
-
Review(pr/27711) openjdk/jdk/27712