Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8313638

Add test for dump of resolved references

    XMLWordPrintable

Details

    • b16

    Backports

      Description

        The change in JDK-8306582 revealed that the state of the resolved references array is not checked in the CDS archive.

        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

        Attachments

          Issue Links

            Activity

              People

                matsaave Matias Saavedra Silva
                matsaave Matias Saavedra Silva
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: