Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-4705

[drlvm][jni] JNI transition uses ineffective TLS get

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.0M6
    • DRLVM
    • None
    • Patch Available

    Description

      For now, JNI transition uses ineffective scheme of TLS getting - it is done via several recursive calls, finally reaching hythread_self().

      The idea is to inline helper for TLS get instead of calling get_thread_ptr_stub(). Disassembly shows that 10 push/pops and 3 calls are completely eliminated there, keeping in mind that TLS get occurs at least 3 times on each JNI transition this give us a huge boost, eliminating up to 30 push/pops and 9 calls.

      JNI microtest (calling several millions of empty JNI methods) testifies this:

      $ ../../Builds/Harmony-clean/bin/java -cp . -Xmx128m -Xms128m nalog.nalog
      iteration: 0 millis:8763
      iteration: 1 millis:8722
      iteration: 2 millis:8833

      $ ../../Builds/Harmony-fastTLS-1/bin/java -cp . -Xmx128m -Xms128m nalog.nalog
      iteration: 0 millis:6780
      iteration: 1 millis:6689
      iteration: 2 millis:6870

      Attachments

        1. JNI-tls-1.patch
          1 kB
          Aleksey Shipilev
        2. JNI-tls-2.patch
          1 kB
          Aleksey Shipilev
        3. JNI-tls-3.patch
          0.8 kB
          Aleksey Shipilev
        4. JNI-tls-4.patch
          0.8 kB
          Aleksey Shipilev

        Issue Links

          Activity

            People

              gshimansky Gregory Shimansky
              aleksey.shipilev Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: