RFR: 8306582: Remove MetaspaceShared::exit_after_static_dump() [v4]

Ioi Lam iklam at openjdk.org
Wed Aug 2 16:03:50 UTC 2023


On Wed, 2 Aug 2023 04:01:46 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Yes it should! Thank you for catching this.
>
> This suggests we don't have test coverage for this case.

If we want to add a test case, I would suggest adding a WhiteBox method like:


public native Object[] getResolvedReferences(Class<?> c);


This would return the `resolved_references` array for this class.

The test class would look like this:


class TestApp {
    static String foo = "fooString";
    static String bar = "barString";

    public void main(String args[]) {
        Object[] resolvedReferences = wb.getResolvedReferences(TestApp.class);

        ... resolvedReferences must be non null for classes in the static archive
        ... the test needs to have @requires vm.cds.write.archived.java.heap

        bool foundFoo = false;
        bool foundBar = false;
        for (Object o : resolvedReferences) {
            foundFoo |= (o == foo);
            foundBar |= (o == bar);
        }

        ... foo and bar must have been found
        ... CDS resolves all of the string literals used by the TestApp and stores
        ... them inside the resolvedReferences array.
}


The new test can live under test/hotspot/jtreg/runtime/cds/appcds/sharedStrings

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14879#discussion_r1282115165


More information about the core-libs-dev mailing list