-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new DDR command constantpool #15404
Conversation
cd91689
to
d17b615
Compare
8a90b4f
to
c739e04
Compare
@fengxue-IS ready to be reviewed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work overall, some formatting changes and display message
note: please use (unresolved)
instead of NULL
addCommand("constantpool", "<ramclass>", "dump constant pool for the given ram class."); | ||
} | ||
|
||
public J9ClassPointer findClassByName(J9JavaVMPointer vm, String name) throws CorruptDataException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All helper methods should be private rather than public unless they will be used in other classes
String romInfo = ""; | ||
String value = ""; | ||
if (cpType == J9ConstantPool.J9CPTYPE_CLASS) { | ||
cpTypeString = "Class"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be better to have either an map or helper to translate cpType
to String and use that directly
} | ||
} | ||
value += ")"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add an else
case to catch any CP type that are either incorrect or new type which may be added in future to remind us of updating the tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add either a error message or exception throw to make this visible when a unexpected CP type is detected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throwing Error
is inappropriate here: the problem may be a corrupt core file, so CorruptDataException
is more likely the right exception.
romInfo = constantRef.dataEA().getHexAddress(); | ||
if (i < ramCPCount) { | ||
ramInfo = ramCPP.getHexAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please put the matching struct type before the address ie !J9RAMSingleSlotConstantRef
and !J9ROMSingleSlotConstantRef
same for float/long/double
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it the same thing for long and double since they uses two slots?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long and double constants don't have an entry in RAM CP, so there is nothing to check/put for ramInfo.
long/double will still use the same 2 slot structure type in ROM CP as J9ROMConstantRef
so should print romInfo = "!j9romconstantref " + romCPP.getHexAddress();
ramInfo = staticRef.valueOffset().getHexValue(); // resolved static | ||
} else if (ref.flags().gt(ref.valueOffset())) { | ||
ramInfo = ref.valueOffset().getHexValue(); // resolved instance | ||
} else { | ||
ramInfo = "NULL"; // unresolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the field type (object/static) info after the offset
so something like
0x000000000000001C (Static offset)
for unresolved entries maybe use (unresolved)
to be more clear
romInfo = "!j9rommethod " + ROMHelp.J9_ROM_METHOD_FROM_RAM_METHOD(sendMethod).getHexAddress(); | ||
} | ||
} else { | ||
ramInfo = "Method Index: " + methodIndex.longValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be VTableOffset:
ramInfo = "Method Index: " + methodIndex.longValue(); | ||
} | ||
} else { // standard interface method | ||
ramInfo = "Method Index: " + methodIndex.longValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ITable Index:
here
ramInfo = "Method Index: " + methodIndex.longValue(); | ||
} | ||
} else { | ||
ramInfo = "NULL"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as before, use (unresolved)
} | ||
J9ROMNameAndSignaturePointer nameAndSignature = romMethodRef.nameAndSignature(); | ||
romInfo = "!j9romnameandsignature " + nameAndSignature.getHexAddress(); | ||
value = "invoke/invokeExact"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should be able to get the name/signature from the ROM info, I think that would be better than having a generic invoke/invokeExact
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, few minor nit pick
} | ||
} | ||
value += ")"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add either a error message or exception throw to make this visible when a unexpected CP type is detected
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@keithc-ca can you please review this, thanks |
debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/GetCommandsTask.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
} catch (NoSuchFieldException | NoClassDefFoundError e) { | ||
throw new CorruptDataException(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please list exceptions alphabetically and add a comment explaining why it's reasonable to classify it as corruption.
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
|
||
public class J9ConstantPoolCommand extends Command { | ||
private static final HashMap<Long, String> cpTypeToString = new HashMap<Long, String>(); | ||
private static final int METHOD_INDEX_OFFSET = 8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field is poorly named; perhaps you meant to use J9_ITABLE_INDEX_SHIFT
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also used for virtual method, and it's hard-coded elsewhere so I can't come up with a good name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J9_ITABLE_INDEX_SHIFT
is 10, and that should be defined and used in rightShift(10)
calls, this value of 8 has always been hardcoded as number in VM, we should look to make that into a constant in the future, in this PR, we can just name it J9_METHOD_INDEX_SHIFT
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
@keithc-ca can this PR be merged or do you have any additional concern that you would like to see addressed? |
I'll have another look shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many of my comments were inappropriately marked as "resolved". I've unresolved the ones I still think need attention.
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
I might somehow messed up with the branch and I'm trying to get it fixed. |
FYI 379aa5a seem to be the snapshot before incorrect merge |
yeah I pushed the master branch in my java 19 repo without realizing it's not in sync with my java 18 repo which contains the latest changes. |
See #15128 (comment). |
Copying reply from #15128 (comment)
|
@keithc-ca can you take another look |
debugtools/DDR_VM/src/com/ibm/j9ddr/CompatibilityConstants29.dat
Outdated
Show resolved
Hide resolved
debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/GetCommandsTask.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
e83e1be
to
f6548fa
Compare
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
68feade
to
e1162c6
Compare
@keithc-ca Your comments have been addressed |
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
...tools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9ConstantPoolCommand.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
jenkins test sanity alinux64 jdk8,jdk17 |
It was needlessly added in eclipse-openj9#15404. Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
It was needlessly added in eclipse-openj9#15404. Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
It was needlessly added in eclipse-openj9#15404. Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
Fix #15128
@fengxue-IS