Correctly handle intrinsics when not precompiling the boot image.
JIT zygote will mark methods from the apex as precompiled, and these can
be intrinsics. Given the flags conflict, just don't mark intrinsics as
precompiled.
Test: boot JIT zygote with primary boot image not precompiled
Change-Id: I9edba04e586befd842a7623f2f0ae3a5ac7109f6
diff --git a/runtime/art_method.h b/runtime/art_method.h
index 3c0492e..fcd90b1 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -230,7 +230,6 @@
bool IsPreCompiled() const {
// 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;
@@ -241,6 +240,13 @@
void SetPreCompiled() REQUIRES_SHARED(Locks::mutator_lock_) {
DCHECK(IsInvokable());
DCHECK(IsCompilable());
+ // kAccPreCompiled and kAccCompileDontBother overlaps with kAccIntrinsicBits.
+ // We don't mark the intrinsics as precompiled, which means in JIT zygote
+ // mode, compiled code for intrinsics will not be shared, and apps will
+ // compile intrinsics themselves if needed.
+ if (IsIntrinsic()) {
+ return;
+ }
AddAccessFlags(kAccPreCompiled | kAccCompileDontBother);
}