summaryrefslogtreecommitdiff
path: root/dalvik
AgeCommit message (Collapse)Author
2021-09-27Rename nativeZygoteJitEnabledHans Boehm
... to nativeZygoteLongSuspendOk to reflect its changed semantics. Bug: 192020504 Test: Boot and look at log with both options Change-Id: Id8cf5f5b9924c34ff578bf19f53fee1561f7dda6
2021-09-27Add Zygotehooks.indefiniteThreadSuspensionOKHans Boehm
Bug: 159631815 Bug: 174211442 Test: Boot AOSP with zygote that needs this Change-Id: I5f0626a74e43c8b1ac69164ce64b625f0654a7e2
2020-06-25Pass in callsite of SurfaceControl constructor explicitly (2/3)Jorim Jaggi
Creating a new Throwable (and filling in the stack trace) can take up to 150us. Since we do this on the critical path when sending over SurfaceControl via binder multiple times, this is too much. Instead, add an option to pass in callsite manually. stackAndTrackingEnabled is usually disabled on -user builds, however, all our performance tests and dogfooding happens on -userdebug builds for which this is enabled, so it needs to be fast. Test: RelayoutPerfTest Bug: 159056748 Change-Id: Id6575745618eed5ab4aa4937b82b8dbad4978844
2020-04-22Merge "Preload zone rules in zygote hook" into rvc-devTreeHugger Robot
2020-04-01Preload zone rules in zygote hookNikita Iashchenko
Call ICU's TimeZone.getDefault() to explicitly load current time-zone rules into zygote to improve app startup time. This is the second attempt to submit this CL. The first attempt was https://r.android.com/1255687, which accidentally used java.util's TimeZone. Bug: 150605074 Test: m droid Test: (adb shell) simpleperf record -p `pidof zygote64` -g --post-unwind=yes -f 10000 Collected profile, started apps: Messages, Calls, Browser and Camera; no generateZoneRules() call in profile found. Change-Id: Ieba87f7235b9e6d2adc602f221537192839a42f6 Merged-In: Ieba87f7235b9e6d2adc602f221537192839a42f6 (cherry picked from commit 4cbb52fd7b30859794714606e8a08a238519cc4c)
2020-03-27Open access to reportClassLoaderChain as CorePlatformAPICalin Juravle
This is needed to support system server classpath reporting. SystemServer class loader is constructed before we can install a reporter. As such, we need a way to report the existing classpath after the class loader is constructed. Test: m Bug: 148774920 Change-Id: Ice170bfd093ece643425695e2afbd6f2af675614
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-18Reland "Fix shared libraries not being reported"Calin Juravle
Original commit: This CL topic fixes shared libraries not being reporter via Reporter. This particular CL changes the BaseDexClassLoader.Reporter interface to report ClassLoader context strings rather than ClassLoader instances. These ClassLoader context strings are computed directly by the runtime (see the changes within art in the same topic). Test: atest libcore.dalvik.system.BaseDexClassLoaderTest Bug: 148494302 Reason for revert: Re-land Reverted Changes: I295a6e99e:Revert "Fix shared libraries not being reported vi... Ib58066e8f:Revert "[DexLoadReporter] Report classloader conte... Change-Id: I63db10d85c3316dd9f08c0d75ab34dd3f1b62d28
2020-02-15Revert "Fix shared libraries not being reported via Reporter"Nicolas Geoffray
Revert submission 1198456-slclc Reason for revert: Fails on luci: https://ci.chromium.org/p/art/builders/ci/host-x86_64-cdex-fast/3123 Bug: 148494302 Reverted Changes: I46d8d9105: Fix shared libraries not being reported via Report... I00357cfe0: [DexLoadReporter] Report classloader contexts dire... Change-Id: I295a6e99e58d5b953cb9b91bf55c2ea654de8612
2020-02-13Fix shared libraries not being reported via ReporterDan Zimmerman
This CL topic fixes shared libraries not being reporter via Reporter. This particular CL changes the BaseDexClassLoader.Reporter interface to report ClassLoader context strings rather than ClassLoader instances. These ClassLoader context strings are computed directly by the runtime (see the changes within art in the same topic). Test: atest libcore.dalvik.system.BaseDexClassLoaderTest Bug: 148494302 Change-Id: I46d8d9105bbdefdd058711b74a841500671cc050
2020-02-07Introduce BaseDexClassLoader#computeClassLoaderContextsNativeDan Zimmerman
This CL exposes the JNI call introduced in art. See the associated change in art for more info. Test: atest libcore.dalvik.system.BaseDexClassLoaderTest Bug: 148494302 Change-Id: I460a9f72dca48b6bc00405ceb11f8efba38505bf
2020-01-23Remove unused UnsupportedAppUsage annotations.Artur Satayev
The new annotation is android.compat.annotation.UnsupportedAppUsage. Test: m Bug: 145132366 Change-Id: Ie13cce08e6d0a7c15427d2c3fc7d4b4d395acedc
2020-01-16Use ThreadPrioritySetter to set thread priorityRick Yiu
Use ThreadPrioritySetter registered in Android runtime to set thread priority. Bug: 139521784 Test: CtsLibcoreTestCases, device boot to home, thread priority set as expected. Change-Id: I46093c9539be3acca9ca580a1e88676bdfd2de54
2020-01-13Merge "Revert "Libcore: Improve BaseDexClassLoader.toString""Treehugger Robot
2020-01-10Revert "Libcore: Improve BaseDexClassLoader.toString"Orion Hodson
This reverts commit 100fd826ec84a287719121fb6412156f0dfd2a53. Reason for revert: Leads to infinite recursion in some apps (http://b/147481074) Change-Id: If0137da17fc24ceb94dc378554651d68b4a25ae9 Bug: 147481074
2020-01-08Revert "Use ThreadPrioritySetter to set thread priority"Rick Yiu
Revert "Implement the ThreadPrioritySetter interface" Revert submission 1194951-ThreadPrioritySetter2 Reason for revert: need to update new API Reverted Changes: Iee33a26c0: Implement the ThreadPrioritySetter interface I71c5052be: Use ThreadPrioritySetter to set thread priority Change-Id: I98cb32d5d216a83634d38406f574ee76e77daa97
2020-01-03Use ThreadPrioritySetter to set thread priorityRick Yiu
Use ThreadPrioritySetter registered in Android runtime to set thread priority. Bug: 139521784 Test: CtsLibcoreTestCases, device boot to home, thread priority set as expected. Change-Id: I71c5052beb171f966eba97401159306b87e397b7
2019-12-30[libcore][DexPathList] Ensure dexElements doesn't contain null entries in ↵Dan Zimmerman
addDexPath Previously it was possible for dexElements to be mid-transaction when a class load occurs (on a separate thread). In practice this displayed itself as CNFE and various SEGFAULTs in places of the VM that don't protect against NULL dexElements. In order to combat this issue, lets compute the final dexElements Array in a local variable and then atomically set the dexElements instance variable once the computation is complete. I applied the same patch to suppressed exceptions for good measure. A TODO for a follow up commit would be to introduce barriers to ensure coherency across threads. Test: atest ./luni/src/test/java/libcore/dalvik/system/ Bug: https://issuetracker.google.com/issues/146447053 Bug: 146533113 Change-Id: I295f20425b406d900b75e5a1bb97725fe9964128
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-12-09Fix MethodHandles.explicitCastArguments for transformsOrion Hodson
Fixes incorrectly handled paths in ExplicitCastArguments transform. Update MethodHandles.explicitCaseArguments() to use an ExplicitCastArguments transform if the call requires asType() conversion. We could have introduced another transform, but that's more code and before inserting the transform the code checks the explicit cast is equivalent to asType(). The transformer path had issues because StackFrame{Reader,Writer} classes do not perform asType() conversions as they read and write stack frame locations. Bug: 113855305 Test: art/test/testrunner.py --host --64 Test: art/tools/run-libcore-tests.sh --host Change-Id: I712bcf5a55f1f7c091af5daddeb3f8a5b7b5b4d3
2019-12-02Add overrideSourcePosition to UnsupportedAppUsage.Mathew Inwood
This allows tools to know the original source position of the annotation in cases where the java code is generated. It will be populated by the AIDL compiler. Bug: 145120552 Test: m Change-Id: Ie5c1108ccb8417195f09d1ed61be4ce1f1c2282d
2019-11-25Pass runtimeFlags to postForkSystemServerMathieu Chartier
Flags are now required by ART. (cherry-picked from commit 9bc5d9e87ade8a14982a8c47a5858155a09caf61) Bug: 139883463 Bug: 144383344 Test: showmap `pid system_server` and verify Test: atest BootImageProfileTest Merged-In: I6fb876577328229cc1ccb2ca63019328892f192e Change-Id: I6fb876577328229cc1ccb2ca63019328892f192e
2019-11-08Don't change the behavior of findLibraryJiyong Park
8f712189dfc02285573337e2b4ab17678011db14 chaged the behavior of BaseDexClassLoader.findLibrary (to be specific any classloader that uses DexPathList). findLibrary no longer returns null even when the requested library isn't found in the native search path of the classloader (because it could be loadable via namespace links even when it's not in the search paths). However, it looks like this is breaking some apps. To minimize the app compat problem, findLibrary() returns its original behavior of returning null when the library is not found. Instead, the RuntimeClass is modified to have a special case for handling the null return from PathClassLoader. Bug: 143649498 Bug: 109720125 Test: run the app that was mentioned in 143649498 Change-Id: I445592b57c62782b62a1adceb4fb4f5a016d65ee
2019-10-30[jitzygote] Notify post fork to the runtime before creating new threads.Nicolas Geoffray
Allows the runtime to run code single-threaded post fork. Bug: 143569713 Bug: 119800099 Test: boots Change-Id: I3c1be4fca007e068eda168fc8a0ee3e388f73113
2019-10-24Merge "Fix docs to be clearer and more maintainable"Neil Fuller
2019-10-21Move dalvik.system.VersionCodes to dalvik.annotation.compatPaul Duffin
Avoids splitting packages that are part of java.base. Removes patch_module: "java.base" that was used to work around this issue. Bug: 143057012 Test: m checkbuild Change-Id: Iad65343fd3fde55f2d3b0e68c4bbcd51377d85d9
2019-10-18Fix docs to be clearer and more maintainableNeil Fuller
The mention of P in the doc was unclear. Also, listing the specific values allowed is a maintenance issue. Test: None Change-Id: I1acacc0360cc15b4600bcbbc3a6b2648eb1e9e26
2019-10-11Move native code of ICU4C regex usage into external/icuVictor Chang
- The C++ codes are not ABI-stable. This CL moves the interface between codes in the ART module and i18n module from C++ to Java. - Expose NativeAllocationRegistry, ReachabilitySensitive as @IntraCoreApi. NativeAllocationRegistry is already CorePlatformApi which needs to be stable in the future. It should not cost too much extra to maintain. Bug: 138994281 Test: atest --test-mapping libcore/ojluni/src/main/java/java/util/regex:postsubmit Change-Id: I4caffd5b746ce501b0de252a0a8e4f815ace0a66
2019-10-07Clarify restrictions of @FastNative methodsDaniel Colascione
Test: comment text parses as English Change-Id: I0d1f73dab3f1a3912936aae52765603b738c69c1
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-20Merge "Add @CovariantReturnType annotation to @CorePlatformApi."Treehugger Robot
2019-09-10Don't give up when loader.findLibrary() failsJiyong Park
When System.loadLibrary(libname) is called, the library file for the libname is searched in the native library paths set to the current classloader. Previously, if the search was failed, actual loading of the lib was not attempted at all. This however is too restrictive in Android where the dynamic linker that actually is responsible for finding and loading libraries has a concept of linker namespaces. With linker namespaces, whether a library can be loaded or not is not simply determined by checking whether the lib is found in one of the library search paths. A lib can be loaded also when there is a link from the current linker namespace to another linker namespace with the library's soname specified over the link. In that case, the library is searched in the search paths of the target linker namespace. So, a failure of loader.findLibrary() doesn't necessary mean that the library is never loadable. This caused a problem like b/93333337, which required us to do the non-trivial ad-hoc change: cfe38cdb1cc45c8b7dcbe4f39329551f6602b9ce in frameworks/base. In this change, even when loader.findLibrary() fails, we try to load the library with its soname, not with the absolute file path. Bug: 109720125 Test: System.loadLibrary("adsprpc") is successful in Pixel (because libadsprpc.so is in Pixel's vendor public lib list) Test: atest cts/tests/tests/jni Merged-In: Ia2525e736f91460a50f2def3d6a04bf3cf8c221d (cherry picked from commit 8f712189dfc02285573337e2b4ab17678011db14) Change-Id: Ia2525e736f91460a50f2def3d6a04bf3cf8c221d
2019-08-20Add @CovariantReturnType annotation to @CorePlatformApi.Tobias Thierer
The annotation tells the build toolchain to generate a synthetic method overload that returns a different type, which is useful to evolve an API to change its return type to become a more specific sub-type. Note that a CTS test is needed to verify that each expected overload is present at runtime. Also, note that this CL also adds the nested annotation @CovariantReturnTypes and its values() function to the @CorePlatformApi because it is required by @Repeated. For an existing example, see http://r.android.com/884453 (commit d708f23a17ac382fde8ddda029430cf88821621f). Test: Treehugger Fixes: 139739718 Change-Id: I056074b0c3e741696636182ce70ebbe088aefc9e
2019-07-10Libcore: Improve BaseDexClassLoader.toStringAndreas Gampe
Print parent and shared libraries. Test: m Test: atest CtsLibcoreTestCases Change-Id: Iebd6943ab317f151cdf0f40a63e39367cbc880ef
2019-07-02Add trackingBug to heavily used CloseGuard APIs.Mathew Inwood
These APIs are used by okhttp which results in usage by a large number of apps. It's unclear if okhttp is the only user of these APIs. See also: https://github.com/square/okhttp/issues/3980 Bug: 111170242 Test: m Change-Id: Ic84d417594a7b530292756527f5ea97d9f6b3c85
2019-05-10Add publicAlternatives to @UnsupportedAppUsageAndrei Onea
Add a new field to UnsupportedAppUsage, to allow specifying public API alternatives to hidden APIs. Bug: 130721457 Test: m Change-Id: I0f793ecc2fba81c47e3ae6ea16adaaf183098b0d
2019-05-01Add VersionCodes.QDavid Brazdil
So as to support @UnsupportedAppUsage(maxTargetSdk=Q), add "Q" field into the VersionCodes class. Test: n/a Change-Id: I014665578aec80089fe1d776c31c92916d46450e
2019-04-02Adjust in-memory dex loading logic when backed by oatDavid Brazdil
So as to initialize an OatFile object backing in-memory dex files loaded with InMemoryDexClassLoader, openInMemoryDexFiles needs to be passed the current class loader context (class loader + dex elements). It is also unnecessary to spawn the verification background thread if the DexFile is backed by an oat. Skip it in that case. Bug: 72131483 Test: art/tools/run-libcore-tests.sh Test: art/test.py -b -r -t 692 -t 693 Change-Id: I0242902b8744084aca05d82144da84e637e872e5
2019-04-01Provide class loader context to DexFile.verifyInBackgroundDavid Brazdil
The vdex file generated by a background verification thread for bytecode loaded with InMemoryDexClassLoader needs to store a class loader context. However, to be able to resolve the loaded classes, the verifier needs to be called after the DexPathList element has been initialized. But its initialization changes the class loader context compared to the point where the vdex will be loaded to back an oat file, which has to be before the DexPathList element is initialized. To this end, obtain the class loader before element init and pass it to verifyInBackground() after the init. Bug: 72131483 Test: art/tools/run-libcore-tests.sh Test: art/test.py -b -r -t 692 -t 693 Change-Id: I52a6a5b064bbc211aee8231e7ab5523746dc4591
2019-04-01Revert^2: Spawn background verification for InMemoryDexClassLoaderDavid Brazdil
After dex files have been loaded with InMemoryDexClassLoader, call DexFile.verifyInBackground which instructs ART to spawn a background thread and verify all newly loaded classes. This thread will be used for creating a vdex file to speed up subsequent loads of the same bytecode. This reverts commit f501b1226e786d1eedb638fa0292970827f4343a. Bug: 72131483 Change-Id: I46cd8f854642ff3d30d3b595ffa035aeb6f2c8ec Test: art/tools/run-libcore-tests.sh Test: art/test.py -b -r -t 692
2019-04-01Merge "Revert "Spawn background verification for InMemoryDexClassLoader""David Brazdil
2019-04-01Revert "Spawn background verification for InMemoryDexClassLoader"David Brazdil
This reverts commit 35935a560e9842baa4b3f4f5b6255a799d14d440. Reason for revert: art buildbots crashing Change-Id: I0d484df261f33ebc00df81ac971ab04bdaf0180f
2019-04-01Merge "Spawn background verification for InMemoryDexClassLoader"David Brazdil
2019-03-29Add VMDebug.setAllocTrackerStackDepth APIMathieu Chartier
Sets the number of frames recorded for each allocation when allocation tracking is enabled. Test: test-art-host Bug: 37291459 Change-Id: I5d884efd798588c1ca684567d865f9acf81455a5
2019-03-28Spawn background verification for InMemoryDexClassLoaderDavid Brazdil
After dex files have been loaded with InMemoryDexClassLoader, call DexFile.verifyInBackground which instructs ART to spawn a background thread and verify all newly loaded classes. This thread will be used for creating a vdex file to speed up subsequent loads of the same bytecode. Bug: 72131483 Test: art/tools/run-libcore-tests.sh Test: art/test.py -b -r -t 692 Change-Id: I1de0cca3e7e4739cd5f1929d66c53a538067b8e5
2019-03-21Load in-memory dex into a single DexFile/Element objectDavid Brazdil
InMemoryDexClassLoader only accepts ByteBuffers containing dex files, not apks. Loading dex files in a multidex fashion is therefore impossible as each ByteBuffer is loaded into its own Element/DexFile object. This has not been an issue so far because dex files loaded with InMemoryDexClassLoader are never optimized or backed by an oat file, and the first time a class can be resolved is after the whole class loader class path has been initialized. Refactor this now because introduction of a vdex backing the dex files changes this. It is also convenient to generate just one vdex per class loader than one vdex per ByteBuffer. The original makeInMemoryDexElements() method is left unused after the refactor but it is known to be in use by 3p apps. Leave it there are add a test to make sure it continues to work. Bug: 72131483 Test: art/tools/run-libcore-tests.sh Change-Id: I618b286951861b3ff9a4622599244b6f5c8b4bc3
2019-03-08Add Nullable annotations to DelegateLastClassLoader new API.Nicolas Geoffray
Bug: 126703375 Test: m Change-Id: I38408f90602f8826fcbc885e68385e7aa8cad8f3
2019-02-04Move CLIENT_PROTOCOL_VERSION to point of useOrion Hodson
Moves DDMS protocol version to client code in frameworks which implements the protocol. ART and libcore are responsible for transport. Bug: b/119742461 Test: m -j100 checkbuild Change-Id: I5442ad99df1f952cbdcf7cc184a18b11e8bbe619
2019-01-29Make the ZygoteHooks API more consistentNeil Fuller
Make the ZygoteHooks API more consistent by making the API entirely "static". Bug: 111742291 Test: build / boot / treehugger Merged-In: Ide38a9640a4d9f7a7621b8405a9732573f7420cf Change-Id: Ide38a9640a4d9f7a7621b8405a9732573f7420cf
2019-01-28Merge "Add DeadReferenceSafe annotation"Hans Boehm