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

(reflect) Method.invoke() has a needless critical section, causing large slowdowns

XMLWordPrintable

    • b138
    • generic
    • generic
    • Not verified

      java.lang.reflect.Method.invoke has a critical section which it doesn't really need, and which slows it down.

      While investigating 6565458 (a code generation problem) I noticed that the fix to 6446522 added synchronizations to the hot path of reflective invokes. This successfully removed the race condition reported for 6446522, but made the generated code very complex.

      I saw a simple way to speed up Method.invoke significantly by removing the critical section. The 6565458 test case gets a 3X speedup, since that micro-benchmark is simple enough to inline everything. As we improve our inlining heuristics, more use cases will see benefits from removing the critical section.

      The critical section is also potentially a bottleneck in large concurrent systems.

            mduigou Mike Duigou
            jrose John Rose
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: