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

unnecessary reference referent check

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • None
    • gc
    • generic
    • generic

      ReferenceProcessor::discover_reference tests the referent, rejecting deferred processing of the referent if it is already known to be stongly referenced. However, all calls to discover_reference are protected by their callers with a similar test of the reference's referent.

      The callers can make use of collector-specific specialized liveness tests that might even be inlineable, whereas discover_reference has to use a more generic or indirect out of line approach.

      All in all, this makes the referent test within discover_reference an expensive nop.

      It would be better to remove that test from discover_reference and instead document discover_reference as benefitting from such a guard. Note that it isn't strictly a pre-condition, since nothing will actually fail if such a guard is not used. It would just result in a reference with a live referent being unnecessarily added to the discovery list and then later removed during the post-discovery phase.

            Unassigned Unassigned
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: