On Tue, 31 Mar 2026 02:04:01 GMT, Chris Plummer <[email protected]> wrote:
>> First it helpful to know that for hprof files, every java object is given an >> ObjectID, and that id is simply the address of the java object in the java >> heap. SA does the following to write a field that is reference type into the >> hprof file: >> >> >> OopHandle handle = ((OopField)field).getValueAsOopHandle(oop); >> writeObjectID(getAddressValue(handle)); >> >> >> The only validation it does is to make sure the address of the field is >> valid. Note I'm referring to the address of the field itself, not the >> address (oop) stored in the field. If the field is flattened, it may no >> longer have an 8-byte alignment requirement. But getAddressValue(handle) >> does. So if the field is not 8-byte aligned we get the >> UnalignedAddressException and you see in the stack trace that is happening >> in all of the heap dumping test. If it is 8-byte aligned, then the contents >> are just blindly loaded and treated as an oop, which then gets written as an >> (invalid) ObjectID into the hprof file. It then turns up as the hprof >> verification error that you see in >> [JDK-8377387](https://bugs.openjdk.org/browse/JDK-8377387): >> >> WARNING: Failed to resolve object id 0x10000 for field isRegularFile >> (signature L) >> >> The fix is to not write the (invalid) ObjectID if the field has been >> flattened, and instead just write the ObjectID for null as if the field >> actually contained a null. This gets us around the issues that cause test >> failures, but eventually we need to properly handle the flattened field and >> write its scalar contents to the hprof file. I'll file a separate CR for >> that. >> >> Tested using --enable-preview with all tier1, tier2 svc, and tier5 svc. > > Chris Plummer has updated the pull request incrementally with one additional > commit since the last revision: > > use if/else Marked as reviewed by sspitsyn (Committer). ------------- PR Review: https://git.openjdk.org/valhalla/pull/2280#pullrequestreview-4034394324
