diff options
| author | 2014-09-09 13:51:09 -0700 | |
|---|---|---|
| committer | 2014-09-09 13:51:09 -0700 | |
| commit | cd48f2d86197d4fe87cc88077bc4af5ba66e5295 (patch) | |
| tree | a678a9eafd72d80cb6d7581b99cc11bc9cf64911 | |
| parent | 5bc47ebe278af65e8e2a2d6b603ac94a020285f7 (diff) | |
Change Reference.get() intrinsic to Reference.getReferent().
The reference intrinsic was incorrectly inlining
PhantomReference.get(). We now get around this by adding a
layer of indirection. Reference.get() now calls getReferent()
which is intrinsified and inlined.
Requires:
https://android-review.googlesource.com/#/c/107100/
Bug: 17429865
Change-Id: Ie91e70abf43cedf3c707c7bb8a5059e19d2a2577
| -rw-r--r-- | compiler/dex/quick/dex_file_method_inliner.cc | 12 | ||||
| -rw-r--r-- | compiler/dex/quick/dex_file_method_inliner.h | 2 | ||||
| -rwxr-xr-x | compiler/dex/quick/gen_invoke.cc | 2 | ||||
| -rw-r--r-- | compiler/dex/quick/mir_to_lir.h | 2 | ||||
| -rw-r--r-- | runtime/native/java_lang_ref_Reference.cc | 4 | ||||
| -rw-r--r-- | runtime/quick/inline_method_analyser.h | 2 |
6 files changed, 12 insertions, 12 deletions
diff --git a/compiler/dex/quick/dex_file_method_inliner.cc b/compiler/dex/quick/dex_file_method_inliner.cc index ffcce7d147..2523380bcf 100644 --- a/compiler/dex/quick/dex_file_method_inliner.cc +++ b/compiler/dex/quick/dex_file_method_inliner.cc @@ -55,7 +55,7 @@ static constexpr bool kIntrinsicIsStatic[] = { true, // kIntrinsicRint true, // kIntrinsicRoundFloat true, // kIntrinsicRoundDouble - false, // kIntrinsicReferenceGet + false, // kIntrinsicReferenceGetReferent false, // kIntrinsicCharAt false, // kIntrinsicCompareTo false, // kIntrinsicIsEmptyOrLength @@ -87,7 +87,7 @@ COMPILE_ASSERT(kIntrinsicIsStatic[kIntrinsicFloor], Floor_must_be_static); COMPILE_ASSERT(kIntrinsicIsStatic[kIntrinsicRint], Rint_must_be_static); COMPILE_ASSERT(kIntrinsicIsStatic[kIntrinsicRoundFloat], RoundFloat_must_be_static); COMPILE_ASSERT(kIntrinsicIsStatic[kIntrinsicRoundDouble], RoundDouble_must_be_static); -COMPILE_ASSERT(!kIntrinsicIsStatic[kIntrinsicReferenceGet], Get_must_not_be_static); +COMPILE_ASSERT(!kIntrinsicIsStatic[kIntrinsicReferenceGetReferent], Get_must_not_be_static); COMPILE_ASSERT(!kIntrinsicIsStatic[kIntrinsicCharAt], CharAt_must_not_be_static); COMPILE_ASSERT(!kIntrinsicIsStatic[kIntrinsicCompareTo], CompareTo_must_not_be_static); COMPILE_ASSERT(!kIntrinsicIsStatic[kIntrinsicIsEmptyOrLength], IsEmptyOrLength_must_not_be_static); @@ -171,7 +171,7 @@ const char* const DexFileMethodInliner::kNameCacheNames[] = { "floor", // kNameCacheFloor "rint", // kNameCacheRint "round", // kNameCacheRound - "get", // kNameCacheReferenceGet + "getReferent", // kNameCacheReferenceGet "charAt", // kNameCacheCharAt "compareTo", // kNameCacheCompareTo "isEmpty", // kNameCacheIsEmpty @@ -341,7 +341,7 @@ const DexFileMethodInliner::IntrinsicDef DexFileMethodInliner::kIntrinsicMethods INTRINSIC(JavaLangMath, Round, D_J, kIntrinsicRoundDouble, 0), INTRINSIC(JavaLangStrictMath, Round, D_J, kIntrinsicRoundDouble, 0), - INTRINSIC(JavaLangRefReference, ReferenceGet, _Object, kIntrinsicReferenceGet, 0), + INTRINSIC(JavaLangRefReference, ReferenceGetReferent, _Object, kIntrinsicReferenceGetReferent, 0), INTRINSIC(JavaLangString, CharAt, I_C, kIntrinsicCharAt, 0), INTRINSIC(JavaLangString, CompareTo, String_I, kIntrinsicCompareTo, 0), @@ -473,8 +473,8 @@ bool DexFileMethodInliner::GenIntrinsic(Mir2Lir* backend, CallInfo* info) { return backend->GenInlinedRound(info, false /* is_double */); case kIntrinsicRoundDouble: return backend->GenInlinedRound(info, true /* is_double */); - case kIntrinsicReferenceGet: - return backend->GenInlinedReferenceGet(info); + case kIntrinsicReferenceGetReferent: + return backend->GenInlinedReferenceGetReferent(info); case kIntrinsicCharAt: return backend->GenInlinedCharAt(info); case kIntrinsicCompareTo: diff --git a/compiler/dex/quick/dex_file_method_inliner.h b/compiler/dex/quick/dex_file_method_inliner.h index b875e2bcbe..30a2d9081a 100644 --- a/compiler/dex/quick/dex_file_method_inliner.h +++ b/compiler/dex/quick/dex_file_method_inliner.h @@ -145,7 +145,7 @@ class DexFileMethodInliner { kNameCacheFloor, kNameCacheRint, kNameCacheRound, - kNameCacheReferenceGet, + kNameCacheReferenceGetReferent, kNameCacheCharAt, kNameCacheCompareTo, kNameCacheIsEmpty, diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc index 78f5c733f9..8ce696ca15 100755 --- a/compiler/dex/quick/gen_invoke.cc +++ b/compiler/dex/quick/gen_invoke.cc @@ -1130,7 +1130,7 @@ RegLocation Mir2Lir::InlineTargetWide(CallInfo* info) { return res; } -bool Mir2Lir::GenInlinedReferenceGet(CallInfo* info) { +bool Mir2Lir::GenInlinedReferenceGetReferent(CallInfo* info) { if (cu_->instruction_set == kMips) { // TODO - add Mips implementation return false; diff --git a/compiler/dex/quick/mir_to_lir.h b/compiler/dex/quick/mir_to_lir.h index d6fc2e9da5..ea722ab1df 100644 --- a/compiler/dex/quick/mir_to_lir.h +++ b/compiler/dex/quick/mir_to_lir.h @@ -941,7 +941,7 @@ class Mir2Lir : public Backend { */ RegLocation InlineTargetWide(CallInfo* info); - bool GenInlinedReferenceGet(CallInfo* info); + bool GenInlinedReferenceGetReferent(CallInfo* info); virtual bool GenInlinedCharAt(CallInfo* info); bool GenInlinedStringIsEmptyOrLength(CallInfo* info, bool is_empty); virtual bool GenInlinedReverseBits(CallInfo* info, OpSize size); diff --git a/runtime/native/java_lang_ref_Reference.cc b/runtime/native/java_lang_ref_Reference.cc index f221ac60f5..4f04d60232 100644 --- a/runtime/native/java_lang_ref_Reference.cc +++ b/runtime/native/java_lang_ref_Reference.cc @@ -23,7 +23,7 @@ namespace art { -static jobject Reference_get(JNIEnv* env, jobject javaThis) { +static jobject Reference_getReferent(JNIEnv* env, jobject javaThis) { ScopedFastNativeObjectAccess soa(env); mirror::Reference* const ref = soa.Decode<mirror::Reference*>(javaThis); mirror::Object* const referent = @@ -32,7 +32,7 @@ static jobject Reference_get(JNIEnv* env, jobject javaThis) { } static JNINativeMethod gMethods[] = { - NATIVE_METHOD(Reference, get, "!()Ljava/lang/Object;"), + NATIVE_METHOD(Reference, getReferent, "!()Ljava/lang/Object;"), }; void register_java_lang_ref_Reference(JNIEnv* env) { diff --git a/runtime/quick/inline_method_analyser.h b/runtime/quick/inline_method_analyser.h index c4d51cb173..a2ae3970f0 100644 --- a/runtime/quick/inline_method_analyser.h +++ b/runtime/quick/inline_method_analyser.h @@ -53,7 +53,7 @@ enum InlineMethodOpcode : uint16_t { kIntrinsicRint, kIntrinsicRoundFloat, kIntrinsicRoundDouble, - kIntrinsicReferenceGet, + kIntrinsicReferenceGetReferent, kIntrinsicCharAt, kIntrinsicCompareTo, kIntrinsicIsEmptyOrLength, |