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

Simplify relocation of native pointers in archive heap

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • hotspot
    • b20

      Some objects in the archive heap contain native pointers. E.g., archived java.lang.Class objects contains a pointer to its Klass* metadata.

      At runtime, if the archived metadata are mapped at an alternative address, all of the Klass* pointers must be relocated, Currently this is done in an ad-hoc way

      https://github.com/openjdk/jdk/blob/3ac91b08cbe16bc1a347178f853513f930ffeaf3/src/hotspot/share/classfile/javaClasses.cpp#L1275-L1285

      void java_lang_Class::update_archived_primitive_mirror_native_pointers(oop archived_mirror) {
        if (MetaspaceShared::relocation_delta() != 0) {

          Klass* ak = ((Klass*)archived_mirror->metadata_field(_array_klass_offset));
          if (ak != NULL) {
            archived_mirror->metadata_field_put(_array_klass_offset,
                (Klass*)(address(ak) + MetaspaceShared::relocation_delta()));
          }

      Proposal:

      Mark all native pointers using a bitmap so they can be relocated at runtime. This also makes it easy to support new types of archived objects that have native pointers. E.g., java.lang.invoke.ResolvedMethodName, which has a pointer to the Method*.





            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: