summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Mythri Alle <mythria@google.com> 2023-04-25 14:33:23 +0000
committer Mythri Alle <mythria@google.com> 2023-04-25 16:29:00 +0000
commitb5fcab944b3786f27ab6b698685109bfc7f785fd (patch)
tree18b5cb5c332b21fc5ee5a6a982ee9d41cf41fe84 /compiler/optimizing
parentc8507c86869c358fb0880ad49e00ca44763bfb70 (diff)
Revert "Don't enable intrinsic optimizations in debuggable runtime"
This reverts commit cb008914fbc5a2334e3c00366afdb5f8af5a23ba. Reason for revert: Failures on some configs https://buganizer.corp.google.com/issues/279562617 Change-Id: I4d26cd00e76d8ec4aef76ab26987418eab24d217
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/critical_native_abi_fixup_arm.cc3
-rw-r--r--compiler/optimizing/inliner.cc6
-rw-r--r--compiler/optimizing/instruction_builder.cc35
-rw-r--r--compiler/optimizing/instruction_simplifier.cc2
-rw-r--r--compiler/optimizing/load_store_analysis_test.cc30
-rw-r--r--compiler/optimizing/nodes.cc4
-rw-r--r--compiler/optimizing/nodes.h40
-rw-r--r--compiler/optimizing/optimizing_unit_test.h3
8 files changed, 40 insertions, 83 deletions
diff --git a/compiler/optimizing/critical_native_abi_fixup_arm.cc b/compiler/optimizing/critical_native_abi_fixup_arm.cc
index 77e156608b..03fb26bf1e 100644
--- a/compiler/optimizing/critical_native_abi_fixup_arm.cc
+++ b/compiler/optimizing/critical_native_abi_fixup_arm.cc
@@ -74,8 +74,7 @@ static void FixUpArguments(HInvokeStaticOrDirect* invoke) {
dispatch_info,
kStatic,
target_method,
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !block->GetGraph()->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
// The intrinsic has no side effects and does not need environment or dex cache on ARM.
new_input->SetSideEffects(SideEffects::None());
IntrinsicOptimizations opt(new_input);
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 4bf62f3c26..da498d4277 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -1321,8 +1321,7 @@ bool HInliner::TryDevirtualize(HInvoke* invoke_instruction,
dispatch_info,
kDirect,
MethodReference(method->GetDexFile(), method->GetDexMethodIndex()),
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInputsRef inputs = invoke_instruction->GetInputs();
DCHECK_EQ(inputs.size(), invoke_instruction->GetNumberOfArguments());
for (size_t index = 0; index != inputs.size(); ++index) {
@@ -1528,8 +1527,7 @@ bool HInliner::TryBuildAndInline(HInvoke* invoke_instruction,
invoke_instruction->GetMethodReference(), // Use existing invoke's method's reference.
method,
MethodReference(method->GetDexFile(), method->GetDexMethodIndex()),
- method->GetMethodIndex(),
- !graph_->IsDebuggable());
+ method->GetMethodIndex());
DCHECK_NE(new_invoke->GetIntrinsic(), Intrinsics::kNone);
HInputsRef inputs = invoke_instruction->GetInputs();
for (size_t index = 0; index != inputs.size(); ++index) {
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc
index fee9091145..f9a513804c 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -469,9 +469,6 @@ void HInstructionBuilder::BuildIntrinsic(ArtMethod* method) {
current_block_ = graph_->GetEntryBlock();
InitializeBlockLocals();
InitializeParameters();
- if (graph_->IsDebuggable() && code_generator_->GetCompilerOptions().IsJitCompiler()) {
- AppendInstruction(new (allocator_) HMethodEntryHook(0u));
- }
AppendInstruction(new (allocator_) HGoto(0u));
// Fill the body.
@@ -507,21 +504,14 @@ void HInstructionBuilder::BuildIntrinsic(ArtMethod* method) {
dispatch_info,
invoke_type,
target_method,
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HandleInvoke(invoke, operands, shorty, /* is_unresolved= */ false);
}
// Add the return instruction.
if (return_type_ == DataType::Type::kVoid) {
- if (graph_->IsDebuggable() && code_generator_->GetCompilerOptions().IsJitCompiler()) {
- AppendInstruction(new (allocator_) HMethodExitHook(graph_->GetNullConstant(), kNoDexPc));
- }
AppendInstruction(new (allocator_) HReturnVoid());
} else {
- if (graph_->IsDebuggable() && code_generator_->GetCompilerOptions().IsJitCompiler()) {
- AppendInstruction(new (allocator_) HMethodExitHook(latest_result_, kNoDexPc));
- }
AppendInstruction(new (allocator_) HReturn(latest_result_));
}
@@ -1060,8 +1050,7 @@ bool HInstructionBuilder::BuildInvoke(const Instruction& instruction,
dispatch_info,
invoke_type,
resolved_method_reference,
- HInvokeStaticOrDirect::ClinitCheckRequirement::kImplicit,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kImplicit);
return HandleStringInit(invoke, operands, shorty);
}
@@ -1074,7 +1063,7 @@ bool HInstructionBuilder::BuildInvoke(const Instruction& instruction,
}
// Try to build an HIR replacement for the intrinsic.
- if (UNLIKELY(resolved_method->IsIntrinsic()) && !graph_->IsDebuggable()) {
+ if (UNLIKELY(resolved_method->IsIntrinsic())) {
// All intrinsics are in the primary boot image, so their class can always be referenced
// and we do not need to rely on the implicit class initialization check. The class should
// be initialized but we do not require that here.
@@ -1125,8 +1114,7 @@ bool HInstructionBuilder::BuildInvoke(const Instruction& instruction,
dispatch_info,
invoke_type,
resolved_method_reference,
- clinit_check_requirement,
- !graph_->IsDebuggable());
+ clinit_check_requirement);
if (clinit_check != nullptr) {
// Add the class initialization check as last input of `invoke`.
DCHECK_EQ(clinit_check_requirement, HInvokeStaticOrDirect::ClinitCheckRequirement::kExplicit);
@@ -1142,8 +1130,7 @@ bool HInstructionBuilder::BuildInvoke(const Instruction& instruction,
method_reference,
resolved_method,
resolved_method_reference,
- /*vtable_index=*/ imt_or_vtable_index,
- !graph_->IsDebuggable());
+ /*vtable_index=*/ imt_or_vtable_index);
} else {
DCHECK_EQ(invoke_type, kInterface);
if (kIsDebugBuild) {
@@ -1164,8 +1151,7 @@ bool HInstructionBuilder::BuildInvoke(const Instruction& instruction,
resolved_method,
resolved_method_reference,
/*imt_index=*/ imt_or_vtable_index,
- load_kind,
- !graph_->IsDebuggable());
+ load_kind);
}
return HandleInvoke(invoke, operands, shorty, /* is_unresolved= */ false);
}
@@ -1364,14 +1350,12 @@ bool HInstructionBuilder::BuildInvokePolymorphic(uint32_t dex_pc,
method_reference,
resolved_method,
resolved_method_reference,
- proto_idx,
- !graph_->IsDebuggable());
+ proto_idx);
if (!HandleInvoke(invoke, operands, shorty, /* is_unresolved= */ false)) {
return false;
}
- if (invoke->GetIntrinsic() != Intrinsics::kNone &&
- invoke->GetIntrinsic() != Intrinsics::kMethodHandleInvoke &&
+ if (invoke->GetIntrinsic() != Intrinsics::kMethodHandleInvoke &&
invoke->GetIntrinsic() != Intrinsics::kMethodHandleInvokeExact &&
VarHandleAccessorNeedsReturnTypeCheck(invoke, return_type)) {
// Type check is needed because VarHandle intrinsics do not type check the retrieved reference.
@@ -1404,8 +1388,7 @@ bool HInstructionBuilder::BuildInvokeCustom(uint32_t dex_pc,
call_site_idx,
return_type,
dex_pc,
- method_reference,
- !graph_->IsDebuggable());
+ method_reference);
return HandleInvoke(invoke, operands, shorty, /* is_unresolved= */ false);
}
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index 0c2fd5de56..bf51b5dcf4 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -2465,7 +2465,7 @@ void InstructionSimplifierVisitor::SimplifySystemArrayCopy(HInvoke* instruction)
DCHECK(method != nullptr);
DCHECK(method->IsStatic());
DCHECK(method->GetDeclaringClass() == system);
- invoke->SetResolvedMethod(method, !codegen_->GetGraph()->IsDebuggable());
+ invoke->SetResolvedMethod(method);
// Sharpen the new invoke. Note that we do not update the dex method index of
// the invoke, as we would need to look it up in the current dex file, and it
// is unlikely that it exists. The most usual situation for such typed
diff --git a/compiler/optimizing/load_store_analysis_test.cc b/compiler/optimizing/load_store_analysis_test.cc
index 865febbd31..17e7f1fb15 100644
--- a/compiler/optimizing/load_store_analysis_test.cc
+++ b/compiler/optimizing/load_store_analysis_test.cc
@@ -894,8 +894,7 @@ TEST_F(LoadStoreAnalysisTest, PartialEscape) {
{},
InvokeType::kStatic,
{ nullptr, 0 },
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInstruction* goto_left = new (GetAllocator()) HGoto();
call_left->AsInvoke()->SetRawInputAt(0, new_inst);
left->AddInstruction(call_left);
@@ -1004,8 +1003,7 @@ TEST_F(LoadStoreAnalysisTest, PartialEscape2) {
{},
InvokeType::kStatic,
{ nullptr, 0 },
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInstruction* goto_left = new (GetAllocator()) HGoto();
call_left->AsInvoke()->SetRawInputAt(0, new_inst);
left->AddInstruction(call_left);
@@ -1128,8 +1126,7 @@ TEST_F(LoadStoreAnalysisTest, PartialEscape3) {
{},
InvokeType::kStatic,
{ nullptr, 0 },
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInstruction* goto_left = new (GetAllocator()) HGoto();
call_left->AsInvoke()->SetRawInputAt(0, new_inst);
left->AddInstruction(call_left);
@@ -1409,8 +1406,7 @@ TEST_F(LoadStoreAnalysisTest, TotalEscapeAdjacentNoPredicated) {
{},
InvokeType::kStatic,
{nullptr, 0},
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInstruction* goto_left = new (GetAllocator()) HGoto();
call_left->AsInvoke()->SetRawInputAt(0, new_inst);
left->AddInstruction(call_left);
@@ -1511,8 +1507,7 @@ TEST_F(LoadStoreAnalysisTest, TotalEscapeAdjacent) {
{},
InvokeType::kStatic,
{ nullptr, 0 },
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInstruction* goto_left = new (GetAllocator()) HGoto();
call_left->AsInvoke()->SetRawInputAt(0, new_inst);
left->AddInstruction(call_left);
@@ -1623,8 +1618,7 @@ TEST_F(LoadStoreAnalysisTest, TotalEscape) {
{},
InvokeType::kStatic,
{ nullptr, 0 },
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInstruction* goto_left = new (GetAllocator()) HGoto();
call_left->AsInvoke()->SetRawInputAt(0, new_inst);
left->AddInstruction(call_left);
@@ -1640,8 +1634,7 @@ TEST_F(LoadStoreAnalysisTest, TotalEscape) {
{},
InvokeType::kStatic,
{ nullptr, 0 },
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInstruction* write_right = new (GetAllocator()) HInstanceFieldSet(new_inst,
c0,
nullptr,
@@ -1810,8 +1803,7 @@ TEST_F(LoadStoreAnalysisTest, DoubleDiamondEscape) {
{},
InvokeType::kStatic,
{ nullptr, 0 },
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInstruction* goto_left = new (GetAllocator()) HGoto();
call_left->AsInvoke()->SetRawInputAt(0, new_inst);
high_left->AddInstruction(call_left);
@@ -1867,8 +1859,7 @@ TEST_F(LoadStoreAnalysisTest, DoubleDiamondEscape) {
{},
InvokeType::kStatic,
{ nullptr, 0 },
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInstruction* goto_low_left = new (GetAllocator()) HGoto();
call_low_left->AsInvoke()->SetRawInputAt(0, new_inst);
low_left->AddInstruction(call_low_left);
@@ -2025,8 +2016,7 @@ TEST_F(LoadStoreAnalysisTest, PartialPhiPropagation1) {
{},
InvokeType::kStatic,
{nullptr, 0},
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
HInstruction* goto_left_merge = new (GetAllocator()) HGoto();
left_phi->SetRawInputAt(0, obj_param);
left_phi->SetRawInputAt(1, new_inst);
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 3790058879..c99cfab05f 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -3571,8 +3571,8 @@ static inline IntrinsicExceptions GetExceptionsIntrinsic(Intrinsics i) {
return kCanThrow;
}
-void HInvoke::SetResolvedMethod(ArtMethod* method, bool enable_intrinsic_opt) {
- if (method != nullptr && method->IsIntrinsic() && enable_intrinsic_opt) {
+void HInvoke::SetResolvedMethod(ArtMethod* method) {
+ if (method != nullptr && method->IsIntrinsic()) {
Intrinsics intrinsic = static_cast<Intrinsics>(method->GetIntrinsic());
SetIntrinsic(intrinsic,
NeedsEnvironmentIntrinsic(intrinsic),
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 28112d176a..fc5d2196da 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -4756,7 +4756,7 @@ class HInvoke : public HVariableInputSizeInstruction {
bool IsIntrinsic() const { return intrinsic_ != Intrinsics::kNone; }
ArtMethod* GetResolvedMethod() const { return resolved_method_; }
- void SetResolvedMethod(ArtMethod* method, bool enable_intrinsic_opt);
+ void SetResolvedMethod(ArtMethod* method);
MethodReference GetMethodReference() const { return method_reference_; }
@@ -4785,8 +4785,7 @@ class HInvoke : public HVariableInputSizeInstruction {
MethodReference method_reference,
ArtMethod* resolved_method,
MethodReference resolved_method_reference,
- InvokeType invoke_type,
- bool enable_intrinsic_opt)
+ InvokeType invoke_type)
: HVariableInputSizeInstruction(
kind,
return_type,
@@ -4802,7 +4801,7 @@ class HInvoke : public HVariableInputSizeInstruction {
intrinsic_optimizations_(0) {
SetPackedField<InvokeTypeField>(invoke_type);
SetPackedFlag<kFlagCanThrow>(true);
- SetResolvedMethod(resolved_method, enable_intrinsic_opt);
+ SetResolvedMethod(resolved_method);
}
DEFAULT_COPY_CONSTRUCTOR(Invoke);
@@ -4835,8 +4834,7 @@ class HInvokeUnresolved final : public HInvoke {
method_reference,
nullptr,
MethodReference(nullptr, 0u),
- invoke_type,
- /* enable_intrinsic_opt= */ false) {
+ invoke_type) {
}
bool IsClonable() const override { return true; }
@@ -4859,8 +4857,7 @@ class HInvokePolymorphic final : public HInvoke {
// to pass intrinsic information to the HInvokePolymorphic node.
ArtMethod* resolved_method,
MethodReference resolved_method_reference,
- dex::ProtoIndex proto_idx,
- bool enable_intrinsic_opt)
+ dex::ProtoIndex proto_idx)
: HInvoke(kInvokePolymorphic,
allocator,
number_of_arguments,
@@ -4870,8 +4867,7 @@ class HInvokePolymorphic final : public HInvoke {
method_reference,
resolved_method,
resolved_method_reference,
- kPolymorphic,
- enable_intrinsic_opt),
+ kPolymorphic),
proto_idx_(proto_idx) {
}
@@ -4893,8 +4889,7 @@ class HInvokeCustom final : public HInvoke {
uint32_t call_site_index,
DataType::Type return_type,
uint32_t dex_pc,
- MethodReference method_reference,
- bool enable_intrinsic_opt)
+ MethodReference method_reference)
: HInvoke(kInvokeCustom,
allocator,
number_of_arguments,
@@ -4904,8 +4899,7 @@ class HInvokeCustom final : public HInvoke {
method_reference,
/* resolved_method= */ nullptr,
MethodReference(nullptr, 0u),
- kStatic,
- enable_intrinsic_opt),
+ kStatic),
call_site_index_(call_site_index) {
}
@@ -4952,8 +4946,7 @@ class HInvokeStaticOrDirect final : public HInvoke {
DispatchInfo dispatch_info,
InvokeType invoke_type,
MethodReference resolved_method_reference,
- ClinitCheckRequirement clinit_check_requirement,
- bool enable_intrinsic_opt)
+ ClinitCheckRequirement clinit_check_requirement)
: HInvoke(kInvokeStaticOrDirect,
allocator,
number_of_arguments,
@@ -4966,8 +4959,7 @@ class HInvokeStaticOrDirect final : public HInvoke {
method_reference,
resolved_method,
resolved_method_reference,
- invoke_type,
- enable_intrinsic_opt),
+ invoke_type),
dispatch_info_(dispatch_info) {
SetPackedField<ClinitCheckRequirementField>(clinit_check_requirement);
}
@@ -5179,8 +5171,7 @@ class HInvokeVirtual final : public HInvoke {
MethodReference method_reference,
ArtMethod* resolved_method,
MethodReference resolved_method_reference,
- uint32_t vtable_index,
- bool enable_intrinsic_opt)
+ uint32_t vtable_index)
: HInvoke(kInvokeVirtual,
allocator,
number_of_arguments,
@@ -5190,8 +5181,7 @@ class HInvokeVirtual final : public HInvoke {
method_reference,
resolved_method,
resolved_method_reference,
- kVirtual,
- enable_intrinsic_opt),
+ kVirtual),
vtable_index_(vtable_index) {
}
@@ -5243,8 +5233,7 @@ class HInvokeInterface final : public HInvoke {
ArtMethod* resolved_method,
MethodReference resolved_method_reference,
uint32_t imt_index,
- MethodLoadKind load_kind,
- bool enable_intrinsic_opt)
+ MethodLoadKind load_kind)
: HInvoke(kInvokeInterface,
allocator,
number_of_arguments + (NeedsCurrentMethod(load_kind) ? 1 : 0),
@@ -5254,8 +5243,7 @@ class HInvokeInterface final : public HInvoke {
method_reference,
resolved_method,
resolved_method_reference,
- kInterface,
- enable_intrinsic_opt),
+ kInterface),
imt_index_(imt_index),
hidden_argument_load_kind_(load_kind) {
}
diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h
index 2e05c41f01..f18ffc7f83 100644
--- a/compiler/optimizing/optimizing_unit_test.h
+++ b/compiler/optimizing/optimizing_unit_test.h
@@ -461,8 +461,7 @@ class OptimizingUnitTestHelper {
HInvokeStaticOrDirect::DispatchInfo{},
InvokeType::kStatic,
/* resolved_method_reference= */ method_reference,
- HInvokeStaticOrDirect::ClinitCheckRequirement::kNone,
- !graph_->IsDebuggable());
+ HInvokeStaticOrDirect::ClinitCheckRequirement::kNone);
for (auto [ins, idx] : ZipCount(MakeIterationRange(args))) {
res->SetRawInputAt(idx, ins);
}