From 4d8a847ab4d4ab089b16f52eac756a5bb51a6c0c Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 28 Apr 2022 15:07:44 +0000 Subject: Libcore VarHandle generator script and tests. Test: atest {TestName} Change-Id: I6df071657a8d04ed4dd4c00ac4f4e2e941c91322 --- .../ReflectGetFieldLittleEndianIntPerfTest.java | 51 ++ .../ReflectGetFieldLittleEndianStringPerfTest.java | 51 ++ ...flectGetStaticFieldLittleEndianIntPerfTest.java | 51 ++ ...ctGetStaticFieldLittleEndianStringPerfTest.java | 51 ++ .../ReflectSetFieldLittleEndianIntPerfTest.java | 50 ++ .../ReflectSetFieldLittleEndianStringPerfTest.java | 50 ++ ...flectSetStaticFieldLittleEndianIntPerfTest.java | 50 ++ ...ctSetStaticFieldLittleEndianStringPerfTest.java | 50 ++ ...xchangeAcquireFieldLittleEndianIntPerfTest.java | 53 +++ ...angeAcquireFieldLittleEndianStringPerfTest.java | 53 +++ ...eAcquireStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...quireStaticFieldLittleEndianStringPerfTest.java | 54 +++ ...areandexchangeFieldLittleEndianIntPerfTest.java | 53 +++ ...andexchangeFieldLittleEndianStringPerfTest.java | 53 +++ ...xchangeReleaseFieldLittleEndianIntPerfTest.java | 53 +++ ...angeReleaseFieldLittleEndianStringPerfTest.java | 53 +++ ...eReleaseStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...leaseStaticFieldLittleEndianStringPerfTest.java | 54 +++ ...exchangeStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...hangeStaticFieldLittleEndianStringPerfTest.java | 53 +++ ...eCompareandsetFieldLittleEndianIntPerfTest.java | 53 +++ ...mpareandsetFieldLittleEndianStringPerfTest.java | 53 +++ ...reandsetStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...ndsetStaticFieldLittleEndianStringPerfTest.java | 53 +++ ...ndleGetAcquireFieldLittleEndianIntPerfTest.java | 62 +++ ...eGetAcquireFieldLittleEndianStringPerfTest.java | 62 +++ ...tAcquireStaticFieldLittleEndianIntPerfTest.java | 62 +++ ...quireStaticFieldLittleEndianStringPerfTest.java | 62 +++ .../VarHandleGetArrayLittleEndianIntPerfTest.java | 63 +++ ...arHandleGetArrayLittleEndianStringPerfTest.java | 63 +++ ...HandleGetByteArrayViewBigEndianIntPerfTest.java | 67 +++ ...dleGetByteArrayViewLittleEndianIntPerfTest.java | 67 +++ .../VarHandleGetFieldLittleEndianIntPerfTest.java | 62 +++ ...arHandleGetFieldLittleEndianStringPerfTest.java | 62 +++ ...andleGetOpaqueFieldLittleEndianIntPerfTest.java | 62 +++ ...leGetOpaqueFieldLittleEndianStringPerfTest.java | 62 +++ ...etOpaqueStaticFieldLittleEndianIntPerfTest.java | 62 +++ ...paqueStaticFieldLittleEndianStringPerfTest.java | 62 +++ ...andleGetStaticFieldLittleEndianIntPerfTest.java | 62 +++ ...leGetStaticFieldLittleEndianStringPerfTest.java | 62 +++ ...dleGetVolatileFieldLittleEndianIntPerfTest.java | 62 +++ ...GetVolatileFieldLittleEndianStringPerfTest.java | 62 +++ ...VolatileStaticFieldLittleEndianIntPerfTest.java | 62 +++ ...atileStaticFieldLittleEndianStringPerfTest.java | 62 +++ ...ndaddAcquireFieldLittleEndianFloatPerfTest.java | 53 +++ ...tandaddAcquireFieldLittleEndianIntPerfTest.java | 53 +++ ...cquireStaticFieldLittleEndianFloatPerfTest.java | 53 +++ ...dAcquireStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...dleGetandaddFieldLittleEndianFloatPerfTest.java | 53 +++ ...andleGetandaddFieldLittleEndianIntPerfTest.java | 53 +++ ...ndaddReleaseFieldLittleEndianFloatPerfTest.java | 53 +++ ...tandaddReleaseFieldLittleEndianIntPerfTest.java | 53 +++ ...eleaseStaticFieldLittleEndianFloatPerfTest.java | 53 +++ ...dReleaseStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...andaddStaticFieldLittleEndianFloatPerfTest.java | 53 +++ ...etandaddStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...wiseAndAcquireFieldLittleEndianIntPerfTest.java | 53 +++ ...dAcquireStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...tandbitwiseAndFieldLittleEndianIntPerfTest.java | 53 +++ ...wiseAndReleaseFieldLittleEndianIntPerfTest.java | 53 +++ ...dReleaseStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...twiseAndStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...twiseOrAcquireFieldLittleEndianIntPerfTest.java | 53 +++ ...rAcquireStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...etandbitwiseOrFieldLittleEndianIntPerfTest.java | 53 +++ ...twiseOrReleaseFieldLittleEndianIntPerfTest.java | 53 +++ ...rReleaseStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...itwiseOrStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...wiseXorAcquireFieldLittleEndianIntPerfTest.java | 53 +++ ...rAcquireStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...tandbitwiseXorFieldLittleEndianIntPerfTest.java | 53 +++ ...wiseXorReleaseFieldLittleEndianIntPerfTest.java | 53 +++ ...rReleaseStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...twiseXorStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...tandsetAcquireFieldLittleEndianIntPerfTest.java | 53 +++ ...dsetAcquireFieldLittleEndianStringPerfTest.java | 53 +++ ...tAcquireStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...quireStaticFieldLittleEndianStringPerfTest.java | 53 +++ ...andleGetandsetFieldLittleEndianIntPerfTest.java | 53 +++ ...leGetandsetFieldLittleEndianStringPerfTest.java | 53 +++ ...tandsetReleaseFieldLittleEndianIntPerfTest.java | 53 +++ ...dsetReleaseFieldLittleEndianStringPerfTest.java | 53 +++ ...tReleaseStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...leaseStaticFieldLittleEndianStringPerfTest.java | 53 +++ ...etandsetStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...ndsetStaticFieldLittleEndianStringPerfTest.java | 53 +++ .../VarHandleSetArrayLittleEndianIntPerfTest.java | 62 +++ ...arHandleSetArrayLittleEndianStringPerfTest.java | 62 +++ ...HandleSetByteArrayViewBigEndianIntPerfTest.java | 74 +++ ...dleSetByteArrayViewLittleEndianIntPerfTest.java | 74 +++ .../VarHandleSetFieldLittleEndianIntPerfTest.java | 61 +++ ...arHandleSetFieldLittleEndianStringPerfTest.java | 61 +++ ...andleSetOpaqueFieldLittleEndianIntPerfTest.java | 61 +++ ...leSetOpaqueFieldLittleEndianStringPerfTest.java | 61 +++ ...etOpaqueStaticFieldLittleEndianIntPerfTest.java | 61 +++ ...paqueStaticFieldLittleEndianStringPerfTest.java | 61 +++ ...ndleSetReleaseFieldLittleEndianIntPerfTest.java | 61 +++ ...eSetReleaseFieldLittleEndianStringPerfTest.java | 61 +++ ...tReleaseStaticFieldLittleEndianIntPerfTest.java | 61 +++ ...leaseStaticFieldLittleEndianStringPerfTest.java | 61 +++ ...andleSetStaticFieldLittleEndianIntPerfTest.java | 61 +++ ...leSetStaticFieldLittleEndianStringPerfTest.java | 61 +++ ...dleSetVolatileFieldLittleEndianIntPerfTest.java | 61 +++ ...SetVolatileFieldLittleEndianStringPerfTest.java | 61 +++ ...VolatileStaticFieldLittleEndianIntPerfTest.java | 61 +++ ...atileStaticFieldLittleEndianStringPerfTest.java | 61 +++ ...eandsetAcquireFieldLittleEndianIntPerfTest.java | 53 +++ ...dsetAcquireFieldLittleEndianStringPerfTest.java | 53 +++ ...tAcquireStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...quireStaticFieldLittleEndianStringPerfTest.java | 54 +++ ...kcompareandsetFieldLittleEndianIntPerfTest.java | 53 +++ ...mpareandsetFieldLittleEndianStringPerfTest.java | 53 +++ ...areandsetPlainFieldLittleEndianIntPerfTest.java | 53 +++ ...andsetPlainFieldLittleEndianStringPerfTest.java | 53 +++ ...setPlainStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...PlainStaticFieldLittleEndianStringPerfTest.java | 53 +++ ...eandsetReleaseFieldLittleEndianIntPerfTest.java | 53 +++ ...dsetReleaseFieldLittleEndianStringPerfTest.java | 53 +++ ...tReleaseStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...leaseStaticFieldLittleEndianStringPerfTest.java | 54 +++ ...reandsetStaticFieldLittleEndianIntPerfTest.java | 53 +++ ...ndsetStaticFieldLittleEndianStringPerfTest.java | 53 +++ .../android/libcore/varhandles/generate_java.py | 515 +++++++++++++++++++++ 123 files changed, 7345 insertions(+) create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java create mode 100644 apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java create mode 100755 apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..e7bb8f84d671 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.reflect.Field; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class ReflectGetFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + Field mField; + int mValue; + + public ReflectGetFieldLittleEndianIntPerfTest() throws Throwable { + mField = this.getClass().getDeclaredField("mValue"); + } + + @Test + public void run() throws Throwable { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mField.getInt(this); + x = (int) mField.getInt(this); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..5bac46af4630 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.reflect.Field; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class ReflectGetFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + Field mField; + String mValue; + + public ReflectGetFieldLittleEndianStringPerfTest() throws Throwable { + mField = this.getClass().getDeclaredField("mValue"); + } + + @Test + public void run() throws Throwable { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mField.get(this); + x = (String) mField.get(this); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..1005a70e96e0 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.reflect.Field; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class ReflectGetStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + Field mField; + static int sValue; + + public ReflectGetStaticFieldLittleEndianIntPerfTest() throws Throwable { + mField = this.getClass().getDeclaredField("sValue"); + } + + @Test + public void run() throws Throwable { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mField.getInt(null); + x = (int) mField.getInt(null); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..5224ad3b5911 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.reflect.Field; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class ReflectGetStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + Field mField; + static String sValue; + + public ReflectGetStaticFieldLittleEndianStringPerfTest() throws Throwable { + mField = this.getClass().getDeclaredField("sValue"); + } + + @Test + public void run() throws Throwable { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mField.get(null); + x = (String) mField.get(null); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..06696ef0773b --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.reflect.Field; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class ReflectSetFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + Field mField; + int mValue; + + public ReflectSetFieldLittleEndianIntPerfTest() throws Throwable { + mField = this.getClass().getDeclaredField("mValue"); + } + + @Test + public void run() throws Throwable { + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mField.setInt(this, 42); + mField.setInt(this, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..a784c524a4c5 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.reflect.Field; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class ReflectSetFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + Field mField; + String mValue; + + public ReflectSetFieldLittleEndianStringPerfTest() throws Throwable { + mField = this.getClass().getDeclaredField("mValue"); + } + + @Test + public void run() throws Throwable { + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mField.set(this, "qwerty"); + mField.set(this, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..4ce0078ff1c1 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.reflect.Field; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class ReflectSetStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + Field mField; + static int sValue; + + public ReflectSetStaticFieldLittleEndianIntPerfTest() throws Throwable { + mField = this.getClass().getDeclaredField("sValue"); + } + + @Test + public void run() throws Throwable { + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mField.setInt(null, 42); + mField.setInt(null, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..587e201c4e17 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.reflect.Field; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class ReflectSetStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + Field mField; + static String sValue; + + public ReflectSetStaticFieldLittleEndianStringPerfTest() throws Throwable { + mField = this.getClass().getDeclaredField("sValue"); + } + + @Test + public void run() throws Throwable { + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mField.set(null, "qwerty"); + mField.set(null, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..e06b53434438 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.compareAndExchangeAcquire(this, mField, ~42); + x = (int) mVh.compareAndExchangeAcquire(this, mField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..0fd16a02e22c --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.compareAndExchangeAcquire(this, mField, null); + x = (String) mVh.compareAndExchangeAcquire(this, mField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..7ad42d057588 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.compareAndExchangeAcquire(sField, ~42); + x = (int) mVh.compareAndExchangeAcquire(sField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..76e1f47251cf --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest() + throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.compareAndExchangeAcquire(sField, null); + x = (String) mVh.compareAndExchangeAcquire(sField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..b4b78408a45f --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.compareAndExchange(this, mField, ~42); + x = (int) mVh.compareAndExchange(this, mField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..09ed167cef35 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.compareAndExchange(this, mField, null); + x = (String) mVh.compareAndExchange(this, mField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..920d2e4767e5 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.compareAndExchangeRelease(this, mField, ~42); + x = (int) mVh.compareAndExchangeRelease(this, mField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..55ed789d1227 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.compareAndExchangeRelease(this, mField, null); + x = (String) mVh.compareAndExchangeRelease(this, mField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..ea3057b3f54f --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.compareAndExchangeRelease(sField, ~42); + x = (int) mVh.compareAndExchangeRelease(sField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..20558aa92f48 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest() + throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.compareAndExchangeRelease(sField, null); + x = (String) mVh.compareAndExchangeRelease(sField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..d7b1d2989c0e --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.compareAndExchange(sField, ~42); + x = (int) mVh.compareAndExchange(sField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..d138dc979b1d --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.compareAndExchange(sField, null); + x = (String) mVh.compareAndExchange(sField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..36153f2b7037 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandsetFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandsetFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.compareAndSet(this, mField, ~42); + success = mVh.compareAndSet(this, mField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..bf4fbc4eeefb --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandsetFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandsetFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.compareAndSet(this, mField, null); + success = mVh.compareAndSet(this, mField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..d3c1b36bd3a6 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.compareAndSet(sField, ~42); + success = mVh.compareAndSet(sField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..90e69a168391 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.compareAndSet(sField, null); + success = mVh.compareAndSet(sField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..96bc1049fad4 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetAcquireFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetAcquireFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Before + public void setup() { + int v = (int) mVh.getAcquire(this); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAcquire(this); + x = (int) mVh.getAcquire(this); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..2679494eb6de --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetAcquireFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetAcquireFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Before + public void setup() { + String v = (String) mVh.getAcquire(this); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getAcquire(this); + x = (String) mVh.getAcquire(this); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..170dce76d9c8 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Before + public void setup() { + int v = (int) mVh.getAcquire(); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAcquire(); + x = (int) mVh.getAcquire(); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..11d12db39397 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Before + public void setup() { + String v = (String) mVh.getAcquire(); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getAcquire(); + x = (String) mVh.getAcquire(); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..bd2a6008e239 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetArrayLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int ELEMENT_VALUE = 42; + int[] mArray = {ELEMENT_VALUE}; + VarHandle mVh; + + public VarHandleGetArrayLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.arrayElementVarHandle(int[].class); + } + + @Before + public void setup() { + int v = (int) mVh.get(mArray, 0); + if (v != ELEMENT_VALUE) { + throw new RuntimeException("array element has unexpected value: " + v); + } + } + + @Test + public void run() { + int[] a = mArray; + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.get(a, 0); + x = (int) mVh.get(a, 0); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..99a09cda367f --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetArrayLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String ELEMENT_VALUE = "qwerty"; + String[] mArray = {ELEMENT_VALUE}; + VarHandle mVh; + + public VarHandleGetArrayLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.arrayElementVarHandle(String[].class); + } + + @Before + public void setup() { + String v = (String) mVh.get(mArray, 0); + if (v != ELEMENT_VALUE) { + throw new RuntimeException("array element has unexpected value: " + v); + } + } + + @Test + public void run() { + String[] a = mArray; + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.get(a, 0); + x = (String) mVh.get(a, 0); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java new file mode 100644 index 000000000000..db83606bdb54 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetByteArrayViewBigEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int VALUE = 42; + byte[] mArray1 = { + (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE + }; + byte[] mArray2 = {(byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE}; + VarHandle mVh; + + public VarHandleGetByteArrayViewBigEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.BIG_ENDIAN); + } + + @Before + public void setup() { + int v = (int) mVh.get(mArray1, 0); + if (v != VALUE) { + throw new RuntimeException("array has unexpected value: " + v); + } + } + + @Test + public void run() { + byte[] a = mArray1; + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.get(a, 0); + x = (int) mVh.get(a, 0); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..4a8f92461301 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetByteArrayViewLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int VALUE = 42; + byte[] mArray1 = { + (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) + }; + byte[] mArray2 = {(byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24)}; + VarHandle mVh; + + public VarHandleGetByteArrayViewLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.LITTLE_ENDIAN); + } + + @Before + public void setup() { + int v = (int) mVh.get(mArray1, 0); + if (v != VALUE) { + throw new RuntimeException("array has unexpected value: " + v); + } + } + + @Test + public void run() { + byte[] a = mArray1; + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.get(a, 0); + x = (int) mVh.get(a, 0); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..4e4a9ee980fd --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Before + public void setup() { + int v = (int) mVh.get(this); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.get(this); + x = (int) mVh.get(this); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..3e7de1d08a0e --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Before + public void setup() { + String v = (String) mVh.get(this); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.get(this); + x = (String) mVh.get(this); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..67d53b34c4d6 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetOpaqueFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetOpaqueFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Before + public void setup() { + int v = (int) mVh.getOpaque(this); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getOpaque(this); + x = (int) mVh.getOpaque(this); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..470a1ce0fb71 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetOpaqueFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetOpaqueFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Before + public void setup() { + String v = (String) mVh.getOpaque(this); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getOpaque(this); + x = (String) mVh.getOpaque(this); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..8a982c23b1cb --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Before + public void setup() { + int v = (int) mVh.getOpaque(); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getOpaque(); + x = (int) mVh.getOpaque(); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..2c17a698b5e7 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Before + public void setup() { + String v = (String) mVh.getOpaque(); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getOpaque(); + x = (String) mVh.getOpaque(); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..099b1f4f6d82 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Before + public void setup() { + int v = (int) mVh.get(); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.get(); + x = (int) mVh.get(); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..7f6b4b8b637e --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Before + public void setup() { + String v = (String) mVh.get(); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.get(); + x = (String) mVh.get(); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..8592d30f58f0 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetVolatileFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetVolatileFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Before + public void setup() { + int v = (int) mVh.getVolatile(this); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getVolatile(this); + x = (int) mVh.getVolatile(this); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..539bd2aa8e8c --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetVolatileFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetVolatileFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Before + public void setup() { + String v = (String) mVh.getVolatile(this); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getVolatile(this); + x = (String) mVh.getVolatile(this); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..a36a7b6d39a2 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Before + public void setup() { + int v = (int) mVh.getVolatile(); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getVolatile(); + x = (int) mVh.getVolatile(); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..90d2a70691ad --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Before + public void setup() { + String v = (String) mVh.getVolatile(); + if (v != FIELD_VALUE) { + throw new RuntimeException("field has unexpected value " + v); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getVolatile(); + x = (String) mVh.getVolatile(); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java new file mode 100644 index 000000000000..4e5fcf32edd2 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final float FIELD_VALUE = 3.14f; + float mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", float.class); + } + + @Test + public void run() { + float x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (float) mVh.getAndAddAcquire(this, 2.17f); + x = (float) mVh.getAndAddAcquire(this, 2.17f); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..fd0abf85abfc --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndAddAcquire(this, ~42); + x = (int) mVh.getAndAddAcquire(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java new file mode 100644 index 000000000000..9272b1164d07 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final float FIELD_VALUE = 3.14f; + static float sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", float.class); + } + + @Test + public void run() { + float x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (float) mVh.getAndAddAcquire(2.17f); + x = (float) mVh.getAndAddAcquire(2.17f); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..a896d0a8e3e7 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndAddAcquire(~42); + x = (int) mVh.getAndAddAcquire(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java new file mode 100644 index 000000000000..671b0a3c7c83 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddFieldLittleEndianFloatPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final float FIELD_VALUE = 3.14f; + float mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddFieldLittleEndianFloatPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", float.class); + } + + @Test + public void run() { + float x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (float) mVh.getAndAdd(this, 2.17f); + x = (float) mVh.getAndAdd(this, 2.17f); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..1eb3f9277d56 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndAdd(this, ~42); + x = (int) mVh.getAndAdd(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java new file mode 100644 index 000000000000..f23d5e269154 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final float FIELD_VALUE = 3.14f; + float mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", float.class); + } + + @Test + public void run() { + float x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (float) mVh.getAndAddRelease(this, 2.17f); + x = (float) mVh.getAndAddRelease(this, 2.17f); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..161379851ce6 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndAddRelease(this, ~42); + x = (int) mVh.getAndAddRelease(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java new file mode 100644 index 000000000000..14f1c002812f --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final float FIELD_VALUE = 3.14f; + static float sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", float.class); + } + + @Test + public void run() { + float x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (float) mVh.getAndAddRelease(2.17f); + x = (float) mVh.getAndAddRelease(2.17f); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..8327caf0a124 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndAddRelease(~42); + x = (int) mVh.getAndAddRelease(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java new file mode 100644 index 000000000000..6c211fb5371b --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final float FIELD_VALUE = 3.14f; + static float sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", float.class); + } + + @Test + public void run() { + float x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (float) mVh.getAndAdd(2.17f); + x = (float) mVh.getAndAdd(2.17f); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..d02cd735e753 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandaddStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandaddStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndAdd(~42); + x = (int) mVh.getAndAdd(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..0777586dadd9 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseAndAcquire(this, ~42); + x = (int) mVh.getAndBitwiseAndAcquire(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..24a949f7b73c --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseAndAcquire(~42); + x = (int) mVh.getAndBitwiseAndAcquire(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..4b94bbe5d86d --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseAnd(this, ~42); + x = (int) mVh.getAndBitwiseAnd(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..1784c0557442 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseAndRelease(this, ~42); + x = (int) mVh.getAndBitwiseAndRelease(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..f85d3eeae9aa --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseAndRelease(~42); + x = (int) mVh.getAndBitwiseAndRelease(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..81f6779e9820 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseAnd(~42); + x = (int) mVh.getAndBitwiseAnd(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..9436fadfde72 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseOrAcquire(this, ~42); + x = (int) mVh.getAndBitwiseOrAcquire(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..9ebc45848003 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseOrAcquire(~42); + x = (int) mVh.getAndBitwiseOrAcquire(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..ea159a123d21 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseOr(this, ~42); + x = (int) mVh.getAndBitwiseOr(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..a42ec7e93c05 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseOrRelease(this, ~42); + x = (int) mVh.getAndBitwiseOrRelease(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..6f1007e553cf --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseOrRelease(~42); + x = (int) mVh.getAndBitwiseOrRelease(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..6a738181104b --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseOr(~42); + x = (int) mVh.getAndBitwiseOr(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..e9a365bd72a4 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseXorAcquire(this, ~42); + x = (int) mVh.getAndBitwiseXorAcquire(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..fc9191cc2b77 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseXorAcquire(~42); + x = (int) mVh.getAndBitwiseXorAcquire(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..5919a1dc32c9 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseXor(this, ~42); + x = (int) mVh.getAndBitwiseXor(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..313e5806cbf7 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseXorRelease(this, ~42); + x = (int) mVh.getAndBitwiseXorRelease(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..9c8b3ae1b939 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseXorRelease(~42); + x = (int) mVh.getAndBitwiseXorRelease(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..ea618cc405be --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndBitwiseXor(~42); + x = (int) mVh.getAndBitwiseXor(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..df6f470450ea --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndSetAcquire(this, ~42); + x = (int) mVh.getAndSetAcquire(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..63fd7406cee4 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getAndSetAcquire(this, null); + x = (String) mVh.getAndSetAcquire(this, null); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..a96031e673cf --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndSetAcquire(~42); + x = (int) mVh.getAndSetAcquire(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..3bc25fbbf524 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getAndSetAcquire(null); + x = (String) mVh.getAndSetAcquire(null); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..7ffdf11d0fa6 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndSet(this, ~42); + x = (int) mVh.getAndSet(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..cc7f3be26319 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getAndSet(this, null); + x = (String) mVh.getAndSet(this, null); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..8d54c00f0fe1 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndSetRelease(this, ~42); + x = (int) mVh.getAndSetRelease(this, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..22e92dd06330 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getAndSetRelease(this, null); + x = (String) mVh.getAndSetRelease(this, null); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..08ddc8b0227c --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndSetRelease(~42); + x = (int) mVh.getAndSetRelease(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..429e090642e9 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getAndSetRelease(null); + x = (String) mVh.getAndSetRelease(null); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..d5b31f66cab5 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (int) mVh.getAndSet(~42); + x = (int) mVh.getAndSet(~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..8667aaa961a4 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleGetandsetStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleGetandsetStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + x = (String) mVh.getAndSet(null); + x = (String) mVh.getAndSet(null); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..aa202469eb93 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetArrayLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int ELEMENT_VALUE = 42; + int[] mArray = {ELEMENT_VALUE}; + VarHandle mVh; + + public VarHandleSetArrayLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.arrayElementVarHandle(int[].class); + } + + @After + public void teardown() { + if (mArray[0] != ~42) { + throw new RuntimeException("array element has unexpected value: " + mArray[0]); + } + } + + @Test + public void run() { + int[] a = mArray; + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.set(a, 0, ~42); + mVh.set(a, 0, ~42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..9e0210fbd72c --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetArrayLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String ELEMENT_VALUE = "qwerty"; + String[] mArray = {ELEMENT_VALUE}; + VarHandle mVh; + + public VarHandleSetArrayLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.arrayElementVarHandle(String[].class); + } + + @After + public void teardown() { + if (mArray[0] != null) { + throw new RuntimeException("array element has unexpected value: " + mArray[0]); + } + } + + @Test + public void run() { + String[] a = mArray; + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.set(a, 0, null); + mVh.set(a, 0, null); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java new file mode 100644 index 000000000000..d48916886341 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import java.util.Arrays; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetByteArrayViewBigEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int VALUE = 42; + byte[] mArray1 = { + (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE + }; + byte[] mArray2 = {(byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE}; + VarHandle mVh; + + public VarHandleSetByteArrayViewBigEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.BIG_ENDIAN); + } + + @After + public void teardown() { + if (!Arrays.equals(mArray2, mArray1)) { + throw new RuntimeException( + "array has unexpected values: " + + mArray2[0] + + " " + + mArray2[1] + + " " + + mArray2[2] + + " " + + mArray2[3]); + } + } + + @Test + public void run() { + byte[] a = mArray2; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.set(a, 0, VALUE); + mVh.set(a, 0, VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..b06d7eff199d --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import java.util.Arrays; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetByteArrayViewLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int VALUE = 42; + byte[] mArray1 = { + (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) + }; + byte[] mArray2 = {(byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24)}; + VarHandle mVh; + + public VarHandleSetByteArrayViewLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.LITTLE_ENDIAN); + } + + @After + public void teardown() { + if (!Arrays.equals(mArray2, mArray1)) { + throw new RuntimeException( + "array has unexpected values: " + + mArray2[0] + + " " + + mArray2[1] + + " " + + mArray2[2] + + " " + + mArray2[3]); + } + } + + @Test + public void run() { + byte[] a = mArray2; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.set(a, 0, VALUE); + mVh.set(a, 0, VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..84469375c7e2 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @After + public void teardown() { + if (mField != FIELD_VALUE) { + throw new RuntimeException("mField has unexpected value " + mField); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.set(this, FIELD_VALUE); + mVh.set(this, FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..34540a31ad78 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @After + public void teardown() { + if (mField != FIELD_VALUE) { + throw new RuntimeException("mField has unexpected value " + mField); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.set(this, FIELD_VALUE); + mVh.set(this, FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..c79b5133afd5 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetOpaqueFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetOpaqueFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @After + public void teardown() { + if (mField != FIELD_VALUE) { + throw new RuntimeException("mField has unexpected value " + mField); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setOpaque(this, FIELD_VALUE); + mVh.setOpaque(this, FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..028130ddef96 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetOpaqueFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetOpaqueFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @After + public void teardown() { + if (mField != FIELD_VALUE) { + throw new RuntimeException("mField has unexpected value " + mField); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setOpaque(this, FIELD_VALUE); + mVh.setOpaque(this, FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..06a5a8ce8ceb --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @After + public void teardown() { + if (sField != FIELD_VALUE) { + throw new RuntimeException("sField has unexpected value " + sField); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setOpaque(FIELD_VALUE); + mVh.setOpaque(FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..78eefc89c8fd --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @After + public void teardown() { + if (sField != FIELD_VALUE) { + throw new RuntimeException("sField has unexpected value " + sField); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setOpaque(FIELD_VALUE); + mVh.setOpaque(FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..cd1bd4824175 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetReleaseFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetReleaseFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @After + public void teardown() { + if (mField != FIELD_VALUE) { + throw new RuntimeException("mField has unexpected value " + mField); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setRelease(this, FIELD_VALUE); + mVh.setRelease(this, FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..6c0740c7169e --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetReleaseFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetReleaseFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @After + public void teardown() { + if (mField != FIELD_VALUE) { + throw new RuntimeException("mField has unexpected value " + mField); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setRelease(this, FIELD_VALUE); + mVh.setRelease(this, FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..b95f24b0a1e8 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @After + public void teardown() { + if (sField != FIELD_VALUE) { + throw new RuntimeException("sField has unexpected value " + sField); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setRelease(FIELD_VALUE); + mVh.setRelease(FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..b03cf826c7f4 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @After + public void teardown() { + if (sField != FIELD_VALUE) { + throw new RuntimeException("sField has unexpected value " + sField); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setRelease(FIELD_VALUE); + mVh.setRelease(FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..c98c09274102 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @After + public void teardown() { + if (sField != FIELD_VALUE) { + throw new RuntimeException("sField has unexpected value " + sField); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.set(FIELD_VALUE); + mVh.set(FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..625cfc77e15b --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @After + public void teardown() { + if (sField != FIELD_VALUE) { + throw new RuntimeException("sField has unexpected value " + sField); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.set(FIELD_VALUE); + mVh.set(FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..58319b3f6326 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetVolatileFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetVolatileFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @After + public void teardown() { + if (mField != FIELD_VALUE) { + throw new RuntimeException("mField has unexpected value " + mField); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setVolatile(this, FIELD_VALUE); + mVh.setVolatile(this, FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..f741542411f5 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetVolatileFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetVolatileFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @After + public void teardown() { + if (mField != FIELD_VALUE) { + throw new RuntimeException("mField has unexpected value " + mField); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setVolatile(this, FIELD_VALUE); + mVh.setVolatile(this, FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..87f6a7832526 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @After + public void teardown() { + if (sField != FIELD_VALUE) { + throw new RuntimeException("sField has unexpected value " + sField); + } + } + + @Test + public void run() { + int x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setVolatile(FIELD_VALUE); + mVh.setVolatile(FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..610345f69051 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @After + public void teardown() { + if (sField != FIELD_VALUE) { + throw new RuntimeException("sField has unexpected value " + sField); + } + } + + @Test + public void run() { + String x; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + mVh.setVolatile(FIELD_VALUE); + mVh.setVolatile(FIELD_VALUE); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..519d4fd6179b --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetAcquire(this, mField, ~42); + success = mVh.weakCompareAndSetAcquire(this, mField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..322cf639e81d --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetAcquire(this, mField, null); + success = mVh.weakCompareAndSetAcquire(this, mField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..f8ccbadf682f --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetAcquire(sField, ~42); + success = mVh.weakCompareAndSetAcquire(sField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..16f1059d150f --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest() + throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetAcquire(sField, null); + success = mVh.weakCompareAndSetAcquire(sField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..c7084fe63b06 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSet(this, mField, ~42); + success = mVh.weakCompareAndSet(this, mField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..9d526b8687ca --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSet(this, mField, null); + success = mVh.weakCompareAndSet(this, mField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..8372f6ccffbb --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetPlain(this, mField, ~42); + success = mVh.weakCompareAndSetPlain(this, mField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..87e47e76984f --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetPlain(this, mField, null); + success = mVh.weakCompareAndSetPlain(this, mField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..aa2e1049e302 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetPlain(sField, ~42); + success = mVh.weakCompareAndSetPlain(sField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..ebaa0801e894 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetPlain(sField, null); + success = mVh.weakCompareAndSetPlain(sField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..d90356a02fa6 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + int mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", int.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetRelease(this, mField, ~42); + success = mVh.weakCompareAndSetRelease(this, mField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..6db995a7fd0b --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + String mField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findVarHandle(this.getClass(), "mField", String.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetRelease(this, mField, null); + success = mVh.weakCompareAndSetRelease(this, mField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..ecea19e2036a --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetRelease(sField, ~42); + success = mVh.weakCompareAndSetRelease(sField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..ab86284729c2 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest() + throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSetRelease(sField, null); + success = mVh.weakCompareAndSetRelease(sField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java new file mode 100644 index 000000000000..23a33f54fcb9 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final int FIELD_VALUE = 42; + static int sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", int.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSet(sField, ~42); + success = mVh.weakCompareAndSet(sField, 42); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java new file mode 100644 index 000000000000..270b5adccde1 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// This file is generated by generate_java.py do not directly modify! +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest { + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final String FIELD_VALUE = "qwerty"; + static String sField = FIELD_VALUE; + VarHandle mVh; + + public VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest() throws Throwable { + mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class); + } + + @Test + public void run() { + boolean success; + BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + while (state.keepRunning()) { + success = mVh.weakCompareAndSet(sField, null); + success = mVh.weakCompareAndSet(sField, "qwerty"); + } + } +} diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py b/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py new file mode 100755 index 000000000000..f3a1fff52205 --- /dev/null +++ b/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py @@ -0,0 +1,515 @@ +#!/usr/bin/python3 +# +# Copyright (C) 2022 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Generate java benchmarks for varhandles. +Adapted to use CrystalBall from art/test/2239-varhandle-perf/util-src/generate_java.py. + +To run use: python generate_java.py + +And then to correct lint errors (from frameworks/base): +../../tools/repohooks/tools/google-java-format.py --fix --sort-imports --google-java-format-diff ../../external/google-java-format/scripts/google-java-format-diff.py +""" + + +from enum import Enum +from pathlib import Path + +import io +import sys + + +class MemLoc(Enum): + FIELD = 0 + ARRAY = 1 + BYTE_ARRAY_VIEW = 2 + + +def to_camel_case(word): + return ''.join(c for c in word.title() if not c == '_') + + +LOOP ="BenchmarkState state = mPerfStatusReporter.getBenchmarkState();\n while (state.keepRunning())" + +class Benchmark: + def __init__(self, code, static, vartype, flavour, klass, method, memloc, + byteorder="LITTLE_ENDIAN"): + self.code = code + self.static = static + self.vartype = vartype + self.flavour = flavour + self.klass = klass + self.method = method + self.byteorder = byteorder + self.memloc = memloc + + def fullname(self): + return "{klass}{method}{flavour}{static_name}{memloc}{byteorder}{vartype}PerfTest".format( + klass = self.klass, + method = to_camel_case(self.method), + flavour = self.flavour, + static_name = "Static" if self.static else "", + memloc = to_camel_case(self.memloc.name), + byteorder = to_camel_case(self.byteorder), + vartype = to_camel_case(self.vartype)) + + def gencode(self): + if self.klass == "Reflect": + method_suffix = "" if self.vartype == "String" else self.vartype.title() + static_first_arg = "null" + elif self.klass == "Unsafe": + method_suffix = "Object" if self.vartype == "String" else self.vartype.title() + static_first_arg = "this.getClass()" + else: + method_suffix = "" + static_first_arg = "" + + first_arg = static_first_arg if self.static else "this" + + return self.code.format( + name = self.fullname(), + method = self.method + method_suffix, + flavour = self.flavour, + static_name = "Static" if self.static else "", + static_kwd = "static " if self.static else "", + static_prefix = "s" if self.static else "m", + this = first_arg, + this_comma = "" if not first_arg else first_arg + ", ", + vartype = self.vartype, + byteorder = self.byteorder, + value1 = VALUES[self.vartype][0], + value2 = VALUES[self.vartype][1], + value1_byte_array = VALUES["byte[]"][self.byteorder][0], + value2_byte_array = VALUES["byte[]"][self.byteorder][1], + loop = LOOP) + + +def BenchVHField(code, static, vartype, flavour, method): + return Benchmark(code, static, vartype, flavour, "VarHandle", method, MemLoc.FIELD) + + +def BenchVHArray(code, vartype, flavour, method): + return Benchmark(code, False, vartype, flavour, "VarHandle", method, MemLoc.ARRAY) + + +def BenchVHByteArrayView(code, byteorder, vartype, flavour, method): + return Benchmark(code, False, vartype, flavour, "VarHandle", method, MemLoc.BYTE_ARRAY_VIEW, byteorder) + + +def BenchReflect(code, static, vartype, method): + return Benchmark(code, static, vartype, "", "Reflect", method, MemLoc.FIELD) + + +def BenchUnsafe(code, static, vartype, method): + return Benchmark(code, static, vartype, "", "Unsafe", method, MemLoc.FIELD) + + +VALUES = { + "int": ["42", "~42"], + "float": ["3.14f", "2.17f"], + "String": ["\"qwerty\"", "null"], + "byte[]": { + "LITTLE_ENDIAN": [ + "{ (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) }", + "{ (byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24) }", + ], + "BIG_ENDIAN": [ + "{ (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE }", + "{ (byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE }", + ], + }, +} + +REPEAT = 2 +REPEAT_HALF = (int) (REPEAT / 2) + + +BANNER = """/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + // This file is generated by generate_java.py do not directly modify!""" + + +VH_IMPORTS = """ +package android.libcore.varhandles; + +import android.perftests.utils.BenchmarkState; +import android.perftests.utils.PerfStatusReporter; +import android.test.suitebuilder.annotation.LargeTest; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; +""" + + +VH_START = BANNER + VH_IMPORTS + """ +@RunWith(AndroidJUnit4.class) +@LargeTest +public class {name} {{ + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final {vartype} FIELD_VALUE = {value1}; + {static_kwd}{vartype} {static_prefix}Field = FIELD_VALUE; + VarHandle mVh; + + public {name}() throws Throwable {{ + mVh = MethodHandles.lookup().find{static_name}VarHandle(this.getClass(), "{static_prefix}Field", {vartype}.class); + }} +""" + + +END = """ + }} + }} +}}""" + + +VH_GET = VH_START + """ + @Before + public void setup() {{ + {vartype} v = ({vartype}) mVh.{method}{flavour}({this}); + if (v != FIELD_VALUE) {{ + throw new RuntimeException("field has unexpected value " + v); + }} + }} + + @Test + public void run() {{ + {vartype} x; + {loop} {{""" + """ + x = ({vartype}) mVh.{method}{flavour}({this});""" * REPEAT + END + + +VH_SET = VH_START + """ + @After + public void teardown() {{ + if ({static_prefix}Field != FIELD_VALUE) {{ + throw new RuntimeException("{static_prefix}Field has unexpected value " + {static_prefix}Field); + }} + }} + + @Test + public void run() {{ + {vartype} x; + {loop} {{""" + """ + mVh.{method}{flavour}({this_comma}FIELD_VALUE);""" * REPEAT + END + + +VH_CAS = VH_START + """ + @Test + public void run() {{ + boolean success; + {loop} {{""" + """ + success = mVh.{method}{flavour}({this_comma}{static_prefix}Field, {value2}); + success = mVh.{method}{flavour}({this_comma}{static_prefix}Field, {value1});""" * REPEAT_HALF + END + + +VH_CAE = VH_START + """ + @Test + public void run() {{ + {vartype} x; + {loop} {{""" + """ + x = ({vartype}) mVh.{method}{flavour}({this_comma}{static_prefix}Field, {value2}); + x = ({vartype}) mVh.{method}{flavour}({this_comma}{static_prefix}Field, {value1});""" * REPEAT_HALF + END + + +VH_GAS = VH_START + """ + @Test + public void run() {{ + {vartype} x; + {loop} {{""" + """ + x = ({vartype}) mVh.{method}{flavour}({this_comma}{value2});""" * REPEAT + END + + +VH_GAA = VH_START + """ + @Test + public void run() {{ + {vartype} x; + {loop} {{""" + """ + x = ({vartype}) mVh.{method}{flavour}({this_comma}{value2});""" * REPEAT + END + + +VH_GAB = VH_START + """ + @Test + public void run() {{ + int x; + {loop} {{""" + """ + x = ({vartype}) mVh.{method}{flavour}({this_comma}{value2});""" * REPEAT + END + + +VH_START_ARRAY = BANNER + VH_IMPORTS + """ +@RunWith(AndroidJUnit4.class) +@LargeTest +public class {name} {{ + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final {vartype} ELEMENT_VALUE = {value1}; + {vartype}[] mArray = {{ ELEMENT_VALUE }}; + VarHandle mVh; + + public {name}() throws Throwable {{ + mVh = MethodHandles.arrayElementVarHandle({vartype}[].class); + }} +""" + + +VH_GET_A = VH_START_ARRAY + """ + @Before + public void setup() {{ + {vartype} v = ({vartype}) mVh.{method}{flavour}(mArray, 0); + if (v != ELEMENT_VALUE) {{ + throw new RuntimeException("array element has unexpected value: " + v); + }} + }} + + @Test + public void run() {{ + {vartype}[] a = mArray; + {vartype} x; + {loop} {{""" + """ + x = ({vartype}) mVh.{method}{flavour}(a, 0);""" * REPEAT + END + + +VH_SET_A = VH_START_ARRAY + """ + @After + public void teardown() {{ + if (mArray[0] != {value2}) {{ + throw new RuntimeException("array element has unexpected value: " + mArray[0]); + }} + }} + + @Test + public void run() {{ + {vartype}[] a = mArray; + {vartype} x; + {loop} {{""" + """ + mVh.{method}{flavour}(a, 0, {value2});""" * REPEAT + END + + +VH_START_BYTE_ARRAY_VIEW = BANNER + VH_IMPORTS + """ +import java.util.Arrays; +import java.nio.ByteOrder; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class {name} {{ + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + static final {vartype} VALUE = {value1}; + byte[] mArray1 = {value1_byte_array}; + byte[] mArray2 = {value2_byte_array}; + VarHandle mVh; + + public {name}() throws Throwable {{ + mVh = MethodHandles.byteArrayViewVarHandle({vartype}[].class, ByteOrder.{byteorder}); + }} +""" + + +VH_GET_BAV = VH_START_BYTE_ARRAY_VIEW + """ + @Before + public void setup() {{ + {vartype} v = ({vartype}) mVh.{method}{flavour}(mArray1, 0); + if (v != VALUE) {{ + throw new RuntimeException("array has unexpected value: " + v); + }} + }} + + @Test + public void run() {{ + byte[] a = mArray1; + {vartype} x; + {loop} {{""" + """ + x = ({vartype}) mVh.{method}{flavour}(a, 0);""" * REPEAT + END + + +VH_SET_BAV = VH_START_BYTE_ARRAY_VIEW + """ + @After + public void teardown() {{ + if (!Arrays.equals(mArray2, mArray1)) {{ + throw new RuntimeException("array has unexpected values: " + + mArray2[0] + " " + mArray2[1] + " " + mArray2[2] + " " + mArray2[3]); + }} + }} + + @Test + public void run() {{ + byte[] a = mArray2; + {loop} {{""" + """ + mVh.{method}{flavour}(a, 0, VALUE);""" * REPEAT + END + + +REFLECT_START = BANNER + VH_IMPORTS + """ +import java.lang.reflect.Field; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class {name} {{ + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + Field mField; + {static_kwd}{vartype} {static_prefix}Value; + + public {name}() throws Throwable {{ + mField = this.getClass().getDeclaredField("{static_prefix}Value"); + }} +""" + + +REFLECT_GET = REFLECT_START + """ + @Test + public void run() throws Throwable {{ + {vartype} x; + {loop} {{""" + """ + x = ({vartype}) mField.{method}({this});""" * REPEAT + END + + +REFLECT_SET = REFLECT_START + """ + @Test + public void run() throws Throwable {{ + {loop} {{""" + """ + mField.{method}({this_comma}{value1});""" * REPEAT + END + + +UNSAFE_START = BANNER + VH_IMPORTS + """ +import java.lang.reflect.Field; +import jdk.internal.misc.Unsafe; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class {name} {{ + @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); + long mOffset; + public {static_kwd}{vartype} {static_prefix}Value = {value1}; + + {name}() throws Throwable {{ + Field field = this.getClass().getDeclaredField("{static_prefix}Value"); + mOffset = get{static_name}FieldOffset(field); + }} +""" + + +UNSAFE_GET = UNSAFE_START + """ + @Test + public void run() throws Throwable {{ + {vartype} x; + {loop} {{""" + """ + x = ({vartype}) theUnsafe.{method}({this_comma}mOffset);""" * REPEAT + END + + +UNSAFE_PUT = UNSAFE_START + """ + @Test + public void run() throws Throwable {{ + {loop} {{""" + """ + theUnsafe.{method}({this_comma}mOffset, {value1});""" * REPEAT + END + + +UNSAFE_CAS = UNSAFE_START + """ + @Test + public void run() throws Throwable {{ + {loop} {{""" + """ + theUnsafe.{method}({this_comma}mOffset, {value1}, {value2}); + theUnsafe.{method}({this_comma}mOffset, {value2}, {value1});""" * REPEAT_HALF + END + + +ALL_BENCHMARKS = ( + [BenchVHField(VH_GET, static, vartype, flavour, "get") + for flavour in ["", "Acquire", "Opaque", "Volatile"] + for static in [True, False] + for vartype in ["int", "String"]] + + [BenchVHField(VH_SET, static, vartype, flavour, "set") + for flavour in ["", "Volatile", "Opaque", "Release"] + for static in [True, False] + for vartype in ["int", "String"]] + + [BenchVHField(VH_CAS, static, vartype, flavour, "compareAndSet") + for flavour in [""] + for static in [True, False] + for vartype in ["int", "String"]] + + [BenchVHField(VH_CAS, static, vartype, flavour, "weakCompareAndSet") + for flavour in ["", "Plain", "Acquire", "Release"] + for static in [True, False] + for vartype in ["int", "String"]] + + [BenchVHField(VH_CAE, static, vartype, flavour, "compareAndExchange") + for flavour in ["", "Acquire", "Release"] + for static in [True, False] + for vartype in ["int", "String"]] + + [BenchVHField(VH_GAS, static, vartype, flavour, "getAndSet") + for flavour in ["", "Acquire", "Release"] + for static in [True, False] + for vartype in ["int", "String"]] + + [BenchVHField(VH_GAA, static, vartype, flavour, "getAndAdd") + for flavour in ["", "Acquire", "Release"] + for static in [True, False] + for vartype in ["int", "float"]] + + [BenchVHField(VH_GAB, static, vartype, flavour, "getAndBitwise") + for flavour in [oper + mode + for oper in ["Or", "Xor", "And"] + for mode in ["", "Acquire", "Release"]] + for static in [True, False] + for vartype in ["int"]] + + [BenchVHArray(VH_GET_A, vartype, flavour, "get") + for flavour in [""] + for vartype in ["int", "String"]] + + [BenchVHArray(VH_SET_A, vartype, flavour, "set") + for flavour in [""] + for vartype in ["int", "String"]] + + [BenchVHByteArrayView(VH_GET_BAV, byteorder, vartype, flavour, "get") + for flavour in [""] + for byteorder in ["BIG_ENDIAN", "LITTLE_ENDIAN"] + for vartype in ["int"]] + + [BenchVHByteArrayView(VH_SET_BAV, byteorder, vartype, flavour, "set") + for flavour in [""] + for byteorder in ["BIG_ENDIAN", "LITTLE_ENDIAN"] + for vartype in ["int"]] + + [BenchReflect(REFLECT_GET, static, vartype, "get") + for static in [True, False] + for vartype in ["int", "String"]] + + [BenchReflect(REFLECT_SET, static, vartype, "set") + for static in [True, False] + for vartype in ["int", "String"]]) + + + +def main(argv): + final_java_dir = Path(argv[1]) + if not final_java_dir.exists() or not final_java_dir.is_dir(): + print("{} is not a valid java dir".format(final_java_dir), file=sys.stderr) + sys.exit(1) + + for bench in ALL_BENCHMARKS: + file_path = final_java_dir / "{}.java".format(bench.fullname()) + with file_path.open("w") as f: + print(bench.gencode(), file=f) + + +if __name__ == '__main__': + main(sys.argv) -- cgit v1.2.3-59-g8ed1b