-
Notifications
You must be signed in to change notification settings - Fork 776
Save unset field NAS in ROM class and DDR support #22998
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
base: master
Are you sure you want to change the base?
Conversation
DDR and cfdump output with these changes:Sample classcfdump, -d Test$EarlyLarvalStackMap.classThe output is the same when I generate a .j9class with DDR, !dumpromclassDDR, !dumpromclasslinear ,4 |
|
|
||
| for (; frameCount > 0; frameCount--) { | ||
| boolean walkBaseFrame = false; | ||
| while (frameCount > 0) { |
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 was better expressed as a for loop; please undo that change.
Now I see why, but I don't like it. Why don't CFR_STACKMAP_EARLY_LARVAL > frameType count as frames?
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.
In the jvm spec: Tags in the range [128-245] are reserved for future use.
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.
Ok, this is part of that future usage, but that doesn't answer my question.
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 vm throws an assertion if it finds one of these values in a class file, they will not be used in a rom class.
debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9BCUtil.java
Outdated
Show resolved
Hide resolved
| { | ||
| int unsetFieldCount = new U16(slotData.at(0)).leftShift(8).bitOr(slotData.at(1)).intValue(); | ||
| slotData = slotData.add(2); | ||
| out.println(" unset_fields: " + unsetFieldCount); |
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 format() instead (throughout the new code), e.g. here
out.format(" unset_fields: %d%n", unsetFieldCount);32d71d2 to
2ec7371
Compare
keithc-ca
left a comment
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 literal MethodIsClinit referenced in ClassFileOracle.cpp is missing from romphase.h and the corresponding strings in ROMClassCreationContext.cpp are out-of-sync.
| } else if (mapType < 247) { | ||
| out.println(" UNKNOWN FRAME TAG: (" + mapType + ")\n"); | ||
| } else if (mapType < CFR_STACKMAP_EARLY_LARVAL) { | ||
| out.println("UNKNOWN FRAME TAG: (" + mapType + ")\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.
If two newlines are actually desired here, this should use format() with two occcurrences of %n.
| dumpBaseFrame = false; | ||
| out.print(" base: "); | ||
| } else { | ||
| mapPC++; |
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 += 1 here and on line 1226.
|
|
||
| static U8Pointer dumpUnsetFields(PrintStream out, J9ROMClassPointer classfile, U8Pointer slotData) throws CorruptDataException | ||
| { | ||
| int unsetFieldCount = new U16(slotData.at(0)).leftShift(8).bitOr(slotData.at(1)).intValue(); |
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.
Why does this use bitOr() instead of add() like most other places in this file?
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.
I reused the logic to read 16 bits from the only other place that uses bitOr. I can change them both so its more consistent.
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.
I see now, and converts the value to I32 so bitOr is needed in line 1151 but not here.
| cursor = cursor.add(length); | ||
| } else if (CFR_STACKMAP_SAME_LOCALS_1_STACK_EXTENDED > frameType) { /* 128..246 */ | ||
| } else if (CFR_STACKMAP_EARLY_LARVAL > frameType) { /* 128..245 */ | ||
| /* Reserved frame types - no extra data */ |
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.
While you're here, please add the missing period.
| cursor = cursor.add(length); | ||
| } | ||
| } | ||
| frameCount--; |
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 -= 1.
runtime/cfdumper/main.c
Outdated
| } | ||
|
|
||
| #if defined(J9VM_OPT_VALHALLA_STRICT_FIELDS) | ||
| static U_8 *dumpUnsetFields(J9CfrClassFile *classfile, U_8 *slotData, U_32 tabLevel) |
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:
static U_8 *
dumpUnsetFields(J9CfrClassFile *classfile, U_8 *slotData, U_32 tabLevel)| U_16 nameAndSignatureIndex = (slotData[0] << 8) + slotData[1]; | ||
| slotData += 2; | ||
| U_16 nameIndex = classfile->constantPool[nameAndSignatureIndex].slot1; | ||
| U_16 signatureIndex = classfile->constantPool[nameAndSignatureIndex].slot2; |
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 is not legal C code: all declarations must be at the beginning of a block:
U_16 nameAndSignatureIndex = (slotData[0] << 8) + slotData[1];
U_16 nameIndex = classfile->constantPool[nameAndSignatureIndex].slot1;
U_16 signatureIndex = classfile->constantPool[nameAndSignatureIndex].slot2;
slotData += 2;
for (i = 0; i < tabLevel; i++) {
j9tty_printf(PORTLIB, " ");
}
runtime/cfdumper/main.c
Outdated
| slotData += 2; | ||
| U_16 nameIndex = classfile->constantPool[nameAndSignatureIndex].slot1; | ||
| U_16 signatureIndex = classfile->constantPool[nameAndSignatureIndex].slot2; | ||
| j9tty_printf(PORTLIB, "NAS: %i, Name: %i -> %s, Signature: %i -> %s\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 don't capitalize "Name" and "Signature" here.
runtime/oti/bcverify.h
Outdated
| @@ -55,8 +55,8 @@ typedef struct J9BranchTargetStack { | |||
|
|
|||
| #if defined(J9VM_OPT_VALHALLA_STRICT_FIELDS) | |||
| typedef struct J9StrictFieldEntry { | |||
| /* nameutf8 is the only field used to determine equality. */ | |||
| J9UTF8* nameutf8; | |||
| /* nas is the only field used to determine equality. */ | |||
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 correct the indentation here.
| @@ -2141,7 +2141,7 @@ typedef struct J9TranslationBufferSet { | |||
| typedef struct J9EarlyLarvalFrame { | |||
| IDATA baseFramePC; /* The only field used to determine equality. */ | |||
| U_16 numberOfUnsetFields; | |||
| U_16 *unsetFieldCpList; | |||
| J9ROMNameAndSignature **unsetFieldNASList; | |||
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.
Do the entries need to be pointers here? Why not just pairs of U_16?
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.
I wanted to keep the NAS instead of just the name and signature constant pool indices so that the ClassFileWriter can recreate the class file from the rom class.
NAS doesn't get stored in the rom class directly like NameAndType in a class file so I used the pointer instead.
|
Please update the commit, the title and description of this pull request to capitalize acronyms "NAS", "ROM" and "DDR. |
- record name and signature SRP instead of just the name in the rom class so ClassFileWriter can recreate the class file. - print early larval frame with cfdump -d support - print early larval frame with ddr dumpromclass - print early larval frame with ddr dumpromclasslinear Signed-off-by: Theresa Mammarella <[email protected]>
2ec7371 to
817bd87
Compare
| out.println(" UNKNOWN FRAME TAG: (" + mapType + ")\n"); | ||
| } else if (mapType < CFR_STACKMAP_EARLY_LARVAL) { | ||
| out.format("UNKNOWN FRAME TAG: (" + mapType + ")%n%n"); | ||
| } else if (mapType == CFR_STACKMAP_EARLY_LARVAL) { |
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.
Do we need a class version check here (and for the new code dealing with unsetfields) ? As for Pre-Valhalla class, it should still be treated as UNKNOWN FRAME TAG
related: #21884