diff options
author | 2017-11-30 16:16:07 +0000 | |
---|---|---|
committer | 2017-11-30 16:20:39 +0000 | |
commit | 2196c651ecc77e49992c6c329dfce45f78ff46cb (patch) | |
tree | 4eb151632fc7b851101b4264286ce5e900fa06b5 /runtime/jit/jit_code_cache.h | |
parent | dc93cac66f1db225474cec5bf0350fd7a148085e (diff) |
Revert^4 "JIT JNI stubs."
The original CL,
https://android-review.googlesource.com/513417 ,
has a bug fixed in the Revert^2,
https://android-review.googlesource.com/550579 ,
and this Revert^4 adds two more fixes:
- fix obsolete native method getting interpreter
entrypoint in 980-redefine-object,
- fix random JIT GC flakiness in 667-jit-jni-stub.
Test: testrunner.py --host --prebuild --no-relocate \
--no-image --jit -t 980-redefine-object
Bug: 65574695
Bug: 69843562
This reverts commit 056d7756152bb3ced81dd57781be5028428ce2bd.
Change-Id: Ic778686168b90e29816fd526e23141dcbe5ea880
Diffstat (limited to 'runtime/jit/jit_code_cache.h')
-rw-r--r-- | runtime/jit/jit_code_cache.h | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h index 46a408590b..fc011ddb96 100644 --- a/runtime/jit/jit_code_cache.h +++ b/runtime/jit/jit_code_cache.h @@ -35,9 +35,23 @@ template<class T> class Handle; class LinearAlloc; class InlineCache; class IsMarkedVisitor; +class JitJniStubTestHelper; class OatQuickMethodHeader; struct ProfileMethodInfo; class ProfilingInfo; +class Thread; + +namespace gc { +namespace accounting { +template<size_t kAlignment> class MemoryRangeBitmap; +} // namespace accounting +} // namespace gc + +namespace mirror { +class Class; +class Object; +template<class T> class ObjectArray; +} // namespace mirror namespace gc { namespace accounting { @@ -137,6 +151,9 @@ class JitCodeCache { // Return true if the code cache contains this method. bool ContainsMethod(ArtMethod* method) REQUIRES(!lock_); + // Return the code pointer for a JNI-compiled stub if the method is in the cache, null otherwise. + const void* GetJniStubCode(ArtMethod* method) REQUIRES(!lock_); + // Allocate a region of data that contain `size` bytes, and potentially space // for storing `number_of_roots` roots. Returns null if there is no more room. // Return the number of bytes allocated. @@ -160,11 +177,6 @@ class JitCodeCache { return live_bitmap_.get(); } - // Return whether we should do a full collection given the current state of the cache. - bool ShouldDoFullCollection() - REQUIRES(lock_) - REQUIRES_SHARED(Locks::mutator_lock_); - // Perform a collection on the code cache. void GarbageCollectCache(Thread* self) REQUIRES(!lock_) @@ -296,6 +308,12 @@ class JitCodeCache { REQUIRES(!lock_) REQUIRES(!Locks::cha_lock_); + // Removes method from the cache. The caller must ensure that all threads + // are suspended and the method should not be in any thread's stack. + bool RemoveMethodLocked(ArtMethod* method, bool release_memory) + REQUIRES(lock_) + REQUIRES(Locks::mutator_lock_); + // Free in the mspace allocations for `code_ptr`. void FreeCode(const void* code_ptr) REQUIRES(lock_); @@ -315,6 +333,11 @@ class JitCodeCache { // Set the footprint limit of the code cache. void SetFootprintLimit(size_t new_footprint) REQUIRES(lock_); + // Return whether we should do a full collection given the current state of the cache. + bool ShouldDoFullCollection() + REQUIRES(lock_) + REQUIRES_SHARED(Locks::mutator_lock_); + void DoCollection(Thread* self, bool collect_profiling_info) REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); @@ -341,6 +364,9 @@ class JitCodeCache { REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); + class JniStubKey; + class JniStubData; + // Lock for guarding allocations, collections, and the method_code_map_. Mutex lock_; // Condition to wait on during collection. @@ -357,6 +383,8 @@ class JitCodeCache { void* data_mspace_ GUARDED_BY(lock_); // Bitmap for collecting code and data. std::unique_ptr<CodeCacheBitmap> live_bitmap_; + // Holds compiled code associated with the shorty for a JNI stub. + SafeMap<JniStubKey, JniStubData> jni_stubs_map_ GUARDED_BY(lock_); // Holds compiled code associated to the ArtMethod. SafeMap<const void*, ArtMethod*> method_code_map_ GUARDED_BY(lock_); // Holds osr compiled code associated to the ArtMethod. @@ -418,6 +446,7 @@ class JitCodeCache { // Condition to wait on for accessing inline caches. ConditionVariable inline_cache_cond_ GUARDED_BY(lock_); + friend class art::JitJniStubTestHelper; DISALLOW_IMPLICIT_CONSTRUCTORS(JitCodeCache); }; |