Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
frame_layout.h
Go to the documentation of this file.
1// Copyright (c) 2019, 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_FRAME_LAYOUT_H_
6#define RUNTIME_VM_FRAME_LAYOUT_H_
7
8#include "platform/assert.h"
9#include "platform/globals.h"
10
11// FrameLayout structure captures configuration specific properties of the
12// frame layout used by the runtime system and compiler.
13//
14// Runtime system uses runtime_frame_layout defined in stack_frame.h.
15// Compiler uses compiler::target::frame_layout defined in runtime_api.h
16
17namespace dart {
18
19// Forward declarations.
20class LocalVariable;
21
23 // The offset (in words) from FP to the first object.
25
26 // The offset (in words) from FP to the last fixed object.
28
29 // The offset (in words) from FP to the slot past the last parameter.
31
32 // The offset (in words) from SP on entry (before frame is setup) to
33 // the last parameter.
35
36 // The offset (in words) from FP to the first local.
38
39 // The fixed size of the frame.
41
42 // The offset (in words) from FP to the saved pool (if applicable).
44
45 // The offset (in words) from FP to the saved FP.
47
48 // The offset (in words) from FP to the saved return address.
50
51 // The offset (in words) from FP to the code object (if applicable).
52 intptr_t code_from_fp;
53
54 // Entry and exit frame layout.
56
57 // The number of fixed slots below the saved PC.
58 intptr_t saved_below_pc() const { return -first_local_from_fp; }
59
60 // Returns the FP-relative index where [variable] can be found (assumes
61 // [variable] is not captured), in words.
62 intptr_t FrameSlotForVariable(const LocalVariable* variable) const;
63
64 // Returns the FP-relative index where [variable_index] can be found (assumes
65 // [variable_index] comes from a [LocalVariable::index()], which is not
66 // captured).
67 intptr_t FrameSlotForVariableIndex(intptr_t index) const;
68
69 // Returns the variable index from a FP-relative index.
70 intptr_t VariableIndexForFrameSlot(intptr_t frame_slot) const {
71 if (frame_slot <= first_local_from_fp) {
72 return frame_slot - first_local_from_fp;
73 } else {
74 ASSERT(frame_slot > param_end_from_fp);
75 return frame_slot - param_end_from_fp;
76 }
77 }
78
79 // Called to initialize the stack frame layout during startup.
80 static void Init();
81};
82
83} // namespace dart
84
85#endif // RUNTIME_VM_FRAME_LAYOUT_H_
#define ASSERT(E)
intptr_t saved_caller_pc_from_fp
static void Init()
intptr_t last_fixed_object_from_fp
intptr_t param_end_from_fp
intptr_t saved_below_pc() const
intptr_t last_param_from_entry_sp
intptr_t code_from_fp
intptr_t saved_caller_fp_from_fp
intptr_t first_local_from_fp
intptr_t VariableIndexForFrameSlot(intptr_t frame_slot) const
intptr_t saved_caller_pp_from_fp
intptr_t FrameSlotForVariableIndex(intptr_t index) const
intptr_t FrameSlotForVariable(const LocalVariable *variable) const
intptr_t dart_fixed_frame_size
intptr_t first_object_from_fp
intptr_t exit_link_slot_from_entry_fp