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

NPG: Using raw Method* is unsafe when the method_holder has been redefined

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P3 P3
    • 11
    • hs25
    • hotspot

      Before NPG the GC would find all used methodOopDescs by tracing through the heap. With NPG Methods are not java Objects anymore, and the GC don't find them by normal tracing of the heap.

      The users of Method* needs to do two thing:
      1) Make sure that the Klass is kept alive by exposing either the mirror or the class loader to the GC.
      2) Make sure that the the JVM still knows that the Method is being used.

      If (1) is missed, we might unload the Klass prematurely.
      If (2) is missed, the method can be deallocated if it has been redefined.

      We currently have two options to handle (2).
      a) Make sure that Method::set_on_stack(true) is called during MetadataOnStackMark()
      b) Use a methodHandle instead of a Method*.

      We need to make sure that uses of Method* adhere to these requirements. Preferably, by some code constructs rather then by convention.

            coleenp Coleen Phillimore
            stefank Stefan Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: