summaryrefslogtreecommitdiff
path: root/runtime/stack.h
diff options
context:
space:
mode:
author Mythri Alle <mythria@google.com> 2022-11-04 10:57:53 +0000
committer Mythri Alle <mythria@google.com> 2022-11-08 10:43:08 +0000
commit5eff6b3307dde2feff372decd0bc7e7e80e340da (patch)
tree6e8ccdb81cc8691645f7fe918abbb235f04e22bd /runtime/stack.h
parent00ca1b514f69bec767d56259dea75711e6c939f9 (diff)
Use ShouldDeoptimizeFlag to check if method exit hooks are needed
When we want to execute a particular method in switch interrpeter we update the entry point of the method and we need to deopt any method invocations that are on the stack currently. All future invocations would use the correct entry point so we only need to check for a deopt for the methods that are currently on the stack. In the current implementation, we check a global flag to call method exit hooks (that checks if a deopt of caller is necessary) which means we call method exit hooks more often than necessary. This CL changes it so we use a bit on the ShouldDeoptimizeFlag and update the bit for all method invocations that are currently on the stack. We still have to call method exit hooks for any future invocations if method exit listeners are installed. So the JITed code is now updated to call method exit hooks if the stack slot indicates a deopt check is necessary or if method exit listeners are installed. This improves the performance of golem benchmarks by close to 8x bringing the performance close it what it was before adding a breakpoint. Bug: 253232638 Test: art/test.py Change-Id: Ic70a568c3099bc9df8d72f423b33b4f148209de9
Diffstat (limited to 'runtime/stack.h')
-rw-r--r--runtime/stack.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/runtime/stack.h b/runtime/stack.h
index 56f38aecef..a4bcf17ca5 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -308,13 +308,19 @@ class StackVisitor {
*should_deoptimize_addr = *should_deoptimize_addr | static_cast<uint8_t>(value);
};
+ void UnsetShouldDeoptimizeFlag(DeoptimizeFlagValue value) REQUIRES_SHARED(Locks::mutator_lock_) {
+ uint8_t* should_deoptimize_addr = GetShouldDeoptimizeFlagAddr();
+ *should_deoptimize_addr = *should_deoptimize_addr & ~static_cast<uint8_t>(value);
+ };
+
uint8_t GetShouldDeoptimizeFlag() const REQUIRES_SHARED(Locks::mutator_lock_) {
return *GetShouldDeoptimizeFlagAddr();
}
- bool IsShouldDeoptimizeFlagForDebugSet() const REQUIRES_SHARED(Locks::mutator_lock_) {
+ bool ShouldForceDeoptForRedefinition() const REQUIRES_SHARED(Locks::mutator_lock_) {
uint8_t should_deopt_flag = GetShouldDeoptimizeFlag();
- return (should_deopt_flag & static_cast<uint8_t>(DeoptimizeFlagValue::kDebug)) != 0;
+ return (should_deopt_flag &
+ static_cast<uint8_t>(DeoptimizeFlagValue::kForceDeoptForRedefinition)) != 0;
}
// Return the number of dex register in the map from the outermost frame to the number of inlined