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

duplicate osr adapter codeBlobs may not be freed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.3.1
    • 1.3.1
    • hotspot
    • None
    • beta
    • generic
    • solaris_8

        There's an incorrect re-declaration of the variable "check" in the
        following that causes a "free" of the osr codeBlob to never be done
        in the case where this thread loses a race to create the osr codeBlob
        for a particular signature length.


        // The generator method is implemented in runtime_<cpu>.cpp
        OSRAdapter* OnStackReplacement::get_osr_adapter(int framesize) {
          assert(UseOnStackReplacement, "on-stack replacement not used");

          OSRAdapter* osr = NULL;
          { MutexLocker mu(AdapterCache_lock);
            // This will potentially grow the array.
            osr = _osr_adapters->at_grow(framesize);
          }

          // Need to create OSR adapter and update list.
          if (osr == NULL) {
            osr = OptoRuntime::generate_osr_blob(framesize);
            if (osr == NULL) {
               //CodeCache is probably full
               return NULL;
            }

            OSRAdapter* check = NULL; <---------- correct declaration of check
            { MutexLocker mu(AdapterCache_lock);
              // Grap lock and update cache. Check if someone else already updated the
        list
              OSRAdapter* check = _osr_adapters->at(framesize); <-------- bad re-decl.
              if (check == NULL) {
                _osr_adapters->at_put(framesize, osr);
              }
            }

            // The adapter already existed
            if (check != NULL) { <-------- test is always false because of bad re-decl.
              MutexLocker mu(CodeCache_lock);
              CodeCache::free(osr);
              osr = check;
            }
          }
          return osr;
        }

              rknippelsunw Ross Knippel (Inactive)
              rknippelsunw Ross Knippel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: