> 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: Fix merge issue ------------- Changes: - all: https://git.openjdk.org/valhalla/pull/2280/files - new: https://git.openjdk.org/valhalla/pull/2280/files/bc3e76eb..1e432cf5 Webrevs: - full: https://webrevs.openjdk.org/?repo=valhalla&pr=2280&range=03 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=2280&range=02-03 Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod Patch: https://git.openjdk.org/valhalla/pull/2280.diff Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2280/head:pull/2280 PR: https://git.openjdk.org/valhalla/pull/2280
