diff options
author | 2019-12-06 10:49:17 -0800 | |
---|---|---|
committer | 2019-12-10 22:51:35 +0000 | |
commit | abd8f052512fa2bb404f1eb0a42ffe0e5d802b7e (patch) | |
tree | 28bec78b6866aae9713c9eb471680c7aa4fb746b /runtime/class_linker-inl.h | |
parent | 3bdb97798d9a00c498833e00b49927f62b9e7f90 (diff) |
Proactively dequicken on debuggable switch.
Previously we would generally not really consider dex2dex quickening
with debuggable processes. This could cause problems for structural
redefinition since the -quick opcodes are incompatible with the types
of changes structural redefinition allows. Furthermore this can cause
some unexpected behavior where (for example) check-casts might appear
to pass even if debugger activity should cause it to fail.
In order to fix these issues we make the runtime more proactively
dequicken dex-files when we start or switch to JAVA_DEBUGGABLE mode.
Test: ./test.py --target --host
Test: adb install -t ~/misc/Bandhook-Kotlin/app/build/outputs/apk/debug/app-debug.apk && adb shell monkey -p com.antonioleiva.bandhookkotlin -c android.intent.category.LAUNCHER 1
Bug: 134162467
Bug: 144168550
Change-Id: I2673c91b72ae7048d2ff71a1cf68cf552d4e8004
Diffstat (limited to 'runtime/class_linker-inl.h')
-rw-r--r-- | runtime/class_linker-inl.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h index 978b1abbaf..2732de56f7 100644 --- a/runtime/class_linker-inl.h +++ b/runtime/class_linker-inl.h @@ -19,6 +19,7 @@ #include <atomic> +#include "android-base/thread_annotations.h" #include "art_field-inl.h" #include "art_method-inl.h" #include "base/mutex.h" @@ -27,12 +28,14 @@ #include "dex/dex_file_structs.h" #include "gc_root-inl.h" #include "handle_scope-inl.h" +#include "jni/jni_internal.h" #include "mirror/class_loader.h" #include "mirror/dex_cache-inl.h" #include "mirror/iftable.h" #include "mirror/object_array-inl.h" #include "obj_ptr-inl.h" #include "scoped_thread_state_change-inl.h" +#include "well_known_classes.h" namespace art { @@ -449,6 +452,18 @@ inline ObjPtr<mirror::ObjectArray<mirror::Class>> ClassLinker::GetClassRoots() { return class_roots; } +template <typename Visitor> +void ClassLinker::VisitKnownDexFiles(Thread* self, Visitor visitor) { + ReaderMutexLock rmu(self, *Locks::dex_lock_); + std::for_each(dex_caches_.begin(), + dex_caches_.end(), + [&](DexCacheData& dcd) REQUIRES(Locks::mutator_lock_) { + if (dcd.IsValid()) { + visitor(dcd.dex_file); + } + }); +} + } // namespace art #endif // ART_RUNTIME_CLASS_LINKER_INL_H_ |