diff options
author | 2015-08-19 14:58:14 -0700 | |
---|---|---|
committer | 2015-08-19 18:51:32 -0700 | |
commit | 05f2056b4f11e0b2bac92b2655abe7030771f5dc (patch) | |
tree | 60d94fc6f0e0825bec14a5f8eb52f2b98d285314 /compiler/optimizing/nodes.h | |
parent | e1e05e0876f303a9f4aca1d8713b7c44f21952b8 (diff) |
Add support to indicate whether intrinsics require a dex cache
A structural change to indicate whether a given intrinsic requires access
to a dex cache. I updated the needs_environment_ field to indicate
whether an HInvoke needs an environment or a dex cache, and if an HInvoke
represents an intrisified method, we utilize this field to determine if
the HInvoke needs a dex cache.
Bug: 21481923
Change-Id: I9dd25a385e1a1397603da6c4c43f6c1aea511b32
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r-- | compiler/optimizing/nodes.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 7e49199b69..851dd4ff5e 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -2931,7 +2931,7 @@ class HDoubleConstant : public HConstant { }; enum class Intrinsics { -#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironment) k ## Name, +#define OPTIMIZING_INTRINSICS(Name, IsStatic, NeedsEnvironmentOrCache) k ## Name, #include "intrinsics_list.h" kNone, INTRINSICS_LIST(OPTIMIZING_INTRINSICS) @@ -2940,9 +2940,9 @@ enum class Intrinsics { }; std::ostream& operator<<(std::ostream& os, const Intrinsics& intrinsic); -enum IntrinsicNeedsEnvironment { - kNoEnvironment, // Intrinsic does not require an environment. - kNeedsEnvironment // Intrinsic requires an environment. +enum IntrinsicNeedsEnvironmentOrCache { + kNoEnvironmentOrCache, // Intrinsic does not require an environment or dex cache. + kNeedsEnvironmentOrCache // Intrinsic requires an environment or requires a dex cache. }; class HInvoke : public HInstruction { @@ -2951,7 +2951,9 @@ class HInvoke : public HInstruction { // Runtime needs to walk the stack, so Dex -> Dex calls need to // know their environment. - bool NeedsEnvironment() const OVERRIDE { return needs_environment_ == kNeedsEnvironment; } + bool NeedsEnvironment() const OVERRIDE { + return needs_environment_or_cache_ == kNeedsEnvironmentOrCache; + } void SetArgumentAt(size_t index, HInstruction* argument) { SetRawInputAt(index, argument); @@ -2976,9 +2978,9 @@ class HInvoke : public HInstruction { return intrinsic_; } - void SetIntrinsic(Intrinsics intrinsic, IntrinsicNeedsEnvironment needs_environment) { + void SetIntrinsic(Intrinsics intrinsic, IntrinsicNeedsEnvironmentOrCache needs_env_or_cache) { intrinsic_ = intrinsic; - needs_environment_ = needs_environment; + needs_environment_or_cache_ = needs_env_or_cache; } bool IsFromInlinedInvoke() const { @@ -3006,7 +3008,7 @@ class HInvoke : public HInstruction { dex_method_index_(dex_method_index), original_invoke_type_(original_invoke_type), intrinsic_(Intrinsics::kNone), - needs_environment_(kNeedsEnvironment) { + needs_environment_or_cache_(kNeedsEnvironmentOrCache) { uint32_t number_of_inputs = number_of_arguments + number_of_other_inputs; inputs_.SetSize(number_of_inputs); } @@ -3023,7 +3025,7 @@ class HInvoke : public HInstruction { const uint32_t dex_method_index_; const InvokeType original_invoke_type_; Intrinsics intrinsic_; - IntrinsicNeedsEnvironment needs_environment_; + IntrinsicNeedsEnvironmentOrCache needs_environment_or_cache_; private: DISALLOW_COPY_AND_ASSIGN(HInvoke); @@ -3148,7 +3150,10 @@ class HInvokeStaticOrDirect : public HInvoke { MethodLoadKind GetMethodLoadKind() const { return dispatch_info_.method_load_kind; } CodePtrLocation GetCodePtrLocation() const { return dispatch_info_.code_ptr_location; } bool IsRecursive() const { return GetMethodLoadKind() == MethodLoadKind::kRecursive; } - bool NeedsDexCache() const OVERRIDE { return !IsRecursive() && !IsStringInit(); } + bool NeedsDexCache() const OVERRIDE { + if (intrinsic_ != Intrinsics::kNone) { return needs_environment_or_cache_; } + return !IsRecursive() && !IsStringInit(); + } bool IsStringInit() const { return GetMethodLoadKind() == MethodLoadKind::kStringInit; } uint32_t GetCurrentMethodInputIndex() const { return GetNumberOfArguments(); } bool HasMethodAddress() const { return GetMethodLoadKind() == MethodLoadKind::kDirectAddress; } |