Skip to content

Add !walkj9hashtable DDR interactive command#23526

Merged
keithc-ca merged 1 commit intoeclipse-openj9:masterfrom
tomal-majumder:ddr-walkj9hashtable-support
Apr 14, 2026
Merged

Add !walkj9hashtable DDR interactive command#23526
keithc-ca merged 1 commit intoeclipse-openj9:masterfrom
tomal-majumder:ddr-walkj9hashtable-support

Conversation

@tomal-majumder
Copy link
Copy Markdown

@tomal-majumder tomal-majumder commented Mar 17, 2026

Add !walkj9hashtable DDR command

Adds a new DDR extension command that walks all entries of a
J9HashTable and prints each entry as a runnable DDR command.

The command accepts a single hex address and an optional type
argument:

!walkj9hashtable <address> [type]

Issue: #23452

@tomal-majumder tomal-majumder force-pushed the ddr-walkj9hashtable-support branch 2 times, most recently from 9f76b38 to 5eedba1 Compare March 17, 2026 17:31
@tajila
Copy link
Copy Markdown
Contributor

tajila commented Mar 19, 2026

Look at https://github.com/eclipse-openj9/openj9/blob/master/CONTRIBUTING.md for how to format commit messages. The PR description should match the commit message. You can add comments to the PR for other things like questions, concerns, etc.

@tajila
Copy link
Copy Markdown
Contributor

tajila commented Mar 19, 2026

One thing to make this more usable is to add an optional type parameter.

!walkj9hashtable <address> [<type>]

I assume you are just printing out something like:

!j9x 0x1
!j9x 0x2
!j9x 0x3
...

But it would be better if the type was included, for example:

!j9class 0x1
!j9class 0x2
!j9class 0x3
...

@tajila
Copy link
Copy Markdown
Contributor

tajila commented Mar 19, 2026

Another thing is to test that the data outputted is actually correct. So writing a test that dumps the classes in a classloader (classLoader->classHashTable) for example is a good test since we can verify if the classes are valid.

@tajila
Copy link
Copy Markdown
Contributor

tajila commented Mar 19, 2026

!walkj9hashtable <address> [<type>]

!walkj9hashtable 0x1 j9class* //j9class pointers are stored

or

!walkj9hashtable 0x1 j9class //j9class structs inline are stored

@tomal-majumder tomal-majumder force-pushed the ddr-walkj9hashtable-support branch from 5eedba1 to 36148cf Compare March 26, 2026 19:47
@tomal-majumder
Copy link
Copy Markdown
Author

tomal-majumder commented Mar 26, 2026

Addressed the following in the latest commit:

  1. Optional [<type>] parameter — the command now supports:

!walkj9hashtable <address> [<type>]

When <type> ends with * the slot is treated as a pointer to the entry (inline=false); otherwise the entry is stored inline.

Sample output - 1: Inline structs (e.g. classHashTable stores KeyHashTableClassEntry inline):

> !walkj9hashtable 0x000000001a2b3c00 KeyHashTableClassEntry

J9HashTable at 0x1a2b3c00
{
    !keyhashtableclassentry 0x00007f3a10042d80
    !keyhashtableclassentry 0x00007f3a10043100
    !keyhashtableclassentry 0x00007f3a10043480
    ...
}

Sample output - 2: Pointer entries (e.g. moduleHashTable stores J9Module* pointers):

 > !walkj9hashtable 0x000000001a2b4400 J9Module*

J9HashTable at 0x1a2b4400
{
    !j9module 0x00007f3a10051200
    !j9module 0x00007f3a10051600
    !j9module 0x00007f3a10051a00
    ...
}

Sample output - 3: No type argument specified:

 > !walkj9hashtable 0x000000001a2b4400

J9HashTable at 0x1a2b4400
{
    !j9x 0x00007f3a10051200
    !j9x 0x00007f3a10051600
    !j9x 0x00007f3a10051a00
    ...
}
  1. Test coveragetestWalkJ9HashTable
    walks classHashTable and ModuleHashTable from the classLoaders; finding the expected classes and modules confirms the command is correctly iterating and reporting all entries.

@tomal-majumder tomal-majumder force-pushed the ddr-walkj9hashtable-support branch 2 times, most recently from ec75eef to 6b040fd Compare March 31, 2026 16:47
Copy link
Copy Markdown
Contributor

@keithc-ca keithc-ca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I just noticed that my comments were still pending.

Comment thread test/functional/DDR_Test/src/j9vm/test/ddrext/junit/TestDDRExtensionGeneral.java Outdated
@tomal-majumder tomal-majumder force-pushed the ddr-walkj9hashtable-support branch 3 times, most recently from e6e789f to b1f5693 Compare April 2, 2026 00:43
@tomal-majumder tomal-majumder changed the title WIP: Add !walkj9hashtable DDR interactive command Add !walkj9hashtable DDR interactive command Apr 2, 2026
@tomal-majumder tomal-majumder marked this pull request as ready for review April 2, 2026 01:00
@tomal-majumder
Copy link
Copy Markdown
Author

@tajila
Copy link
Copy Markdown
Contributor

tajila commented Apr 2, 2026

@keithc-ca do you have any further comments

@tomal-majumder tomal-majumder force-pushed the ddr-walkj9hashtable-support branch from b1f5693 to 625d7f6 Compare April 7, 2026 20:19
@tomal-majumder tomal-majumder requested a review from keithc-ca April 7, 2026 20:42
Copy link
Copy Markdown
Contributor

@keithc-ca keithc-ca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the necessary fixes to HashTable_V1 to properly handle non-inline entries.

Comment thread test/functional/DDR_Test/src/j9vm/test/ddrext/junit/TestDDRExtensionGeneral.java Outdated
@tomal-majumder

This comment was marked as outdated.

@tomal-majumder tomal-majumder force-pushed the ddr-walkj9hashtable-support branch from 625d7f6 to 51b00a0 Compare April 7, 2026 22:01
@tomal-majumder tomal-majumder force-pushed the ddr-walkj9hashtable-support branch 2 times, most recently from de5d87e to 9991e04 Compare April 10, 2026 20:37
Adds a new DDR extension command that walks all entries of a
J9HashTable and prints each entry as a runnable DDR command.

The command accepts a single hex address and an optional type
argument:

  !walkj9hashtable <address> [type]

Signed-off-by: Tomal Majumder <tomal.majumder@ibm.com>
@tomal-majumder tomal-majumder force-pushed the ddr-walkj9hashtable-support branch from 9991e04 to 670c83e Compare April 10, 2026 21:23
@keithc-ca
Copy link
Copy Markdown
Contributor

Jenkins test extended.functional amac jdk25

@keithc-ca keithc-ca merged commit 21f38ec into eclipse-openj9:master Apr 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants