Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8369469

Rdtsc: Remove potential races in Rdtsc::initialize

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • hotspot
    • None

      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.

            aboldtch Axel Boldt-Christmas
            aboldtch Axel Boldt-Christmas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: