summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2024-01-30 16:20:23 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2024-02-05 11:00:05 +0000
commitddd9953796c8ea316abd2034d12d2ba843af06fe (patch)
tree7f784cbc8a5936958f3b1ff217045cca9df8d03a
parentc0c012c2e85616540865bf793cc423f5ba42aff3 (diff)
For tests, enqueue JIT compilation instead of doing it on the current thread.
We only support single-threaded writing to the graph visualizer file. So for tests that request JIT compilation of a method, enqueue the compilation instead of doing the compilation on the main thread. Test: test.py Bug: 218263452 Change-Id: I0662e50604b47baf93e94f6e39c59ae99ebc9f82
-rw-r--r--runtime/jit/jit.h4
-rw-r--r--test/common/runtime_state.cc13
2 files changed, 8 insertions, 9 deletions
diff --git a/runtime/jit/jit.h b/runtime/jit/jit.h
index 287b2600a9..b46e92cdbb 100644
--- a/runtime/jit/jit.h
+++ b/runtime/jit/jit.h
@@ -514,9 +514,9 @@ class Jit {
// class path methods.
void NotifyZygoteCompilationDone();
- void EnqueueOptimizedCompilation(ArtMethod* method, Thread* self);
+ EXPORT void EnqueueOptimizedCompilation(ArtMethod* method, Thread* self);
- void MaybeEnqueueCompilation(ArtMethod* method, Thread* self)
+ EXPORT void MaybeEnqueueCompilation(ArtMethod* method, Thread* self)
REQUIRES_SHARED(Locks::mutator_lock_);
private:
diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc
index ff17f64632..36d1a41206 100644
--- a/test/common/runtime_state.cc
+++ b/test/common/runtime_state.cc
@@ -273,16 +273,15 @@ static void ForceJitCompiled(Thread* self,
// Update the code cache to make sure the JIT code does not get deleted.
// Note: this will apply to all JIT compilations.
code_cache->SetGarbageCollectCode(false);
+ if (kind == CompilationKind::kBaseline || jit->GetJitCompiler()->IsBaselineCompiler()) {
+ ScopedObjectAccess soa(self);
+ jit->MaybeEnqueueCompilation(method, self);
+ } else {
+ jit->EnqueueOptimizedCompilation(method, self);
+ }
do {
// Sleep to yield to the compiler thread.
usleep(1000);
- ScopedObjectAccess soa(self);
- // Will either ensure it's compiled or do the compilation itself. We do
- // this before checking if we will execute JIT code in case the request
- // is for an 'optimized' compilation.
- if (jit->CompileMethod(method, self, kind, /*prejit=*/ false)) {
- return;
- }
const void* entry_point = method->GetEntryPointFromQuickCompiledCode();
if (code_cache->ContainsPc(entry_point)) {
// If we're running baseline or not requesting optimized, we're good to go.