Files
swift-mirror/include/swift/Runtime/Config.h
John McCall 590c25479d Use isa-masking to read the class object pointer from
instances of Swift subclasses of ObjC classes.

We were already doing this in the runtime.  This patch
unhides the runtime's mask word (swift_isaMask) and makes
IR-gen take advantage of it when it can.

Swift SVN r21592
2014-08-29 21:36:53 +00:00

51 lines
1.6 KiB
C++

//===--- Config.h - Swift Language Platform Configuration ------*- C++ -*--===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// Definitions of common interest in Swift.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_RUNTIME_CONFIG_H
#define SWIFT_RUNTIME_CONFIG_H
/// Does the current Swift platform support "unbridged" interoperation
/// with Objective-C? If so, the implementations of various types must
/// implicitly handle Objective-C pointers.
///
/// Apple platforms support this by default.
#ifndef SWIFT_OBJC_INTEROP
#ifdef __APPLE__
#define SWIFT_OBJC_INTEROP 1
#else
#define SWIFT_OBJC_INTEROP 0
#endif
#endif
/// Does the current Swift platform allow information other than the
/// class pointer to be stored in the isa field? If so, when deriving
/// the class pointer of an object, we must apply a
/// dynamically-determined mask to the value loaded from the first
/// field of the object.
///
/// According to the Objective-C ABI, this is true only for 64-bit
/// platforms.
#ifndef SWIFT_HAS_ISA_MASKING
#if SWIFT_OBJC_INTEROP && defined(__LP64__)
#define SWIFT_HAS_ISA_MASKING 1
#else
#define SWIFT_HAS_ISA_MASKING 0
#endif
#endif
#endif // SWIFT_RUNTIME_CONFIG_H