Implement AOTCacheAccess::get_archived_object using heap roots

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: repo-leyden
    • Component/s: hotspot

      The following API is used by the AOT compiler to access heap objects in the AOT cache.

         oop AOTCacheAccess::get_archived_object(int)

      Because the objects can move in the production run, there's currently a complicated way to keep them alive using OopHandles.

      https://github.com/openjdk/leyden/blob/6ce1832147ef3f01602b8fac02160038422a77bf/src/hotspot/share/cds/heapShared.cpp#L545-L610

      However, we already have a mechanism that mapes an integer to an oop

          oop HeapShared::get_root(int index, ...)

      So we just need to make sure that all objects needed by the AOT compiler are all stored as heap roots.

      Proposals:

      [1] (Done in this PR) In the short run (during initial AOT compiler integration into the mainline), the AOT compiler only needs the following objects

      - a few common exception objects
      - class loaders
      - class mirrors
      - interned strings
      - method handles

      Most of these objects are in the roots already. We just need to add interned strings and method handles into the heap roots.

      [2] In the future, we should move the AOT compilation before we dump the heap. This way we know exactly what oops should be stored into the heap roots.

            Assignee:
            Ioi Lam
            Reporter:
            Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: