blob: c41b80364be057e62d905e1ae4c14e485c27ee69 [file] [log] [blame]
Sebastien Hertzfd3077e2014-04-23 10:32:43 +02001/*
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 Hertz714f1752014-04-28 15:03:08 +020022#include "thread.h"
Sebastien Hertzfd3077e2014-04-23 10:32:43 +020023
24namespace art {
25
26namespace mirror {
27class ArtMethod;
28} // namespace mirror
29class QuickExceptionHandler;
30class Thread;
31
32// Prepares deoptimization.
33class 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 Hertz714f1752014-04-28 15:03:08 +020039 CHECK(!self_->HasDeoptimizationShadowFrame());
Sebastien Hertzfd3077e2014-04-23 10:32:43 +020040 }
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_