summaryrefslogtreecommitdiff
path: root/libart
AgeCommit message (Collapse)Author
2021-09-27Add newStringFromUtf8Bytes native implementation.Rock.Yeh
Porting a part of StringFactory.newStringFromBytes from libcore to native for UTF-8 character set. It can improve the UX score of Antutu v8 a little bit. Only watch UX score. We test 10 times and average the total score. Bechmark results - before(Java implementation): 10 times avg,: 13133.9 - after (Native implementation): 10 times avg.: 13324.2 Diff.: +1.4% Bug: 176514597 Test: cts Change-Id: I6b601c09663b21fdacde7f14b0db1ac4f0a94c0f
2020-05-20Use nanoTime() in finalizer watchdogHans Boehm
We want to stop the clock if the processor is powered down. Bug: 156968512 Test: art/test/testrunner/testrunner.py --host -b --64 Change-Id: Ib615851fea78df1568305b8bcf8d9bea405a8f35 (cherry picked from commit 7809156fe25b5c8aa210f61fe1234a30a27e59bb)
2020-03-18Libcore: Add classloader to dex cacheAndreas Gampe
Live dex caches must keep their associated classloader live. Otherwise the classloader may get unloaded, attempting to free DexFiles which cannot be unregistered. Companion to ART change. Test: art/test/testrunner/testrunner.py -b --host Bug: 149098478 (cherry-picked from commit 271b4054b825efca3176c4ac11565e33cff5d09a) Merged-In: I0eed5b3b46ed681c739d6923a57d0878afbba1a7 Change-Id: I0eed5b3b46ed681c739d6923a57d0878afbba1a7
2020-03-13Reland "libcore: Remove native calls in FileDescriptor <clinit>"Orion Hodson
This reverts commit Ie9fa5a25d5352f214a16e10d5bbbe45da9f3c486. Original commit message: Moves cloning of FileDescriptor in, out, and err descriptors into a ZygoteHook. This avoids the need to run JNI methods in FileDescriptor.<clinit> and enables native Core Platform API checking of FileDescriptor descriptor and ownerId fields. Changes in reland: Force UnixChannelFactory to fail initialization during AOT compilation. UnixChannelFactory is on the preloaded-classes-blacklist and the changes in the original CL unintentionally allowed it to be initialized. It used to be that FileDescriptor and UnixChannelFactory initialization failed in the same transaction due to the FileDescriptor clinit method making native calls (dup(s)). Bug: 144502743 Bug: 150680645 Test: art/test/run-test --host 001-HelloWorld Test: art/tools/run-libcore-tests.sh --mode=host --variant=X64 Test: atest -s <serial> -c \ CtsLibcoreTestCases:libcore.java.io.FileDescriptorTest Test: atest PreloadCheck Change-Id: I81e1af1d13ec81b3e51ce1d2f3c202f807d9f9bb Merged-In: I81e1af1d13ec81b3e51ce1d2f3c202f807d9f9bb (cherry picked from commit 32ea49e614fc79873148ae974df55b0d8ba15396)
2020-02-28Add change ids to gate greylist-max-p, greylist-max-qatrost
This will allow toggling access to APIs that are in greylist-max-p and greylist-max-q (two separate toggles). Bug: 149994052 Bug: 149997251 Test: mma test-art-host-gtest-hidden_api_test64 Test: adb shell dumpsys platform_compat Change-Id: I21d7a37a35cad8ec638d9c33dea27e75752324eb Merged-In: I21d7a37a35cad8ec638d9c33dea27e75752324eb
2020-02-08Introduce VMRuntime#isValidClassLoaderContextDan Zimmerman
This API is needed by the PackageManager server to validate class loader context strings passed to it from untrusted applications. See the discussion on I00357cfe086ff149f92c1078c6df6daa713c8f7c. Test: atest com.android.server.pm.dex.DexManagerTests Change-Id: I1a4fb1f863db94d27a84fd93f612541d2deb7bff
2020-01-28Remove isDebuggerActive function.Alex Light
This function is identical to VMDebug#isDebuggerConnected and always has been in ART (on dalvik there was a distinction between the two). Dedup the one user to the isDebuggerConnected function. Test: build Bug: 148401311 Change-Id: Iad18a55bc6dc2c371cc7c2c49765e0aba2f7a793
2020-01-15Add change id for hidden api check hardeningAndrei Onea
This removes a workaround that allows bypassing hidden api checks. Bug: 142365358 Test: art/test/testrunner/testrunner.py --target --64 -t674-hiddenapi Test: art/test/testrunner/run_build_test_target.py -j110 art-asan Change-Id: Icfd0cd8b7ae5ae7534bdc475a815a4598e5da347
2020-01-14Revert "Add change id for hidden api check hardening"Andrei-Valentin Onea
Revert "Harden hidden api checks." Revert submission 1203343-hidden-api-check-hardening Reason for revert: art-asan target failure Reverted Changes: I5af9f79f5: Add change id for hidden api check hardening Ifc8d39ba2: Harden hidden api checks. Change-Id: Ic21ecd06378ca4ec7dfb93a4c7c60c41b3e99283
2020-01-13Add change id for hidden api check hardeningAndrei Onea
This removes a workaround that allows bypassing hidden api checks. Bug: 142365358 Test: art/test/testrunner/testrunner.py --target --64 -t674-hiddenapi Change-Id: I5af9f79f5f62c7bbef69557067c9de234ecde7d3
2019-12-12Merge "Pipe disabled compat changes to runtime through zygote."Anna Trostanetski
2019-12-12Pipe disabled compat changes to runtime through zygote.atrost
Test: atest libcore.dalvik.system Bug: 145743810 Exempt-From-Owner-Approval: identical to internal approved change Change-Id: Ib21b2ad689a18ba4770e4ed22accc44eb2dd71a4 Merged-In: Ib21b2ad689a18ba4770e4ed22accc44eb2dd71a4
2019-12-11Use new UnsupportedAppUsage annotation.Artur Satayev
New annotation is tools/platform-compat/annotation/src/java/android/compat/annotation/UnsupportedAppUsage.java. Existing annotations in libcore/ and frameworks/ will be deleted after the migration: - libcore/dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java - frameworks/base/core/java/android/annotation/UnsupportedAppUsage.java This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Exempt-From-Owner-Approval: +2 by owner, by vote lost on latest patch. Change-Id: Ib5b7baa399cdc38da1d3ca622ba0ba26936b1b2d
2019-11-25Add resetJitCountersMathieu Chartier
Used to avoid Jit counters from class preloading being recorded in the boot profiles. Bug: 139883463 Bug: 142564450 Test: test/run-test 2230-profile-save-hotness Change-Id: I127d2930f2714574f7aced63330ce13da37231c0
2019-11-13Move ICU.toLower/UpperCase into external/icuVictor Chang
Bug: 138994281 Test: m droid Change-Id: I18b8058fa4d174d8e1c1e813dad739ec7d1ce3fe
2019-09-24Add TEST_MAPPINGs for miscellaneous libcore packages.Pete Gillin
This adds package-level mappings for libcore.*, sun.*, android.system, dalvik.system, and org.json. Test: treehugger Bug: 130283485 Change-Id: I4f82d1fe316d4d0ac76951c43bdc08c69336a252
2019-09-13Add obsoleteClass field to ClassExtAlex Light
This field is used to keep track of Class objects that have been made obsolete by structural class redefinition. They must be kept live and accessible to preserve JIT invariants around code liveness and to ensure we can continue to access their dex-caches for obsolete methods. Test: ./test.py --host --all-compiler Bug: 140891089 Change-Id: I0ce309f479c42b56b543339654e2cc49c917bce5
2019-08-30Add TEST_MAPPINGs for java.lang and java.util and subpackages.Pete Gillin
This adds package-level mappings to the appropriate test packages. There are a few special cases, such as running the JSR166 tests for java.util.concurrent. Test: treehugger Bug: 130283485 Change-Id: I0a8494845ee298f6293277fdcc1e6dad120f4e58
2019-08-08Merge "Add VMRuntime.bootCompleted()"Nicolas Geoffray
2019-08-08Merge "Teach ART that the "arm64-v8a-hwasan" ABI uses the arm64 instruction ↵Treehugger Robot
set."
2019-08-06Add VMRuntime.bootCompleted()David Srbecky
Needed for jit-zygote performance improvements. Test: device boots Bug: 119800099 Change-Id: If62f022fdd316535a1242eb861c91b191eb8f778
2019-07-31Teach ART that the "arm64-v8a-hwasan" ABI uses the arm64 instruction set.Peter Collingbourne
Bug: 132905502 Bug: 133242086 Change-Id: If6de33758bb2155d14207c02c11dad8d75b64b0d
2019-07-01Merge "Add publicAlternatives for setTargetSdkVersion."Mathew Inwood
2019-06-28Add publicAlternatives for setTargetSdkVersion.Mathew Inwood
Use of this API would allow bypassing of all API greylist enforcement and invalidates other policies. App should use the official manifest API instead. Bug: 136102585 Test: m, inspect out/soong/hiddenapi/hiddenapi-flags.csv Change-Id: I3d1b88a02e5d28cb6ea47f11ce76f999ba401a15
2019-06-27Revert^2 "Add JNI-ids arrays to ClassExt"Alex Light
This reverts commit d9888496eb1cc5687a2c6e428df62427a800ca14. This unreverts commit b79c6d4b45 Reason for revert: Fixed issue causing 004 flakes on debuggable Test: ./test.py --host --debuggable --jit Bug: 134162467 Change-Id: If0d6483a9c7801b88e5cec1160a5e5cbd2c6b93c
2019-06-27Revert "Add JNI-ids arrays to ClassExt"Nicolas Geoffray
This reverts commit b79c6d4b4505c0ec3d070107f8883775f9c11726. Bug: 134162467 Reason for revert: Fails debuggable Change-Id: I8180737dbf9d22c4b1456a2cfe9143219cde346e
2019-06-24Add JNI-ids arrays to ClassExtAlex Light
We want to be able to track JNI ids using fields in class-ext. Add the fields to the class. Test: ./art/test.py --host --index-ids Bug: 134162467 Change-Id: Ifbe5496824b25a615336352f93d16963830deba5
2019-04-03Add VMRuntime.setProcessDataDirectoryDavid Brazdil
Add a core platform API that will be used by the framework to pass down the full path to app's data directory. ART will cache verification data into that folder. Test: compiles, boots Bug: 72131483 Change-Id: Ibe382b49dc5b9a6b96f9ba53559220b551975b79
2019-03-29Use new -XX:FinalizerTimeoutMs command line argHans Boehm
Make it available via VMRuntime, and use it in FinalizerTimeoutDaemon. Partially work around the fact that some apps know about the old static final field specifying the timeout. Bug: 129350738 Bug: 68792448 Test: Boot AOSP, TreeHugger Change-Id: I1849cedd3d17dbc78556f78f849c76cb7792dae5
2019-03-14Change registerNativeAllocation to long argumentHans Boehm
Bug: 128423826 Test: AOSP boot and TreeHugger Change-Id: If6d984a6bc13d2ba85c1dd86ceffc556c8c938d3
2019-03-12Merge "Allow size for malloc-only registration"Hans Boehm
2019-03-12Allow size for malloc-only registrationHans Boehm
Encode malloc-only allocations with an odd size field. These are treated similarly to the prior treatment of zero size objects, except that: - Huge allocations cause more frequent mallinfo() checks. - The sizes are stored, and hence available to ahat and friends. Add public factory methods to hide the negative size representation and provide a slightly easier-to-describe-and-use API. Add registerNativeAllocation(long) and registerNativeFree(long) methods to VMRuntime to avoid enshrining the obsolete ones in the platform API. Unfortunately we need to retain the old ones for compatibility, at least for now. See also ag/6235934 . Bug: 121304803 Test: build and boot AOSP Change-Id: Idccb8b50d26c8c3e93cc34040d784f74dfcdbf51
2019-03-07Add callback for notifying that startup is completedMathieu Chartier
Add a callback that can be called to denote that application startup is completed. This may affect how the profile is collected and how startup related caches are managed. Bug: 123377072 Bug: 120671223 Test: test-art-host Change-Id: Ia317627614566c3060e3c2e246bfb01f6b4f750a
2019-02-21Revert^2 "Mark threads started by Daemons.java as systemDaemon"Alex Light
This reverts commit 07cfc3f74a422d9725cca0ad32915709a3b37862. Reason for revert: Fixed flake with test 1919 Test: ./art/test.py --host -j80 Bug: 123696564 Bug: 124284724 Change-Id: I958a48ebfe2e3989bd855fc4abe12cec56bf9df5
2019-02-21Merge "Revert "Mark threads started by Daemons.java as systemDaemon""Nicolas Geoffray
2019-02-21Revert "Mark threads started by Daemons.java as systemDaemon"Nicolas Geoffray
This reverts commit 89b46205a8be6a2cf6264c066290ed29ef8a2d61. Bug: 123696564 Bug: 124284724 Reason for revert: b/124284724 Change-Id: I059e914d09187cbcf81ce5b077090f853f7e9e6b
2019-02-20Pass sampled value to hidden api loggerAndrei Onea
The logger will use the sampled value to select the logging method to be used. Test: m Bug: 119217680 (cherry picked from commit c46991d2b3b13889bef3b0e91662c8cbd7d0ce4f) Change-Id: If58442275b6936a56b5ae25f1e80654a567dc953 Merged-In: If9fce9a254eb0d2952e9b68ead658c2f096dbab9
2019-02-18Blacklist VMRuntime.setTargetSdkVersion()David Brazdil
Enabling apps to overwrite their target SDK version in the runtime is undersirable as it may allow them to access APIs in greylists intended for legacy apps only, e.g. an app targeting Q accessing greylist-max-o. Move the setter in VMRuntime to blacklist. API usage data shows very limited affect of this change. Test: n/a Change-Id: I52de53c208894fae15edde19a92efb60f86100f0
2019-02-11Mark threads started by Daemons.java as systemDaemonAlex Light
The threads started by Daemons.java are special daemon threads that provide important GC related functionality to the runtime. As such the runtime sometimes needs to keep track of which threads these are. This adds support for keeping track of that data. Also give a way for the runtime to wait for all Daemon threads to come up. Test: while atest CtsJdwpTestCases; do; done; Exempt-From-Owner-Approval: Previous version approved by nfuller@ with only minor nit changes. Bypassing further owner review since all owners are currently in LON. Bug: 123696564 Change-Id: Ia70da0b4d11409930bef47e4d06359b0d612c8fa
2019-01-30Allow hidden api usage logging with VMRuntimeAndrei Onea
Added HiddenApiUsage interface, a static setter, and two static methods which forward the hidden api usage events to the logger (for access via JNI and via reflection) Topic: hidden-api-reporting-upcall Test: m Bug: 119217680 Change-Id: I0185ebda779f9df3d4186806a6696b063847ad1c Merged-In: Ia2f154f4649c5f0c22c55e6a12c0399a5912deb8
2019-01-24Remove hardcoded os.name property.Doug Horn
5c9406fb hardcoded "linux" as the value for the os.name property on Android. Because we will now support additional device OSs, this value is no longer static. Reverting back to dynamically querying os.name will regress compile-time initialization for AbstractDatagramSocket. Analysis of this is tracked in b/121268567. Bug: 119271070 Bug: 117987577 Bug: 28174137 Test: Verify os.name keys to the proper underlying OS. Change-Id: I233e87b56b6e5513aab31ef68e1b2afbcd238fc8
2018-12-12Adjust NativeAllocationRegistry for new accountingHans Boehm
Provide a new NativeAllocationRegistry constructor that does not require a size, assuming instead that all native allocation goes through malloc() and the GC tracks native allocation anyway. Use it in BigInt, Pattern, and Matcher, the traditional problem cases for proper size tracking. We should use it in many other cases as well. The fact that we're not yet doing so has the effect that we're currently double-counting some allocations. However a mere factor of 2 error is likely to be a huge improvement already over prior accounting. Force the argument to setTargetHeapUtilization to be at least 0.1. Very small numbers are not reasonable, and could cause overflows in ART. (Needed by accounting cleanups in the companion ART CL.) Bug: 111447610 Test: atest NativeAllocationRegistryTest (option 2) Test: Built and booted AOSP. Ran 175-alloc-big-bignums. Change-Id: Iad76e1efe0849ddf03834571f71a00e684e82858
2018-12-03Add fields to ClassExt to store pre-redefine DexFile pointerDavid Brazdil
Hidden API access checks refer to the dex file of a class to read the access flags of a given method/field. The pointer to the dex file is lost when the class is redefined with JVMTI. Add two fields to ClassExt which will preserve the DexFile pointer and ClassDef index of the redefined class. Bug: 119688837 Test: m test-art Change-Id: I4808a9bd9f9d29849a342355de6369fbce969b87
2018-11-28Add stubs for remaining libcore classes in hiddenapiPaul Duffin
Additional libcore classes and methods have been added to the hiddenapi since the last time stubs were added. This change adds stubs and annotations for them all. This was tested by making and then manually checking that the generated out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt was the same (after sorting) before and after this change. Test: see above Bug: 117818301 Change-Id: Ie860cc92a029b21d8ac0e75245a3b6d4de63199f
2018-11-22Add missing default constructorsPaul Duffin
Metalava was accidentally including default constructors in the API generated for CorePlatformApi and IntraCoreApi annotations. This change adds the constructor and appropriate annotations to allow the metalava bug to be fixed without changing the API. Tested by building the API with and without the Metalava fix and checking that they were the same apart from removing the constructors for the following classes as they are not required in the API because the classes are never meant to be instantiated: * dalvik.system.VMSTack * libcore.icu.ICU * libcore.io.DropBox * libcore.io.EventLogger * libcore.net.MimeUtils * libcore.util.SneakyThrow Bug: 119859108 Test: see above Change-Id: I87cdb60827edbc2703b9b8723e873aa49c82d9cf
2018-11-01Remove unused method in VMRuntimeDavid Brazdil
Hidden API toasts have been removed. That makes VMRuntime.hasUsedHiddenApi() obsolete. Test: m Change-Id: Iabddcb809be524f0cc0738b2dfcef5c752afe2bc
2018-10-30Add pre resolved strings fieldsMathieu Chartier
Fields used by ART internally. Test: test-art-host Bug: 116059983 Change-Id: Ie2b31557e806f627f643ae08d8b6b1619379973b
2018-10-18Add @UnsupportedAppUsage to non-ojluni classesPaul Duffin
Test: ensured that generated light grey list did not change Bug: 117818301 Merged-In: Ifcdd4c815a2d8fc438290a5b3b9db669f5035145 Change-Id: I6bd92384b4c81d425961d0f9ef4b681271e36125
2018-10-10Libcore: Add VMRuntime.hasBootImageSpacesAndreas Gampe
Expose to the system whether ART is using a boot image. Test: m Test: system boots Change-Id: I087c269dd1e95eeeab5db4250133f9c61e9399c7
2018-10-05More @CorePlatformApi annotations for libcoreNeil Fuller
These annotations are required for further targets to build. Bug: 113148576 Test: build Change-Id: I695c6b973835b5de2311e0ed99cb2fb55b69bc94