Skip to content

Loom Pinning: Manage J9VMThread->ownedMonitorCount - #15487

Merged
gacholio merged 1 commit into
eclipse-openj9:masterfrom
babsingh:loom_pin_support_v1
Jul 15, 2022
Merged

Loom Pinning: Manage J9VMThread->ownedMonitorCount#15487
gacholio merged 1 commit into
eclipse-openj9:masterfrom
babsingh:loom_pin_support_v1

Conversation

@babsingh

@babsingh babsingh commented Jul 5, 2022

Copy link
Copy Markdown
Contributor

In order to support if a Continuation is pinned, ownedMonitorCount is

  • incremented when a monitor is successfully acquired; and
  • decremented when a monitor is successfully released.

ownedMonitorCount is updated closer to the lockword modification.

monitor entry points:

  1. ObjectMonitor.hpp::inlineFastObjectMonitorEnter
    • inlineFastInitAndEnterMonitor: increment counter
  2. ObjectMonitor.hpp::objectMonitorEnterNonBlocking
    • flat / lock reservation case: increment counter
    • spinOnFlatLock
      • inlineFastInitAndEnterMonitor: increment counter
    • spinOnTryEnter
      • inflated case: increment counter
  3. ObjectMonitor.hpp::objectMonitorEnterBlocking:
    • inflated case: increment counter
    • inlineFastInitAndEnterMonitor: increment counter

monitor exit points:

  1. ObjectMonitor.hpp::inlineFastObjectMonitorExit: decrement counter
  2. monhelpers.c::objectMonitorExit: decrement counter

ownedMonitorCount will be reset when a Continuation is mounted and
unmounted.

Related: #15174

Signed-off-by: Babneet Singh sbabneet@ca.ibm.com

@babsingh
babsingh force-pushed the loom_pin_support_v1 branch 3 times, most recently from e3eb868 to b56500e Compare July 5, 2022 16:59
@babsingh
babsingh marked this pull request as ready for review July 5, 2022 22:41
@babsingh
babsingh requested a review from gacholio July 6, 2022 15:19
Comment thread runtime/oti/ObjectMonitor.hpp Outdated
@babsingh

babsingh commented Jul 7, 2022

Copy link
Copy Markdown
Contributor Author

@gacholio The counter updates have been moved closer to modification of the lockword. Below is a summary of all places where the counter is incremented and decremented.

Note: New changes have been added as a separate commit. Once the changes are final, the commits will be squashed.

monitor entry points:

  1. inlineFastObjectMonitorEnter
    • inlineFastInitAndEnterMonitor: increment counter
  2. objectMonitorEnterNonBlocking
    • flat / lock reservation case: increment counter
    • spinOnFlatLock
      • inlineFastInitAndEnterMonitor: increment counter
    • spinOnTryEnter
      • inflated case: increment counter
  3. objectMonitorEnterBlocking:
    • inflated case: increment counter
    • inlineFastInitAndEnterMonitor: increment counter

monitor exit points:

  1. inlineFastObjectMonitorExit: decrement counter
  2. objectMonitorExit: decrement counter

Comment thread runtime/vm/monhelpers.c Outdated
@gacholio

Copy link
Copy Markdown
Contributor

jenkins compile win jdk8

@gacholio

Copy link
Copy Markdown
Contributor

jenkins test sanity xlinux jdknext

In order to support if a Continuation is pinned, ownedMonitorCount is
- incremented when a monitor is successfully acquired; and
- decremented when a monitor is successfully released.

ownedMonitorCount is updated closer to the lockword modification.

monitor entry points:

1. ObjectMonitor.hpp::inlineFastObjectMonitorEnter
   - inlineFastInitAndEnterMonitor: increment counter
2. ObjectMonitor.hpp::objectMonitorEnterNonBlocking
   - flat / lock reservation case: increment counter
   - spinOnFlatLock
     - inlineFastInitAndEnterMonitor: increment counter
   - spinOnTryEnter
     - inflated case: increment counter
3. ObjectMonitor.hpp::objectMonitorEnterBlocking:
   - inflated case: increment counter
   - inlineFastInitAndEnterMonitor: increment counter

monitor exit points:

1. ObjectMonitor.hpp::inlineFastObjectMonitorExit: decrement counter
2. monhelpers.c::objectMonitorExit: decrement counter

ownedMonitorCount will be reset when a Continuation is mounted and
unmounted.

Related: eclipse-openj9#15174

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
@babsingh
babsingh force-pushed the loom_pin_support_v1 branch from 31a91c6 to 4f2e184 Compare July 15, 2022 00:29
@babsingh

Copy link
Copy Markdown
Contributor Author

@gacholio
gacholio merged commit 96dca6c into eclipse-openj9:master Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants