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

Consolidate MethodHandles::zero into MethodHandles::constant

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • 25
    • core-libs

      Currently, there are two basic method handles - zero and identity. A frequently-used method handle, `MethodHandles::constant`, is derived from a BMH binding a value to identity, which need to go through LambdaFormEditor to spin LF classes, and LFE classes are currently not cached. This is one of the contributor for overheads in Perfstartup-LambdaNoop.

      I propose to change `constant` to be a basic handle, with the lambda form of returning the BMH value; the zero handle can be seen as `constant` bound to zero, or identity for void. This means that we can reuse a pregenerated LF instead of goign through an editor. This can also simplify our implementation by removing the primitive zero handle/form.

            liach Chen Liang
            liach Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: