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

Alex Menkov amenkov at openjdk.org
Thu Mar 2 20:42:16 UTC 2023


On Thu, 2 Mar 2023 03:39:27 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   addressed feedback
>
> test/hotspot/jtreg/serviceability/sa/UniqueVtableTest.java line 84:
> 
>> 82:         MethodHandles.Lookup classLookup = MethodHandles.privateLookupIn(BasicTypeDataBase.class, lookup);
>> 83:         vtblForType = classLookup.findVirtual(BasicTypeDataBase.class, "vtblForType",
>> 84:                  MethodType.methodType(Address.class, Type.class));
> 
> I think it would be ok to just make vtblForType() public so you won't need to use reflection. The public SA APIs are not a spec. We are free to do things in the future that are not backwards compatible.

Agree. Done.
Also made one field of the BasicTypeDataBase private (as it should be)

> 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".

Fixed (but used shorter name)

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

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


More information about the serviceability-dev mailing list