blob: c898e7db77a281f2308bf961ace6ca5c42faffce [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"
22
23namespace art {
24
25namespace mirror {
26class ArtMethod;
27} // namespace mirror
28class QuickExceptionHandler;
29class Thread;
30
31// Prepares deoptimization.
32class DeoptimizeStackVisitor FINAL : public StackVisitor {
33 public:
34 DeoptimizeStackVisitor(Thread* self, Context* context, QuickExceptionHandler* exception_handler)
35 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
36 : StackVisitor(self, context), self_(self), exception_handler_(exception_handler),
37 prev_shadow_frame_(nullptr) {
38 }
39
40 bool VisitFrame() OVERRIDE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
41
42 private:
43 bool HandleDeoptimization(mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
44
45 Thread* const self_;
46 QuickExceptionHandler* const exception_handler_;
47 ShadowFrame* prev_shadow_frame_;
48
49 DISALLOW_COPY_AND_ASSIGN(DeoptimizeStackVisitor);
50};
51
52} // namespace art
53#endif // ART_RUNTIME_DEOPTIMIZE_STACK_VISITOR_H_