diff options
author | 2017-09-26 13:07:39 -0700 | |
---|---|---|
committer | 2017-09-27 14:32:20 +0000 | |
commit | 2161193652e925a2b450514f4e445ccd2fb660b3 (patch) | |
tree | 0fdbb54879de0b7b98509bede399cccfb0d4b34c /runtime/runtime_callbacks.cc | |
parent | 8b96c164a11284c07886fca9e4a4a0e15d33e816 (diff) |
Ensure that OSR doesn't break local-variable get/set
We had a bug where we would on-stack replace a method with a modified
local variable. Thanks to inlining & load-store elimination of local
variable values this could cause the change to the variable to be lost.
We fixed this by giving plugins a way to notify the runtime they are
interested in a particular method.
Bug: 66959663
Bug: 66933582
Test: while ./test/run-test --host --prebuild -O --jit 1935; do; done
Test: ./test.py --host -j50
Change-Id: Ic001b8a9d8d0bd9ce292e807752c86a505f85d36
Diffstat (limited to 'runtime/runtime_callbacks.cc')
-rw-r--r-- | runtime/runtime_callbacks.cc | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/runtime/runtime_callbacks.cc b/runtime/runtime_callbacks.cc index 88d3f28583..f164f7c8ec 100644 --- a/runtime/runtime_callbacks.cc +++ b/runtime/runtime_callbacks.cc @@ -26,10 +26,6 @@ namespace art { -void RuntimeCallbacks::AddThreadLifecycleCallback(ThreadLifecycleCallback* cb) { - thread_callbacks_.push_back(cb); -} - template <typename T> ALWAYS_INLINE static inline void Remove(T* cb, std::vector<T*>* data) { @@ -39,6 +35,27 @@ static inline void Remove(T* cb, std::vector<T*>* data) { } } +void RuntimeCallbacks::AddMethodInspectionCallback(MethodInspectionCallback* cb) { + method_inspection_callbacks_.push_back(cb); +} + +void RuntimeCallbacks::RemoveMethodInspectionCallback(MethodInspectionCallback* cb) { + Remove(cb, &method_inspection_callbacks_); +} + +bool RuntimeCallbacks::IsMethodBeingInspected(ArtMethod* m) { + for (MethodInspectionCallback* cb : method_inspection_callbacks_) { + if (cb->IsMethodBeingInspected(m)) { + return true; + } + } + return false; +} + +void RuntimeCallbacks::AddThreadLifecycleCallback(ThreadLifecycleCallback* cb) { + thread_callbacks_.push_back(cb); +} + void RuntimeCallbacks::MonitorContendedLocking(Monitor* m) { for (MonitorCallback* cb : monitor_callbacks_) { cb->MonitorContendedLocking(m); |