2013-05-03 21:42:16 +00:00
|
|
|
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
2016-10-26 07:26:03 +00:00
|
|
|
#ifndef RUNTIME_VM_STACK_FRAME_X64_H_
|
|
|
|
#define RUNTIME_VM_STACK_FRAME_X64_H_
|
2013-05-03 21:42:16 +00:00
|
|
|
|
2019-09-05 21:41:42 +00:00
|
|
|
#if !defined(RUNTIME_VM_STACK_FRAME_H_)
|
|
|
|
#error Do not include stack_frame_x64.h directly; use stack_frame.h instead.
|
|
|
|
#endif
|
|
|
|
|
2019-05-24 02:39:13 +00:00
|
|
|
#include "vm/constants_x64.h"
|
|
|
|
|
2013-05-03 21:42:16 +00:00
|
|
|
namespace dart {
|
|
|
|
|
|
|
|
/* X64 Dart Frame Layout
|
|
|
|
|
2013-05-07 18:06:21 +00:00
|
|
|
| | <- TOS
|
|
|
|
Callee frame | ... |
|
2013-09-09 15:39:26 +00:00
|
|
|
| saved PP |
|
2015-09-19 11:21:09 +00:00
|
|
|
| code object |
|
2013-05-14 23:23:54 +00:00
|
|
|
| saved RBP | (RBP of current frame)
|
|
|
|
| saved PC | (PC of current frame)
|
2013-05-07 18:06:21 +00:00
|
|
|
+--------------------+
|
2013-11-08 00:25:40 +00:00
|
|
|
Current frame | ... T| <- RSP of current frame
|
|
|
|
| first local T|
|
|
|
|
| caller's PP T|
|
2015-09-19 11:21:09 +00:00
|
|
|
| code object T| (current frame's code object)
|
2013-05-07 18:06:21 +00:00
|
|
|
| caller's RBP | <- RBP of current frame
|
|
|
|
| caller's ret addr | (PC of caller frame)
|
|
|
|
+--------------------+
|
|
|
|
Caller frame | last parameter | <- RSP of caller frame
|
|
|
|
| ... |
|
2013-11-08 00:25:40 +00:00
|
|
|
|
|
|
|
T against a slot indicates it needs to be traversed during GC.
|
2013-05-03 21:42:16 +00:00
|
|
|
*/
|
|
|
|
|
2013-09-09 15:39:26 +00:00
|
|
|
static const int kDartFrameFixedSize = 4; // PC marker, RBP, PP, PC.
|
2013-05-07 18:06:21 +00:00
|
|
|
static const int kSavedPcSlotFromSp = -1;
|
2013-09-09 15:39:26 +00:00
|
|
|
|
2015-09-19 11:21:09 +00:00
|
|
|
static const int kFirstObjectSlotFromFp = -1; // Used by GC to traverse stack.
|
2017-10-12 03:47:15 +00:00
|
|
|
static const int kLastFixedObjectSlotFromFp = -2;
|
2013-11-08 00:25:40 +00:00
|
|
|
|
2013-09-09 15:39:26 +00:00
|
|
|
static const int kFirstLocalSlotFromFp = -3;
|
|
|
|
static const int kSavedCallerPpSlotFromFp = -2;
|
2013-05-07 18:06:21 +00:00
|
|
|
static const int kPcMarkerSlotFromFp = -1;
|
|
|
|
static const int kSavedCallerFpSlotFromFp = 0;
|
2013-05-14 23:23:54 +00:00
|
|
|
static const int kSavedCallerPcSlotFromFp = 1;
|
2013-09-09 15:39:26 +00:00
|
|
|
|
2013-05-14 23:23:54 +00:00
|
|
|
static const int kParamEndSlotFromFp = 1; // One slot past last parameter.
|
2013-05-07 18:06:21 +00:00
|
|
|
static const int kCallerSpSlotFromFp = 2;
|
2019-04-03 15:42:56 +00:00
|
|
|
static const int kLastParamSlotFromEntrySp = 1; // Skip return address.
|
2013-05-14 23:23:54 +00:00
|
|
|
|
2013-05-07 18:06:21 +00:00
|
|
|
// Entry and exit frame layout.
|
2014-06-06 12:14:15 +00:00
|
|
|
#if defined(_WIN64)
|
2015-09-19 11:21:09 +00:00
|
|
|
static const int kExitLinkSlotFromEntryFp = -32;
|
2014-06-06 12:14:15 +00:00
|
|
|
#else
|
2015-09-19 11:21:09 +00:00
|
|
|
static const int kExitLinkSlotFromEntryFp = -10;
|
2014-06-06 12:14:15 +00:00
|
|
|
#endif // defined(_WIN64)
|
2013-05-03 21:42:16 +00:00
|
|
|
|
2019-05-24 02:39:13 +00:00
|
|
|
// For FFI native -> Dart callbacks, the number of stack slots between arguments
|
|
|
|
// passed on stack and arguments saved in callback prologue. 2 = return adddress
|
|
|
|
// (1) + saved frame pointer (1). Also add slots for the shadow space, if
|
|
|
|
// present.
|
2019-08-21 13:33:37 +00:00
|
|
|
//
|
|
|
|
// If NativeCallbackTrampolines::Enabled(), then
|
|
|
|
// kNativeCallbackTrampolineStackDelta must be added as well.
|
2019-05-24 02:39:13 +00:00
|
|
|
constexpr intptr_t kCallbackSlotsBeforeSavedArguments =
|
|
|
|
2 + CallingConventions::kShadowSpaceBytes / kWordSize;
|
|
|
|
|
2013-05-03 21:42:16 +00:00
|
|
|
} // namespace dart
|
|
|
|
|
2016-10-26 07:26:03 +00:00
|
|
|
#endif // RUNTIME_VM_STACK_FRAME_X64_H_
|