Change the value of kAccPreCompiled.
Use the same value as kAccPreviouslyWarm. This frees the old
value 0x00100000 for future use for non-native methods.
Test: m test-art-host-gtest
Test: testrunner.py --host
Bug: 112676029
Change-Id: Ide2126a7ffd795eeb4a13f745a925a8364e92d63
diff --git a/libdexfile/dex/modifiers.h b/libdexfile/dex/modifiers.h
index 2c92fdd..7b15cca 100644
--- a/libdexfile/dex/modifiers.h
+++ b/libdexfile/dex/modifiers.h
@@ -83,9 +83,12 @@
// Set by the verifier for a method we do not want the compiler to compile.
static constexpr uint32_t kAccCompileDontBother = 0x02000000; // method (runtime)
-// Used in conjunction with kAccCompileDontBother to mark the method as pre
-// compiled by the JIT compiler.
-static constexpr uint32_t kAccPreCompiled = 0x00100000; // method (runtime)
+// Used in conjunction with kAccCompileDontBother to mark the method as pre compiled
+// by the JIT compiler. We are reusing the value of the kAccPreviouslyWarm flag which
+// is meaningless for other methods with kAccCompileDontBother as we do not collect
+// samples for such methods.
+static constexpr uint32_t kAccPreCompiled = 0x00800000; // method (runtime)
+static_assert(kAccPreCompiled == kAccPreviouslyWarm);
// Set by the verifier for a method that could not be verified to follow structured locking.
static constexpr uint32_t kAccMustCountLocks = 0x04000000; // method (runtime)
diff --git a/runtime/art_method.h b/runtime/art_method.h
index ee2a47f..8b85d94 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -232,12 +232,13 @@
}
bool IsPreCompiled() const {
- if (IsIntrinsic()) {
- // kAccCompileDontBother overlaps with kAccIntrinsicBits.
- return false;
- }
- uint32_t expected = (kAccPreCompiled | kAccCompileDontBother);
- return (GetAccessFlags() & expected) == expected;
+ // kAccCompileDontBother and kAccPreCompiled overlap with kAccIntrinsicBits.
+ // Intrinsics should be compiled in primary boot image, not pre-compiled by JIT.
+ static_assert((kAccCompileDontBother & kAccIntrinsicBits) != 0);
+ static_assert((kAccPreCompiled & kAccIntrinsicBits) != 0);
+ static constexpr uint32_t kMask = kAccIntrinsic | kAccCompileDontBother | kAccPreCompiled;
+ static constexpr uint32_t kValue = kAccCompileDontBother | kAccPreCompiled;
+ return (GetAccessFlags() & kMask) == kValue;
}
void SetPreCompiled() REQUIRES_SHARED(Locks::mutator_lock_) {