Skip to content

Replace scanMonitorLookupCaches() loop with memset #24803

Open

Description

@rmnattas

scanMonitorLookupCaches() iterates over each slot in J9VMThread->objectMonitorLookupCache and calls the virtual method doMonitorLookupCacheSlot() to zero it during a GC root scan. This uses the pattern of looping over the cache slots and dispatching a virtual method to perform the intended GC specific operation.

This pattern is not utilized for this use-case, and the cache slots are only zeroed for all GCs. Hence the loop and if-condition are unnecessary and can be replaced with some memset.

scanMonitorLookupCaches():
...
    for (; cacheIndex < J9VMTHREAD_OBJECT_MONITOR_CACHE_SIZE; cacheIndex++) {
    	doMonitorLookupCacheSlot(&objectMonitorLookupCache[cacheIndex]);     
    }
...
 
doMonitorLookupCacheSlot():
    if (0 != *slotPtr) {
        *slotPtr = 0;   // just zero it out
    }

fyi: @amicic

Activity

  1. added this to the Deep Backlog milestone on Sep 29, 2026
  2. Satineee commented on Oct 9, 2026

    @Satineee

    Hi, I'd like to work on this.

  3. added a commit that references this issue on Oct 9, 2026
    415d2c6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions