Sebastien Hertz | fd3077e | 2014-04-23 10:32:43 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_RUNTIME_DEOPTIMIZE_STACK_VISITOR_H_ |
| 18 | #define ART_RUNTIME_DEOPTIMIZE_STACK_VISITOR_H_ |
| 19 | |
| 20 | #include "base/mutex.h" |
| 21 | #include "stack.h" |
Sebastien Hertz | 714f175 | 2014-04-28 15:03:08 +0200 | [diff] [blame] | 22 | #include "thread.h" |
Sebastien Hertz | fd3077e | 2014-04-23 10:32:43 +0200 | [diff] [blame] | 23 | |
| 24 | namespace art { |
| 25 | |
| 26 | namespace mirror { |
| 27 | class ArtMethod; |
| 28 | } // namespace mirror |
| 29 | class QuickExceptionHandler; |
| 30 | class Thread; |
| 31 | |
| 32 | // Prepares deoptimization. |
| 33 | class DeoptimizeStackVisitor FINAL : public StackVisitor { |
| 34 | public: |
| 35 | DeoptimizeStackVisitor(Thread* self, Context* context, QuickExceptionHandler* exception_handler) |
| 36 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) |
| 37 | : StackVisitor(self, context), self_(self), exception_handler_(exception_handler), |
| 38 | prev_shadow_frame_(nullptr) { |
Sebastien Hertz | 714f175 | 2014-04-28 15:03:08 +0200 | [diff] [blame] | 39 | CHECK(!self_->HasDeoptimizationShadowFrame()); |
Sebastien Hertz | fd3077e | 2014-04-23 10:32:43 +0200 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | bool VisitFrame() OVERRIDE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
| 43 | |
| 44 | private: |
| 45 | bool HandleDeoptimization(mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
| 46 | |
| 47 | Thread* const self_; |
| 48 | QuickExceptionHandler* const exception_handler_; |
| 49 | ShadowFrame* prev_shadow_frame_; |
| 50 | |
| 51 | DISALLOW_COPY_AND_ASSIGN(DeoptimizeStackVisitor); |
| 52 | }; |
| 53 | |
| 54 | } // namespace art |
| 55 | #endif // ART_RUNTIME_DEOPTIMIZE_STACK_VISITOR_H_ |