Mark graphs as always throwing alongside methods
This CL removes the need of using an extra boolean
(`did_set_always_throws`) as we already encode the information in
HasAlwaysThrowingInvokes after aosp/2153582.
Also, if we know that a method always throws in the particular
instance that it is called, we can mark it as such. This is an
improvement versus using the dex instructions as methods like:
int foo(int a) {
if (a == 0) { throw new Error("a is 0!"); }
return a / a;
}
will be marked as always throws if called as foo(0).
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: I5368878d0023775c53028a5cccd4a1111b50f60e
diff --git a/compiler/optimizing/inliner.h b/compiler/optimizing/inliner.h
index a2c2085..e33160e 100644
--- a/compiler/optimizing/inliner.h
+++ b/compiler/optimizing/inliner.h
@@ -70,9 +70,7 @@
kInlineCacheMissingTypes = 5
};
- // We set `did_set_always_throws` as true if we analyzed `invoke_instruction` and it always
- // throws.
- bool TryInline(HInvoke* invoke_instruction, /*inout*/ bool* did_set_always_throws);
+ bool TryInline(HInvoke* invoke_instruction);
// Try to inline `resolved_method` in place of `invoke_instruction`. `do_rtp` is whether
// reference type propagation can run after the inlining. If the inlining is successful, this
@@ -142,7 +140,7 @@
// This checks for instructions and constructs that we do not support
// inlining, such as inlining a throw instruction into a try block.
bool CanInlineBody(const HGraph* callee_graph,
- const HBasicBlock* target_block,
+ HInvoke* invoke,
size_t* out_number_of_instructions) const
REQUIRES_SHARED(Locks::mutator_lock_);