Although SA has some FlatArrayKlass support, it is mostly incomplete. This is 
causing heap walking to abort when a flattened array of value objects is 
encountered. 4 SA tests are failing in non-obvious ways because of this.

[JDK-8380769](https://bugs.openjdk.org/browse/JDK-8380769) [lworld] 
resourcehogs/serviceability/sa/TestHeapDumpForLargeArray.java fails with 
'truncating to' missing from stdout/stderr with --enable-preview
[JDK-8380851](https://bugs.openjdk.org/browse/JDK-8380851) [lworld] 
serviceability/sa/ClhsdbJstackWithConcurrentLock.java fails with "', (a 
java/util/concurrent/locks/ReentrantLock$NonfairSync)' not found in jstack 
output" when using --enable-preview
[JDK-8380852](https://bugs.openjdk.org/browse/JDK-8380852) [lworld] 
serviceability/sa/CDSJMapClstats.java fails with "'BootClassLoader' missing 
from stdout/stderr" with "-XX:-UseCompressedOops --enable-preview"
[JDK-8380853](https://bugs.openjdk.org/browse/JDK-8380853) [lworld] 
serviceability/sa/ClhsdbJhisto.java fails with "'java.nio.HeapByteBuffer' 
missing from stdout/stderr" with "-XX:-UseCompressedOops --enable-preview"

The main shortcoming is that there is no FlatArray type in SA yet, and also the 
code to instantiate it is missing in the following:


  public Oop newOop(OopHandle handle) {
...
    Klass klass = Oop.getKlassForOopHandle(handle);
    if (klass != null) {
      if (klass instanceof TypeArrayKlass) return new TypeArray(handle, this);
 + if (klass instanceof FlatArrayKlass) return new FlatArray(handle, this);
      if (klass instanceof ObjArrayKlass) return new ObjArray(handle, this);
      if (klass instanceof InstanceKlass) return new Instance(handle, this);
    }
    throw new UnknownOopException(handle.toString());
  }


Without the added code, this method throws UnknownOopException when it 
encounters a flattened array. That in turn causes the heap walking to stop 
scanning the region it is in, thinking that it has reached the top of the used 
part of the region. See ObjectHeap.iterateLiveRegions(). 

Tested tier1, tier2 svc, and tier5 svc CI testing with and w/o 
--enable-preview. Did tier5, tier6, and tier7 with --enable-preview on 
linux-x64-debug only.

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

Commit messages:
 - Add partial support for flattened arrays of value objects

Changes: https://git.openjdk.org/valhalla/pull/2271/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2271&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8381115
  Stats: 117 lines in 3 files changed: 115 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/valhalla/pull/2271.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2271/head:pull/2271

PR: https://git.openjdk.org/valhalla/pull/2271

Reply via email to