mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
To get the full benefit of dyld3 on Darwin platforms, pointer relocations need to be pointer-aligned, which unfortunately requires growing some key path data structures a little bit. This does tidy up some code that had to hack around our lack of unaligned load/store operations on UnsafeRawPointer, at least. While we're here, we can also simplify the identification strategy for reabstracted stored properties; we only need the property index to identify, not the absolute offset. rdar://problem/32318829
103 lines
3.5 KiB
C++
103 lines
3.5 KiB
C++
//===--- KeyPath.h - ABI constants for key path objects ---------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Constants used in the layout of key path objects.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef __SWIFT_SHIMS_KEYPATH_H__
|
|
#define __SWIFT_SHIMS_KEYPATH_H__
|
|
|
|
#include "SwiftStdint.h"
|
|
|
|
#ifdef __cplusplus
|
|
namespace swift {
|
|
extern "C" {
|
|
#endif
|
|
|
|
// Bitfields for the key path buffer header.
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathBufferHeader_SizeMask
|
|
= 0x00FFFFFFU;
|
|
static const __swift_uint32_t _SwiftKeyPathBufferHeader_TrivialFlag
|
|
= 0x80000000U;
|
|
static const __swift_uint32_t _SwiftKeyPathBufferHeader_HasReferencePrefixFlag
|
|
= 0x40000000U;
|
|
static const __swift_uint32_t _SwiftKeyPathBufferHeader_ReservedMask
|
|
= 0x3F000000U;
|
|
|
|
// Bitfields for a key path component header.
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_PayloadMask
|
|
= 0x1FFFFFFFU;
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_DiscriminatorMask
|
|
= 0x60000000U;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_DiscriminatorShift
|
|
= 29;
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_StructTag
|
|
= 0;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_ComputedTag
|
|
= 1;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_ClassTag
|
|
= 2;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_OptionalTag
|
|
= 3;
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_MaximumOffsetPayload
|
|
= 0x1FFFFFFCU;
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_UnresolvedIndirectOffsetPayload
|
|
= 0x1FFFFFFDU;
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_UnresolvedFieldOffsetPayload
|
|
= 0x1FFFFFFEU;
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_OutOfLineOffsetPayload
|
|
= 0x1FFFFFFFU;
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_OptionalChainPayload
|
|
= 0;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_OptionalWrapPayload
|
|
= 1;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_OptionalForcePayload
|
|
= 2;
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_EndOfReferencePrefixFlag
|
|
= 0x80000000U;
|
|
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_ComputedMutatingFlag
|
|
= 0x10000000U;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_ComputedSettableFlag
|
|
= 0x08000000U;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_ComputedIDByStoredPropertyFlag
|
|
= 0x04000000U;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_ComputedIDByVTableOffsetFlag
|
|
= 0x02000000U;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_ComputedHasArgumentsFlag
|
|
= 0x01000000U;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_ComputedIDResolutionMask
|
|
= 0x0000000FU;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_ComputedIDResolved
|
|
= 0x00000000U;
|
|
static const __swift_uint32_t _SwiftKeyPathComponentHeader_ComputedIDUnresolvedIndirectPointer
|
|
= 0x00000002U;
|
|
|
|
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
} // namespace swift
|
|
#endif
|
|
|
|
#endif // __SWIFT_SHIMS_KEYPATH_H__
|