Harmony
  1. Harmony
  2. HARMONY-5725

[drlvm][jit][opt][performance] Implement org.apache.harmony.misc.accessors.ObjectAccessor on magics

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DRLVM
    • Labels:
      None
    • Estimated Complexity:
      Advanced

      Description

      Classlib has the API for quick accessing to fields. Since serialization performance will depend on such the accessors, the idea is to implement such the accessors on magics. Slowpath is already in classlib, uses JNI to access fields, so implementation on magics will eliminate JNI transition overhead and native-side computations.

      1. vm-accessors-magic-draft.patch
        3 kB
        Aleksey Shipilev
      2. vm-accessors-magic-draft-2.patch
        55 kB
        Aleksey Shipilev

        Issue Links

          Activity

          Hide
          Aleksey Shipilev added a comment -

          vm-accessors-magic-draft.patch

          Draft in HLOAPIMagics. Need to know how to translate jFieldID (jlong) to Field_Handle and FieldDesc.

          Show
          Aleksey Shipilev added a comment - vm-accessors-magic-draft.patch Draft in HLOAPIMagics. Need to know how to translate jFieldID (jlong) to Field_Handle and FieldDesc.
          Hide
          Alexey Varlamov added a comment -

          jFieldID and Field_Handle are 1:1 correspodence, and you can get FieldDesc via CompilationInterface::getFieldDesc().

          Show
          Alexey Varlamov added a comment - jFieldID and Field_Handle are 1:1 correspodence, and you can get FieldDesc via CompilationInterface::getFieldDesc().
          Hide
          Alexey Varlamov added a comment -

          In fact, the above question/answer are irrelevant, FieldDesc is a compile-time concept.
          This task should be done via vmmagics, rather than API-magics.

          Show
          Alexey Varlamov added a comment - In fact, the above question/answer are irrelevant, FieldDesc is a compile-time concept. This task should be done via vmmagics, rather than API-magics.
          Hide
          Aleksey Shipilev added a comment -

          vm-accessors-magic-draft-2.patch
          Draft implementation on LIR API magics.

          The idea there is:
          1. Take the jFieldID from argument
          2. Since jFieldID is Field_Handle we can compute the offset of "_offset" there
          3. Knowing the field _offset in object, we can access the object field

          e.g.

          fieldOffsetInObj <- [jFieldID + "_offset displacement"]
          fieldValue <- [obj + fieldOffsetInObj]

          Show
          Aleksey Shipilev added a comment - vm-accessors-magic-draft-2.patch Draft implementation on LIR API magics. The idea there is: 1. Take the jFieldID from argument 2. Since jFieldID is Field_Handle we can compute the offset of "_offset" there 3. Knowing the field _offset in object, we can access the object field e.g. fieldOffsetInObj <- [jFieldID + "_offset displacement"] fieldValue <- [obj + fieldOffsetInObj]
          Hide
          Alexey Varlamov added a comment -

          Relying on particular organization of VM data types is flawed design IMO, that is why I suggested use vmmagics instead.
          That is, JIT should not care about such optimizations, rather VM should provide magic method substitutes - the same as for other kernel methods like identityHashCode.

          Show
          Alexey Varlamov added a comment - Relying on particular organization of VM data types is flawed design IMO, that is why I suggested use vmmagics instead. That is, JIT should not care about such optimizations, rather VM should provide magic method substitutes - the same as for other kernel methods like identityHashCode.

            People

            • Assignee:
              Mikhail Fursov
              Reporter:
              Aleksey Shipilev
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Development