RFR: 8315127: CDSMapTest fails with incorrect number of oop references

Calvin Cheung ccheung at openjdk.org
Fri Sep 1 04:40:46 UTC 2023


On Fri, 1 Sep 2023 00:18:20 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> This is a bug in the test case. The test parses patterns like this in the map file
> 
> 
> 0x00000000ffe00000: @@ Object (0xffe00000) java.lang.String
>  - klass: 'java/lang/String' 0x0000000800010220
>  - fields (3 words):
>  - private 'hash' 'I' @12  0 (0x00000000)
>  - private final 'coder' 'B' @16  0 (0x00)
>  - private 'hashIsZero' 'Z' @17  true (0x01)
>  - injected 'flags' 'B' @18  1 (0x01)
>  - private final 'value' '[B' @20 0x00000000ffe00018 (0xffe00018) [B length: 0
> 0x00000000ffe00018: @@ Object (0xffe00018) [B length: 0
>  - klass: {type array byte} 0x00000008000024d8
> 
> 
> Before this fix, the test assets that there are at least 10000 oop references (such as the `value` field in the above String). However, some JDK builds may have fewer archived heap objects, resulting in less than 10000 references (the graal build in the bug report has only 8286 references).
> 
> After this fix, we check that the number of oop references is not fewer than the number of strings, as we know each string contains one oop field. This is sufficient to check that the map file contains expected output, without using a hard-coded number.

I have one question and spotted two minor issues.

test/hotspot/jtreg/runtime/cds/CDSMapReader.java line 312:

> 310:                     //     following line to oop+1
> 311:                     mustContain(mapFile.oopToObject, field, oop, false);
> 312:                     count1 ++;

Could `oop` be 0? If so, `oop` could be overcounted.

Pre-existing: extra import at line 27
`import java.io.RandomAccessFile;`

test/hotspot/jtreg/runtime/cds/CDSMapTest.java line 79:

> 77: 
> 78:         CDSMapReader.MapFile mapFile = CDSMapReader.read(mapName);
> 79:         CDSMapReader.validate(mapFile);

Pre-existing: extra import at lines 36 and 37

import java.io.FileInputStream;
import java.io.IOException;

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

PR Review: https://git.openjdk.org/jdk/pull/15527#pullrequestreview-1606194341
PR Review Comment: https://git.openjdk.org/jdk/pull/15527#discussion_r1312528008
PR Review Comment: https://git.openjdk.org/jdk/pull/15527#discussion_r1312530190


More information about the hotspot-runtime-dev mailing list