diff options
author | Sebastien Hertz <shertz@google.com> | 2015-01-22 18:57:14 +0100 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2015-01-26 16:45:38 +0100 |
commit | 96ba8dc82e7bd859106af837623fe8b2e9e772c3 (patch) | |
tree | d7df58e8a9fb853621700d90ec4864129f6b3a0a /runtime/stack.h | |
parent | 081d27817608c2ea035f2473c4ea1062a79bccef (diff) | |
download | art-96ba8dc82e7bd859106af837623fe8b2e9e772c3.zip art-96ba8dc82e7bd859106af837623fe8b2e9e772c3.tar.gz art-96ba8dc82e7bd859106af837623fe8b2e9e772c3.tar.bz2 |
Refactor register access from StackVisitor
Moves register access checking up to StackVisitor by adding methods
IsAccessibleGPR and IsAccessibleFPR in Context class. It allows to
simplify GetGPR/FPR and SetGPR/FPR methods in the Context class (and
its subclasses).
Also simplifies code in StackVisitor by adding IsAccessibleRegister,
GetRegister and SetRegister methods which then call either GPR or FPR
specific methods in Context depending on the nature of the accessed
register.
Bug: 18547544
Bug: 19106446
Change-Id: I6e707608d935a71571d0e975a6e766053de3763a
Diffstat (limited to 'runtime/stack.h')
-rw-r--r-- | runtime/stack.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/runtime/stack.h b/runtime/stack.h index b2b2072..5a86ca1 100644 --- a/runtime/stack.h +++ b/runtime/stack.h @@ -649,10 +649,29 @@ class StackVisitor { StackVisitor(Thread* thread, Context* context, size_t num_frames) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - bool GetGPR(uint32_t reg, uintptr_t* val) const; - bool SetGPR(uint32_t reg, uintptr_t value); - bool GetFPR(uint32_t reg, uintptr_t* val) const; - bool SetFPR(uint32_t reg, uintptr_t value); + bool IsAccessibleRegister(uint32_t reg, bool is_float) const { + return is_float ? IsAccessibleFPR(reg) : IsAccessibleGPR(reg); + } + uintptr_t GetRegister(uint32_t reg, bool is_float) const { + DCHECK(IsAccessibleRegister(reg, is_float)); + return is_float ? GetFPR(reg) : GetGPR(reg); + } + void SetRegister(uint32_t reg, uintptr_t value, bool is_float) { + DCHECK(IsAccessibleRegister(reg, is_float)); + if (is_float) { + SetFPR(reg, value); + } else { + SetGPR(reg, value); + } + } + + bool IsAccessibleGPR(uint32_t reg) const; + uintptr_t GetGPR(uint32_t reg) const; + void SetGPR(uint32_t reg, uintptr_t value); + + bool IsAccessibleFPR(uint32_t reg) const; + uintptr_t GetFPR(uint32_t reg) const; + void SetFPR(uint32_t reg, uintptr_t value); void SanityCheckFrame() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |