diff options
author | Mingyao Yang <mingyao@google.com> | 2015-07-06 11:10:37 -0700 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2015-09-17 17:07:22 +0200 |
commit | 99170c636dfae4908b102347cfe9f92bad1881cc (patch) | |
tree | 1ecff5dd69ea20b09e622cb88e7835a55dfa4be8 /runtime/stack.h | |
parent | 5836f8465ddd0a7f5cbeec9c30d739bd0619867f (diff) | |
download | art-99170c636dfae4908b102347cfe9f92bad1881cc.tar.gz art-99170c636dfae4908b102347cfe9f92bad1881cc.tar.bz2 art-99170c636dfae4908b102347cfe9f92bad1881cc.zip |
Deoptimization support in optimizing compiler for setting local values
Due to compiler optimizations, we may not always be able to update
the value of a local variable in a compiled frame (like a variable
seen as constant by the compiler). To avoid that situation, we simply
deoptimize compiled frames updated by the debugger so they are
executed by the interpreter with the updated value.
When the debugger attempts to set a local variable (actually a DEX
register or a pair of registers) in a compiled frame, we allocate a
ShadowFrame associated to that frame (using its frame id) and set the
new value in that ShadowFrame. When we know we are about to continue
the execution of the compiled frame, we deoptimize the stack using
the preallocated ShadowFrame (instead of creating a new one). We
initialize it with the current value of all DEX registers except
the ones that have been set by the debugger. Therefore, the
ShadowFrame represent the runtime context modified by the debugger.
Bumps oat version to force recompilation.
Bug: 19944235
Change-Id: I0ebe6241264f7a3be0f14ee4516c1f7436e04da6
Diffstat (limited to 'runtime/stack.h')
-rw-r--r-- | runtime/stack.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/stack.h b/runtime/stack.h index 5bbf003e5d..b805239836 100644 --- a/runtime/stack.h +++ b/runtime/stack.h @@ -507,10 +507,21 @@ class StackVisitor { bool SetVReg(ArtMethod* m, uint16_t vreg, uint32_t new_value, VRegKind kind) SHARED_REQUIRES(Locks::mutator_lock_); + // Values will be set in debugger shadow frames. Debugger will make sure deoptimization + // is triggered to make the values effective. + bool SetVRegFromDebugger(ArtMethod* m, uint16_t vreg, uint32_t new_value, VRegKind kind) + SHARED_REQUIRES(Locks::mutator_lock_); + bool SetVRegPair(ArtMethod* m, uint16_t vreg, uint64_t new_value, VRegKind kind_lo, VRegKind kind_hi) SHARED_REQUIRES(Locks::mutator_lock_); + // Values will be set in debugger shadow frames. Debugger will make sure deoptimization + // is triggered to make the values effective. + bool SetVRegPairFromDebugger(ArtMethod* m, uint16_t vreg, uint64_t new_value, + VRegKind kind_lo, VRegKind kind_hi) + SHARED_REQUIRES(Locks::mutator_lock_); + uintptr_t* GetGPRAddress(uint32_t reg) const; // This is a fast-path for getting/setting values in a quick frame. @@ -645,6 +656,8 @@ class StackVisitor { uintptr_t GetFPR(uint32_t reg) const; void SetFPR(uint32_t reg, uintptr_t value); + bool GetVRegFromDebuggerShadowFrame(uint16_t vreg, VRegKind kind, uint32_t* val) const + SHARED_REQUIRES(Locks::mutator_lock_); bool GetVRegFromQuickCode(ArtMethod* m, uint16_t vreg, VRegKind kind, uint32_t* val) const SHARED_REQUIRES(Locks::mutator_lock_); @@ -654,6 +667,9 @@ class StackVisitor { bool GetRegisterIfAccessible(uint32_t reg, VRegKind kind, uint32_t* val) const SHARED_REQUIRES(Locks::mutator_lock_); + bool GetVRegPairFromDebuggerShadowFrame(uint16_t vreg, VRegKind kind_lo, VRegKind kind_hi, + uint64_t* val) const + SHARED_REQUIRES(Locks::mutator_lock_); bool GetVRegPairFromQuickCode(ArtMethod* m, uint16_t vreg, VRegKind kind_lo, VRegKind kind_hi, uint64_t* val) const SHARED_REQUIRES(Locks::mutator_lock_); |