RFR: 8303489: Add a test to verify classes in vmStruct have unuque vtables

Chris Plummer cjplummer at openjdk.org
Thu Mar 2 16:15:17 UTC 2023


On Thu, 2 Mar 2023 02:41:12 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

> Unique vtables for classes in vmStruct data is a requirement for SA to correctly detect hotspot classes.
> The fix adds test to verify this requirement.
> 
> The test fails as expected on Windows if VM is built without RTTI (see JDK-8302817)

Changes requested by cjplummer (Reviewer).

test/hotspot/jtreg/serviceability/sa/UniqueVtableTest.java line 94:

> 92: 
> 93:     private void runTest() throws Throwable {
> 94:         Map<Address, List<Type>> types = new HashMap<>();

I think a better name than "types" is needed. Something like "vtableAddressToTypeMap".

test/hotspot/jtreg/serviceability/sa/UniqueVtableTest.java line 96:

> 94:         Map<Address, List<Type>> types = new HashMap<>();
> 95:         Iterator<Type> it = agent.getTypeDataBase().getTypes();
> 96:         int dupFound = 0;

Should be "dupsFound"

test/hotspot/jtreg/serviceability/sa/UniqueVtableTest.java line 112:

> 110:             }
> 111: 
> 112:             if (vtable == null && t.getSuperclass() != null) {

Why only log if there is no superclass?

test/hotspot/jtreg/serviceability/sa/UniqueVtableTest.java line 118:

> 116:                   + ", JPrimitive: " + t.isJavaPrimitiveType()
> 117:                   + ", Oop: " + t.isOopType()
> 118:                   + ", Ptr: " + t.isPointerType());

It appears that these always print "false". Are they worth having?

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

PR: https://git.openjdk.org/jdk/pull/12820


More information about the serviceability-dev mailing list