Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
stack_frame_x64.h
Go to the documentation of this file.
1// Copyright (c) 2013, 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_STACK_FRAME_X64_H_
6#define RUNTIME_VM_STACK_FRAME_X64_H_
7
8#if !defined(RUNTIME_VM_STACK_FRAME_H_)
9#error Do not include stack_frame_x64.h directly; use stack_frame.h instead.
10#endif
11
12#include "vm/constants.h"
13
14namespace dart {
15
16/* X64 Dart Frame Layout
17
18 | | <- TOS
19Callee frame | ... |
20 | saved PP |
21 | code object |
22 | saved RBP | (RBP of current frame)
23 | saved PC | (PC of current frame)
24 +--------------------+
25Current frame | ... T| <- RSP of current frame
26 | first local T|
27 | caller's PP T|
28 | code object T| (current frame's code object)
29 | caller's RBP | <- RBP of current frame
30 | caller's ret addr | (PC of caller frame)
31 +--------------------+
32Caller frame | last parameter | <- RSP of caller frame
33 | ... |
34
35 T against a slot indicates it needs to be traversed during GC.
36*/
37
38static constexpr int kDartFrameFixedSize = 4; // PC marker, RBP, PP, PC.
39static constexpr int kSavedPcSlotFromSp = -1;
40
41static constexpr int kFirstObjectSlotFromFp =
42 -1; // Used by GC to traverse stack.
43static constexpr int kLastFixedObjectSlotFromFp = -2;
44
45static constexpr int kFirstLocalSlotFromFp = -3;
46static constexpr int kSavedCallerPpSlotFromFp = -2;
47static constexpr int kPcMarkerSlotFromFp = -1;
48static constexpr int kSavedCallerFpSlotFromFp = 0;
49static constexpr int kSavedCallerPcSlotFromFp = 1;
50
51static constexpr int kParamEndSlotFromFp = 1; // One slot past last parameter.
52static constexpr int kCallerSpSlotFromFp = 2;
53static constexpr int kLastParamSlotFromEntrySp = 1; // Skip return address.
54
55// Entry and exit frame layout.
56#if defined(DART_TARGET_OS_WINDOWS)
57static constexpr int kExitLinkSlotFromEntryFp = -33;
58#else
59static constexpr int kExitLinkSlotFromEntryFp = -11;
60#endif // defined(DART_TARGET_OS_WINDOWS)
61
62// For FFI native -> Dart callbacks, the number of stack slots between arguments
63// passed on stack and arguments saved in callback prologue. 2 = return address
64// (1) + saved frame pointer (1). Also add slots for the shadow space, if
65// present.
66//
67// If NativeCallbackTrampolines::Enabled(), then
68// kNativeCallbackTrampolineStackDelta must be added as well.
69constexpr intptr_t kCallbackSlotsBeforeSavedArguments =
71
72// For FFI calls passing in TypedData, we save it on the stack before entering
73// a Dart frame. This denotes how to get to the backed up typed data.
75
76} // namespace dart
77
78#endif // RUNTIME_VM_STACK_FRAME_X64_H_
static constexpr intptr_t kShadowSpaceBytes
Definition: dart_vm.cc:33
static constexpr int kExitLinkSlotFromEntryFp
static constexpr int kSavedCallerPcSlotFromFp
static constexpr int kLastParamSlotFromEntrySp
static constexpr int kFirstObjectSlotFromFp
static constexpr int kDartFrameFixedSize
static constexpr int kFfiCallerTypedDataSlotFromFp
static constexpr int kSavedCallerFpSlotFromFp
static constexpr int kParamEndSlotFromFp
static constexpr int kCallerSpSlotFromFp
static constexpr int kSavedPcSlotFromSp
static constexpr int kPcMarkerSlotFromFp
static constexpr int kFirstLocalSlotFromFp
constexpr intptr_t kWordSize
Definition: globals.h:509
static constexpr int kSavedCallerPpSlotFromFp
static constexpr int kLastFixedObjectSlotFromFp
constexpr intptr_t kCallbackSlotsBeforeSavedArguments