Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
frame_rebase.h
Go to the documentation of this file.
1// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_COMPILER_FFI_FRAME_REBASE_H_
6#define RUNTIME_VM_COMPILER_FFI_FRAME_REBASE_H_
7
8#if defined(DART_PRECOMPILED_RUNTIME)
9#error "AOT runtime should not use compiler sources (including header files)"
10#endif // defined(DART_PRECOMPILED_RUNTIME)
11
16#include "vm/thread.h"
17
18namespace dart {
19
20namespace compiler {
21
22namespace ffi {
23
24// Describes a change of stack frame where the stack or base register or stack
25// offset may change. This class allows easily rebasing stack locations across
26// frame manipulations.
27//
28// If the stack offset register matches 'old_base', it is changed to 'new_base'
29// and 'stack_delta_in_bytes' (# of bytes) is applied.
30//
31// This class can be used to rebase both Locations and NativeLocations.
32class FrameRebase : public ValueObject {
33 public:
35 const Register old_base,
36 const Register new_base,
37 intptr_t stack_delta_in_bytes)
38 : zone_(zone),
39 old_base_(old_base),
40 new_base_(new_base),
41 stack_delta_in_bytes_(stack_delta_in_bytes) {}
42
43 const NativeLocation& Rebase(const NativeLocation& loc) const;
44
45 Location Rebase(const Location loc) const;
46
47 private:
48 Zone* zone_;
49 const Register old_base_;
50 const Register new_base_;
51 const intptr_t stack_delta_in_bytes_;
52};
53
54} // namespace ffi
55
56} // namespace compiler
57
58} // namespace dart
59
60#endif // RUNTIME_VM_COMPILER_FFI_FRAME_REBASE_H_
FrameRebase(Zone *zone, const Register old_base, const Register new_base, intptr_t stack_delta_in_bytes)
const NativeLocation & Rebase(const NativeLocation &loc) const