diff options
author | Sebastien Hertz <shertz@google.com> | 2015-06-09 14:09:14 +0200 |
---|---|---|
committer | Mingyao Yang <mingyao@google.com> | 2015-06-18 14:14:29 -0700 |
commit | bf1fa2ccb5e7409910b99dc46b616e44c66ade68 (patch) | |
tree | 652b3ae6787c63955b745693da6919407cf5ebf5 /runtime/thread.cc | |
parent | ef484d442a3dcae2cd1842c5be0623f5cf71e4ab (diff) | |
download | art-bf1fa2ccb5e7409910b99dc46b616e44c66ade68.zip art-bf1fa2ccb5e7409910b99dc46b616e44c66ade68.tar.gz art-bf1fa2ccb5e7409910b99dc46b616e44c66ade68.tar.bz2 |
Follow up on CL 151605
- Fixes return type of StackedShadowFrameRecord::GetType
- Makes StackedShadowFrameType an enum class (scoped enum)
- Moves DeoptimizationReturnValueRecord and StackedShadowFrameRecord
to thread.cc file and use forward declaration in thread.h header
- Fixes tools/generate-operator-out.py for scoped enum classes.
Bug: 20845490
(cherry picked from commit f795869da0a1fa006fdcdacd8afb6149a63fc1a7)
Change-Id: I6b67e288b1db563699161e58ec2e2330d42dd8f5
Diffstat (limited to 'runtime/thread.cc')
-rw-r--r-- | runtime/thread.cc | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc index e79c5e6..f314f61 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -147,6 +147,50 @@ void Thread::ResetQuickAllocEntryPointsForThread() { ResetQuickAllocEntryPoints(&tlsPtr_.quick_entrypoints); } +class DeoptimizationReturnValueRecord { + public: + DeoptimizationReturnValueRecord(const JValue& ret_val, + bool is_reference, + DeoptimizationReturnValueRecord* link) + : ret_val_(ret_val), is_reference_(is_reference), link_(link) {} + + JValue GetReturnValue() const { return ret_val_; } + bool IsReference() const { return is_reference_; } + DeoptimizationReturnValueRecord* GetLink() const { return link_; } + mirror::Object** GetGCRoot() { + DCHECK(is_reference_); + return ret_val_.GetGCRoot(); + } + + private: + JValue ret_val_; + const bool is_reference_; + DeoptimizationReturnValueRecord* const link_; + + DISALLOW_COPY_AND_ASSIGN(DeoptimizationReturnValueRecord); +}; + +class StackedShadowFrameRecord { + public: + StackedShadowFrameRecord(ShadowFrame* shadow_frame, + StackedShadowFrameType type, + StackedShadowFrameRecord* link) + : shadow_frame_(shadow_frame), + type_(type), + link_(link) {} + + ShadowFrame* GetShadowFrame() const { return shadow_frame_; } + StackedShadowFrameType GetType() const { return type_; } + StackedShadowFrameRecord* GetLink() const { return link_; } + + private: + ShadowFrame* const shadow_frame_; + const StackedShadowFrameType type_; + StackedShadowFrameRecord* const link_; + + DISALLOW_COPY_AND_ASSIGN(StackedShadowFrameRecord); +}; + void Thread::PushAndClearDeoptimizationReturnValue() { DeoptimizationReturnValueRecord* record = new DeoptimizationReturnValueRecord( tls64_.deoptimization_return_value, @@ -174,7 +218,7 @@ void Thread::PushStackedShadowFrame(ShadowFrame* sf, StackedShadowFrameType type ShadowFrame* Thread::PopStackedShadowFrame(StackedShadowFrameType type) { StackedShadowFrameRecord* record = tlsPtr_.stacked_shadow_frame_record; DCHECK(record != nullptr); - DCHECK(record->GetType() == type); + DCHECK_EQ(record->GetType(), type); tlsPtr_.stacked_shadow_frame_record = record->GetLink(); ShadowFrame* shadow_frame = record->GetShadowFrame(); delete record; |