kCollectorTypeHomogeneousSpaceCompact,
// Class linker fake collector.
kCollectorTypeClassLinker,
+ // JIT Code cache fake collector.
+ kCollectorTypeJitCodeCache,
};
std::ostream& operator<<(std::ostream& os, const CollectorType& collector_type);
case kGcCauseInstrumentation: return "Instrumentation";
case kGcCauseAddRemoveAppImageSpace: return "AddRemoveAppImageSpace";
case kGcCauseClassLinker: return "ClassLinker";
+ case kGcCauseJitCodeCache: return "JitCodeCache";
default:
LOG(FATAL) << "Unreachable";
UNREACHABLE();
kGcCauseHomogeneousSpaceCompact,
// Class linker cause, used to guard filling art methods with special values.
kGcCauseClassLinker,
+ // Not a real GC cause, used to implement exclusion between code cache metadata and GC.
+ kGcCauseJitCodeCache,
};
const char* PrettyCause(GcCause cause);
}
// It's time to clear all inline caches, in case some classes can be unloaded.
- if ((gc_type == collector::kGcTypeFull) && (runtime->GetJit() != nullptr)) {
+ if (((gc_type == collector::kGcTypeFull) || (gc_type == collector::kGcTypePartial)) &&
+ (runtime->GetJit() != nullptr)) {
runtime->GetJit()->GetCodeCache()->ClearGcRootsInInlineCaches(self);
}
#include "debugger_interface.h"
#include "entrypoints/runtime_asm_entrypoints.h"
#include "gc/accounting/bitmap-inl.h"
+#include "gc/scoped_gc_critical_section.h"
#include "jit/jit.h"
#include "jit/profiling_info.h"
#include "linear_alloc.h"
RemoveUnmarkedCode(self);
if (collect_profiling_info) {
+ ScopedThreadSuspension sts(self, kSuspended);
+ gc::ScopedGCCriticalSection gcs(
+ self, gc::kGcCauseJitCodeCache, gc::kCollectorTypeJitCodeCache);
MutexLock mu(self, lock_);
// Free all profiling infos of methods not compiled nor being compiled.
auto profiling_kept_end = std::remove_if(profiling_infos_.begin(), profiling_infos_.end(),
SHARED_REQUIRES(Locks::mutator_lock_);
bool CheckLiveCompiledCodeHasProfilingInfo()
- REQUIRES(lock_)
- SHARED_REQUIRES(Locks::mutator_lock_);
+ REQUIRES(lock_);
void FreeCode(uint8_t* code) REQUIRES(lock_);
uint8_t* AllocateCode(size_t code_size) REQUIRES(lock_);