-
Notifications
You must be signed in to change notification settings - Fork 737
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 DumpAllOffHeapEntriesCommand in DDR #21047
base: master
Are you sure you want to change the base?
Conversation
73c3599
to
37ff513
Compare
output format for DumpAllSparseHeapEntriesCommand
|
just curious, how this output looks like for Compressed Refs? I guess there are leading zeroes added to the object address. |
4658ac3
to
c21c507
Compare
I think it always output 64 bit address for object pointer, and I will update for whitespace issues, thanks |
@keithc-ca please review |
/** | ||
* ObjectToSparseDataHashTable is used for accessing hash tables in SparseDataTableEntry | ||
* (e.g. readAccessHashTable) | ||
*/ | ||
|
||
public class ObjectToSparseDataHashTable extends HashTable_V1<MM_SparseDataTableEntryPointer> |
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 improve the javadoc (at least finish the sentence with a period) and remove the blank line separating it from the class.
* @param structure | ||
* the J9HashTablePointer | ||
* | ||
* @throws CorruptDataException | ||
* when fails to read from structure |
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.
Tabs should only be used for indentation, please use spaces on lines 48, 51.
public UDATA hash(MM_SparseDataTableEntryPointer entry) throws CorruptDataException { | ||
return UDATA.cast(entry._dataPtr()); | ||
} |
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 format consistently; the opening brace {
should be on a separate line.
protected ObjectToSparseDataHashTable(J9HashTablePointer hashTablePointer, boolean isInline, Class<MM_SparseDataTableEntryPointer> structType, | ||
HashEqualFunction<MM_SparseDataTableEntryPointer> equalFn, | ||
HashFunction<MM_SparseDataTableEntryPointer> hashFn) 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.
Please fold this, one parameter per line.
public class DumpAllSparseHeapEntriesCommand extends Command | ||
{ | ||
public DumpAllSparseHeapEntriesCommand() | ||
{ | ||
addCommand("dumpalloffheapentries", "cmd|help", "dump all off heap entries"); |
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.
Suggest the class name should more closely match the command name.
addCommand("dumpalloffheapentries", "cmd|help", "dump all off heap entries"); | ||
} | ||
|
||
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException |
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 the missing @Override
annotation.
if (0 != args.length) { | ||
String argument = args[0]; | ||
|
||
if(argument.equalsIgnoreCase("help")) { |
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.
Formatting: space before (
.
HashTable<MM_SparseDataTableEntryPointer> readObjectToSparseDataTable = ObjectToSparseDataHashTable.fromJ9HashTable(objectToSparseDataTable); | ||
SlotIterator<MM_SparseDataTableEntryPointer> readSlotIterator = readObjectToSparseDataTable.iterator(); | ||
long count = readObjectToSparseDataTable.getCount(); | ||
out.printf("List off heap entries(%,d entries)\n", count); |
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 %n
, not \n
in format strings in calls to printf()
or format()
.
out.printf("List off heap entries(%,d entries)\n", count); | ||
if (0 < count) { | ||
if (!J9BuildFlags.J9VM_ENV_DATA64) { | ||
throw new CorruptDataException("off heap would not be supported in 32 bit platform."); |
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 hyphenate "32-bit", and improve wording:
throw new CorruptDataException("off heap is not supported on 32-bit platforms");
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.
On second thought, this command should only be added in GetCommandsTask
for 64-bit core files.
9aa77cb
to
9e709bf
Compare
|
||
/** | ||
* ObjectToSparseDataHashTable is used for accessing hash tables {@link HashTable} | ||
* in SparseDataTableEntry {@link MM_SparseDataTableEntryPointer} (e.g. iterator)。 |
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 use a normal period to finish sentences (unicode 0x2e).
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.
Not all of those are fixed; see line 47.
debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/ObjectToSparseDataHashTable.java
Outdated
Show resolved
Hide resolved
debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/ObjectToSparseDataHashTable.java
Outdated
Show resolved
Hide resolved
return new ObjectToSparseDataHashTable(structure, false, MM_SparseDataTableEntryPointer.class, new SparseDataHashEqualFn(), new SparseDataHashFn()); | ||
} | ||
|
||
private static class SparseDataHashFn implements HashFunction<MM_SparseDataTableEntryPointer> |
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 still not final
.
debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/ObjectToSparseDataHashTable.java
Outdated
Show resolved
Hide resolved
@@ -45,6 +46,7 @@ | |||
import com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpAllRegionsCommand; | |||
import com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpAllRomClassLinearCommand; | |||
import com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpAllSegmentsCommand; | |||
import com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.DumpAllOffHeapEntriesCommand; |
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 keep imports sorted.
|
||
|
||
public class DumpAllOffHeapEntriesCommand extends Command |
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.
One blank line at a time is sufficient. Please add the missing javadoc.
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.
The javadoc is still missing.
...DR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/DumpAllOffHeapEntriesCommand.java
Outdated
Show resolved
Hide resolved
if (!J9BuildFlags.J9VM_ENV_DATA64) { | ||
throw new CorruptDataException("32-bit JVM should not contain any off heap.%n"); | ||
} |
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 remove this dead code (and the related import).
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.
The import is still present; please remove it.
...DR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/DumpAllOffHeapEntriesCommand.java
Outdated
Show resolved
Hide resolved
9caf04b
to
27bd42b
Compare
} | ||
|
||
/** | ||
* Opens J9HashTable from J9HashTablePointer。 |
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 use an ASCII period (.
, not 。
).
import com.ibm.j9ddr.tools.ddrinteractive.Context; | ||
import com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException; | ||
import com.ibm.j9ddr.tools.ddrinteractive.Command; | ||
import com.ibm.j9ddr.vm29.j9.HashTable; | ||
import com.ibm.j9ddr.vm29.j9.ObjectToSparseDataHashTable; | ||
import com.ibm.j9ddr.vm29.j9.SlotIterator; | ||
import com.ibm.j9ddr.vm29.j9.gc.GCBase; | ||
import com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer; | ||
import com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer; | ||
import com.ibm.j9ddr.vm29.pointer.generated.MM_SparseAddressOrderedFixedSizeDataPoolPointer; | ||
import com.ibm.j9ddr.vm29.pointer.generated.MM_SparseDataTableEntryPointer; | ||
import com.ibm.j9ddr.vm29.pointer.generated.MM_SparseVirtualMemoryPointer; | ||
import com.ibm.j9ddr.vm29.pointer.VoidPointer; |
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 sort imports.
{ | ||
public DumpAllOffHeapEntriesCommand() | ||
{ | ||
addCommand("dumpalloffheapentries", "cmd|help", "dump all off-heap entries"); |
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.
Suggest cmd|help
should instead be [help]
.
- new DumpAllOffHeapEntriesCommand provides a way to list all off-heap entries in the core file, which contain off heap data (only when off-heap has been enabled in jvm and gcpolicy has been set to Balanced GC mode). - for the rest of cases(off-heap has been disabled or "old core file", which did not contain off-heap option at all), print out error message "This command only works with the core file, which contains off-heap." - off-heap entry information includes the address of the Array Object, the data address and the size of array data Signed-off-by: lhu <[email protected]>
27bd42b
to
f8e78c1
Compare
import com.ibm.j9ddr.vm29.j9.gc.GCBase; | ||
import com.ibm.j9ddr.vm29.j9.HashTable; | ||
import com.ibm.j9ddr.vm29.j9.ObjectToSparseDataHashTable; | ||
import com.ibm.j9ddr.vm29.j9.SlotIterator; | ||
import com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer; | ||
import com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer; | ||
import com.ibm.j9ddr.vm29.pointer.generated.MM_SparseAddressOrderedFixedSizeDataPoolPointer; | ||
import com.ibm.j9ddr.vm29.pointer.generated.MM_SparseDataTableEntryPointer; | ||
import com.ibm.j9ddr.vm29.pointer.generated.MM_SparseVirtualMemoryPointer; | ||
import com.ibm.j9ddr.vm29.pointer.VoidPointer; |
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.
Imports should be sorted with subpackages following their parent package; GCBase
and VoidPointer
should be placed like this:
import com.ibm.j9ddr.vm29.j9.SlotIterator;
import com.ibm.j9ddr.vm29.j9.gc.GCBase;
import com.ibm.j9ddr.vm29.pointer.VoidPointer;
import com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer;
off-heap entries in the core file, which contain off-heap data
(only when off-heap has been enabled in jvm and gcpolicy has been set
to Balanced GC mode).
which did not contain off-heap option at all), print out error message
"This command only works with the core file,
which contains off-heap."
the address of the Array Object,
the data address and
the size of array data
Signed-off-by: lhu [email protected]