// environment.
#define INTRINSICS_LIST(V) \
- V(DoubleDoubleToRawLongBits, kStatic, kNeedsEnvironment) \
- V(DoubleLongBitsToDouble, kStatic, kNeedsEnvironment) \
- V(FloatFloatToRawIntBits, kStatic, kNeedsEnvironment) \
- V(FloatIntBitsToFloat, kStatic, kNeedsEnvironment) \
- V(IntegerReverse, kStatic, kNeedsEnvironment) \
- V(IntegerReverseBytes, kStatic, kNeedsEnvironment) \
- V(IntegerNumberOfLeadingZeros, kStatic, kNeedsEnvironment) \
- V(LongReverse, kStatic, kNeedsEnvironment) \
- V(LongReverseBytes, kStatic, kNeedsEnvironment) \
- V(LongNumberOfLeadingZeros, kStatic, kNeedsEnvironment) \
- V(ShortReverseBytes, kStatic, kNeedsEnvironment) \
- V(MathAbsDouble, kStatic, kNeedsEnvironment) \
- V(MathAbsFloat, kStatic, kNeedsEnvironment) \
- V(MathAbsLong, kStatic, kNeedsEnvironment) \
- V(MathAbsInt, kStatic, kNeedsEnvironment) \
- V(MathMinDoubleDouble, kStatic, kNeedsEnvironment) \
- V(MathMinFloatFloat, kStatic, kNeedsEnvironment) \
- V(MathMinLongLong, kStatic, kNeedsEnvironment) \
- V(MathMinIntInt, kStatic, kNeedsEnvironment) \
- V(MathMaxDoubleDouble, kStatic, kNeedsEnvironment) \
- V(MathMaxFloatFloat, kStatic, kNeedsEnvironment) \
- V(MathMaxLongLong, kStatic, kNeedsEnvironment) \
- V(MathMaxIntInt, kStatic, kNeedsEnvironment) \
- V(MathSqrt, kStatic, kNeedsEnvironment) \
- V(MathCeil, kStatic, kNeedsEnvironment) \
- V(MathFloor, kStatic, kNeedsEnvironment) \
- V(MathRint, kStatic, kNeedsEnvironment) \
- V(MathRoundDouble, kStatic, kNeedsEnvironment) \
- V(MathRoundFloat, kStatic, kNeedsEnvironment) \
- V(SystemArrayCopyChar, kStatic, kNeedsEnvironment) \
- V(ThreadCurrentThread, kStatic, kNeedsEnvironment) \
- V(MemoryPeekByte, kStatic, kNeedsEnvironment) \
- V(MemoryPeekIntNative, kStatic, kNeedsEnvironment) \
- V(MemoryPeekLongNative, kStatic, kNeedsEnvironment) \
- V(MemoryPeekShortNative, kStatic, kNeedsEnvironment) \
- V(MemoryPokeByte, kStatic, kNeedsEnvironment) \
- V(MemoryPokeIntNative, kStatic, kNeedsEnvironment) \
- V(MemoryPokeLongNative, kStatic, kNeedsEnvironment) \
- V(MemoryPokeShortNative, kStatic, kNeedsEnvironment) \
- V(StringCharAt, kDirect, kNeedsEnvironment) \
- V(StringCompareTo, kDirect, kNeedsEnvironment) \
- V(StringEquals, kDirect, kNeedsEnvironment) \
- V(StringGetCharsNoCheck, kDirect, kNeedsEnvironment) \
- V(StringIndexOf, kDirect, kNeedsEnvironment) \
- V(StringIndexOfAfter, kDirect, kNeedsEnvironment) \
- V(StringNewStringFromBytes, kStatic, kNeedsEnvironment) \
- V(StringNewStringFromChars, kStatic, kNeedsEnvironment) \
- V(StringNewStringFromString, kStatic, kNeedsEnvironment) \
- V(UnsafeCASInt, kDirect, kNeedsEnvironment) \
- V(UnsafeCASLong, kDirect, kNeedsEnvironment) \
- V(UnsafeCASObject, kDirect, kNeedsEnvironment) \
- V(UnsafeGet, kDirect, kNeedsEnvironment) \
- V(UnsafeGetVolatile, kDirect, kNeedsEnvironment) \
- V(UnsafeGetObject, kDirect, kNeedsEnvironment) \
- V(UnsafeGetObjectVolatile, kDirect, kNeedsEnvironment) \
- V(UnsafeGetLong, kDirect, kNeedsEnvironment) \
- V(UnsafeGetLongVolatile, kDirect, kNeedsEnvironment) \
- V(UnsafePut, kDirect, kNeedsEnvironment) \
- V(UnsafePutOrdered, kDirect, kNeedsEnvironment) \
- V(UnsafePutVolatile, kDirect, kNeedsEnvironment) \
- V(UnsafePutObject, kDirect, kNeedsEnvironment) \
- V(UnsafePutObjectOrdered, kDirect, kNeedsEnvironment) \
- V(UnsafePutObjectVolatile, kDirect, kNeedsEnvironment) \
- V(UnsafePutLong, kDirect, kNeedsEnvironment) \
- V(UnsafePutLongOrdered, kDirect, kNeedsEnvironment) \
- V(UnsafePutLongVolatile, kDirect, kNeedsEnvironment) \
- V(ReferenceGetReferent, kDirect, kNeedsEnvironment)
+ V(DoubleDoubleToRawLongBits, kStatic, kNeedsEnvironmentOrCache) \
+ V(DoubleLongBitsToDouble, kStatic, kNeedsEnvironmentOrCache) \
+ V(FloatFloatToRawIntBits, kStatic, kNeedsEnvironmentOrCache) \
+ V(FloatIntBitsToFloat, kStatic, kNeedsEnvironmentOrCache) \
+ V(IntegerReverse, kStatic, kNeedsEnvironmentOrCache) \
+ V(IntegerReverseBytes, kStatic, kNeedsEnvironmentOrCache) \
+ V(IntegerNumberOfLeadingZeros, kStatic, kNeedsEnvironmentOrCache) \
+ V(LongReverse, kStatic, kNeedsEnvironmentOrCache) \
+ V(LongReverseBytes, kStatic, kNeedsEnvironmentOrCache) \
+ V(LongNumberOfLeadingZeros, kStatic, kNeedsEnvironmentOrCache) \
+ V(ShortReverseBytes, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathAbsDouble, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathAbsFloat, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathAbsLong, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathAbsInt, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathMinDoubleDouble, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathMinFloatFloat, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathMinLongLong, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathMinIntInt, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathMaxDoubleDouble, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathMaxFloatFloat, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathMaxLongLong, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathMaxIntInt, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathSqrt, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathCeil, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathFloor, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathRint, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathRoundDouble, kStatic, kNeedsEnvironmentOrCache) \
+ V(MathRoundFloat, kStatic, kNeedsEnvironmentOrCache) \
+ V(SystemArrayCopyChar, kStatic, kNeedsEnvironmentOrCache) \
+ V(ThreadCurrentThread, kStatic, kNeedsEnvironmentOrCache) \
+ V(MemoryPeekByte, kStatic, kNeedsEnvironmentOrCache) \
+ V(MemoryPeekIntNative, kStatic, kNeedsEnvironmentOrCache) \
+ V(MemoryPeekLongNative, kStatic, kNeedsEnvironmentOrCache) \
+ V(MemoryPeekShortNative, kStatic, kNeedsEnvironmentOrCache) \
+ V(MemoryPokeByte, kStatic, kNeedsEnvironmentOrCache) \
+ V(MemoryPokeIntNative, kStatic, kNeedsEnvironmentOrCache) \
+ V(MemoryPokeLongNative, kStatic, kNeedsEnvironmentOrCache) \
+ V(MemoryPokeShortNative, kStatic, kNeedsEnvironmentOrCache) \
+ V(StringCharAt, kDirect, kNeedsEnvironmentOrCache) \
+ V(StringCompareTo, kDirect, kNeedsEnvironmentOrCache) \
+ V(StringEquals, kDirect, kNeedsEnvironmentOrCache) \
+ V(StringGetCharsNoCheck, kDirect, kNeedsEnvironmentOrCache) \
+ V(StringIndexOf, kDirect, kNeedsEnvironmentOrCache) \
+ V(StringIndexOfAfter, kDirect, kNeedsEnvironmentOrCache) \
+ V(StringNewStringFromBytes, kStatic, kNeedsEnvironmentOrCache) \
+ V(StringNewStringFromChars, kStatic, kNeedsEnvironmentOrCache) \
+ V(StringNewStringFromString, kStatic, kNeedsEnvironmentOrCache) \
+ V(UnsafeCASInt, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafeCASLong, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafeCASObject, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafeGet, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafeGetVolatile, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafeGetObject, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafeGetObjectVolatile, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafeGetLong, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafeGetLongVolatile, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafePut, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafePutOrdered, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafePutVolatile, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafePutObject, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafePutObjectOrdered, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafePutObjectVolatile, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafePutLong, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafePutLongOrdered, kDirect, kNeedsEnvironmentOrCache) \
+ V(UnsafePutLongVolatile, kDirect, kNeedsEnvironmentOrCache) \
+ V(ReferenceGetReferent, kDirect, kNeedsEnvironmentOrCache)
#endif // ART_COMPILER_OPTIMIZING_INTRINSICS_LIST_H_
#undef ART_COMPILER_OPTIMIZING_INTRINSICS_LIST_H_ // #define is only for lint.
};
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)
};
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 {
// 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);
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 {
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);
}
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);
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; }