1/*
2 * Copyright (C) 2015 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_SIMULATOR_CODE_SIMULATOR_ARM64_H_
18#define ART_RUNTIME_SIMULATOR_CODE_SIMULATOR_ARM64_H_
19
20#include "memory"
21#include "simulator/code_simulator.h"
22// TODO: make vixl clean wrt -Wshadow.
23#pragma GCC diagnostic push
24#pragma GCC diagnostic ignored "-Wshadow"
25#include "vixl/a64/simulator-a64.h"
26#pragma GCC diagnostic pop
27
28namespace art {
29namespace arm64 {
30
31class CodeSimulatorArm64 : public CodeSimulator {
32 public:
33  static CodeSimulatorArm64* CreateCodeSimulatorArm64();
34  virtual ~CodeSimulatorArm64();
35
36  void RunFrom(intptr_t code_buffer) OVERRIDE;
37
38  bool GetCReturnBool() const OVERRIDE;
39  int32_t GetCReturnInt32() const OVERRIDE;
40  int64_t GetCReturnInt64() const OVERRIDE;
41
42 private:
43  CodeSimulatorArm64();
44
45  vixl::Decoder* decoder_;
46  vixl::Simulator* simulator_;
47
48  // TODO: Enable CodeSimulatorArm64 for more host ISAs once vixl::Simulator supports them.
49  static constexpr bool kCanSimulate = (kRuntimeISA == kX86_64);
50
51  DISALLOW_COPY_AND_ASSIGN(CodeSimulatorArm64);
52};
53
54}  // namespace arm64
55}  // namespace art
56
57#endif  // ART_RUNTIME_SIMULATOR_CODE_SIMULATOR_ARM64_H_
58