> 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 with a new target base due to a 
merge or a rebase. The pull request now contains three commits:

 - Merge
 - use if/else
 - Fix issue with flattened fields causing heap dumps to fail

-------------

Changes: https://git.openjdk.org/valhalla/pull/2280/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2280&range=02
  Stats: 14 lines in 4 files changed: 5 ins; 7 del; 2 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

Reply via email to