RFR 8183938: [MVT] Add test for mock vector API

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Jul 6 14:59:33 UTC 2017


Thanks

Maurizio


On 06/07/17 15:58, Tobias Hartmann wrote:
> Hi Maurizio,
>
> thanks for the test, the problem is:
> https://bugs.openjdk.java.net/browse/JDK-8183111
>
> You can disable the intrinsic with "-XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_isAssignableFrom" as Mandy did for other tests:
> http://cr.openjdk.java.net/~mchung/valhalla/webrevs/8181425/revised-fix/index.html
>
> I'll send the fix for review tomorrow.
>
> Best regards,
> Tobias
>
> On 06.07.2017 16:49, Maurizio Cimadamore wrote:
>> Attached is a simple and self-contained jtreg test. Please let me know what do you think.
>>
>> The test passes if you run with debugger enabled and you step inside Class.isValueClass - otherwise it fails.
>>
>> Maurizio
>>
>>
>> On 06/07/17 15:27, Maurizio Cimadamore wrote:
>>> Nope - there's something else going on here - probably some bad optimization? I can only reproduce the problem with -Xcomp and if I'm _not_ debugging.
>>>
>>> Maurizio
>>>
>>>
>>> On 06/07/17 15:15, Maurizio Cimadamore wrote:
>>>> Something is probably off with clasloaders - and that makes the test System.isValueClass (and Class.isValueClass) to fail. Investigating.
>>>>
>>>> Maurizio
>>>>
>>>>
>>>> On 06/07/17 15:08, Maurizio Cimadamore wrote:
>>>>> -Xcomp doesn't work - I get this:
>>>>>
>>>>> org.testng.TestNGException:
>>>>> An error occurred while instantiating class VectorTest: Long2$Value not a value type
>>>>>      at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:393)
>>>>>      at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:295)
>>>>>      at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:117)
>>>>>      at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:183)
>>>>>      at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:128)
>>>>>      at org.testng.TestRunner.initMethods(TestRunner.java:415)
>>>>>      at org.testng.TestRunner.init(TestRunner.java:241)
>>>>>      at org.testng.TestRunner.init(TestRunner.java:211)
>>>>>      at org.testng.TestRunner.<init>(TestRunner.java:158)
>>>>>      at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:545)
>>>>>      at org.testng.SuiteRunner.init(SuiteRunner.java:159)
>>>>>      at org.testng.SuiteRunner.<init>(SuiteRunner.java:114)
>>>>>      at org.testng.TestNG.createSuiteRunner(TestNG.java:1260)
>>>>>      at org.testng.TestNG.createSuiteRunners(TestNG.java:1247)
>>>>>      at org.testng.TestNG.runSuitesLocally(TestNG.java:1101)
>>>>>      at org.testng.TestNG.run(TestNG.java:1018)
>>>>>      at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
>>>>>      at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
>>>>>      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>>      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>      at java.base/java.lang.reflect.Method.invoke(Method.java:563)
>>>>>      at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
>>>>>      at java.base/java.lang.Thread.run(Thread.java:844)
>>>>> Caused by: java.lang.InternalError: Long2$Value not a value type
>>>>>      at java.base/java.lang.System$2.loadValueTypeClass(System.java:2174)
>>>>>      at java.base/valhalla.shady.MinimalValueTypes_1_0.loadValueTypeClass(MinimalValueTypes_1_0.java:114)
>>>>>      at java.base/valhalla.shady.MinimalValueTypes_1_0.getValueTypeClass(MinimalValueTypes_1_0.java:107)
>>>>>      at java.base/jdk.experimental.value.ValueType.forClass(ValueType.java:158)
>>>>>      at VectorTest.<clinit>(VectorTest.java:18)
>>>>>      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>>>>      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>>>>>      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>>>>>      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:487)
>>>>>      at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
>>>>>      at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:382)
>>>>>      ... 23 more
>>>>>
>>>>>
>>>>> Without -Xcomp, or with -Xint everything works.
>>>>>
>>>>> Any clues?
>>>>>
>>>>> Maurizio
>>>>>
>>>>>
>>>>> On 06/07/17 15:03, Maurizio Cimadamore wrote:
>>>>>>
>>>>>> On 06/07/17 14:51, Tobias Hartmann wrote:
>>>>>>> On 06.07.2017 15:48, Maurizio Cimadamore wrote:
>>>>>>>> Not really, that's something that came from before your fix of JDK-8183129 now it can be safely removed if preferred.
>>>>>>>>
>>>>>>>> I will also remove -Xint flag from the test that I've already pushed.
>>>>>>> Okay, thanks! I think it would be best to have one run with -Xint and one with -Xcomp.
>>>>>>>
>>>>>>> Is there a reason you are using testng instead of a normal jtreg test?
>>>>>> testng makes it easier to add new test cases as you go along - with plain jtreg you really only have a main method. It is also easier to create things like data providers - e.g. create a bunch of objects and execute a given test method against each possible object in the data set. In other words, testng is typically more suited for writing unit tests, and the test report will be generally more useful e.g :
>>>>>>
>>>>>> test VectorTest.testConditional(): success
>>>>>> test VectorTest.testSumArray(1): success
>>>>>> test VectorTest.testSumArray(5): success
>>>>>> test VectorTest.testSumArray(10): success
>>>>>> test VectorTest.testSumArray(0): success
>>>>>>
>>>>>> ===============================================
>>>>>> valhalla/mvt/vector/VectorTest.java
>>>>>> Total tests run: 5, Failures: 0, Skips: 0
>>>>>> ===============================================
>>>>>>
>>>>>> You can of course do all this with jtreg, but you have to do it manually, with the risk of replicating routines across multiple tests (e.g. assertEquals, etc.)
>>>>>>
>>>>>>
>>>>>> Maurizio
>>>>>>
>>>>>>> Best regards,
>>>>>>> Tobias
>>>>>>>
>>>>>>>> On 06/07/17 14:40, Tobias Hartmann wrote:
>>>>>>>>> Hi Maurizio,
>>>>>>>>>
>>>>>>>>> is there a reason that the test is only executed with -Xint?
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Tobias
>>>>>>>>>
>>>>>>>>> On 06.07.2017 15:28, Maurizio Cimadamore wrote:
>>>>>>>>>> Hi,
>>>>>>>>>> this changeset adds the mock vector API test that Vlad has worked on. I cleaned it up a bit and converted to a working testng test.
>>>>>>>>>>
>>>>>>>>>> http://cr.openjdk.java.net/~mcimadamore/8183938/
>>>>>>>>>>
>>>>>>>>>> Cheers
>>>>>>>>>> Maurizio
>>>>>>>>>>



More information about the valhalla-dev mailing list