-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from madsmtm/static-sel
Add static selectors behind the `"unstable-static-sel"` feature flag.
- Loading branch information
Showing
36 changed files
with
3,324 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#[repr(C)] | ||
#[doc(hidden)] // Private for now | ||
pub struct __ImageInfo { | ||
// These are not actually `unsigned int`, even though the docs say so | ||
/// The version of the image info struct. | ||
version: u32, | ||
flags: u32, | ||
} | ||
|
||
#[allow(unused)] | ||
impl __ImageInfo { | ||
/// Unused | ||
const FIX_AND_CONTINUE: u32 = 1 << 0; | ||
const SUPPORTS_GARBAGE_COLLECTED: u32 = 1 << 1; | ||
const REQUIRES_GARBAGE_COLLECTION: u32 = 1 << 2; | ||
const OPTIMIZED_BY_DYLD: u32 = 1 << 3; // TODO | ||
/// Unused | ||
const CORRECTED_SYNTHESIZE: u32 = 1 << 4; | ||
/// Whether we're compiling this to run on a simulator. | ||
const IMAGE_IS_SIMULATED: u32 = 1 << 5; | ||
/// Whether we are generating class properties. | ||
const CLASS_PROPERTIES: u32 = 1 << 6; | ||
const DYLD_PREOPTIMIZED: u32 = 1 << 7; | ||
|
||
const SWIFT_ABI_VERSION_SHIFT: u32 = 8; | ||
const SWIFT_ABI_VERSION_MASK: u32 = 0xff << Self::SWIFT_ABI_VERSION_SHIFT; | ||
const SWIFT_MINOR_VERSION_SHIFT: u32 = 16; | ||
const SWIFT_MINOR_VERSION_MASK: u32 = 0xff << Self::SWIFT_MINOR_VERSION_SHIFT; | ||
const SWIFT_MAJOR_VERSION_SHIFT: u32 = 24; | ||
const SWIFT_MAJOR_VERSION_MASK: u32 = 0xff << Self::SWIFT_MAJOR_VERSION_SHIFT; | ||
|
||
/// Fetches the image info for the current runtime + target combination | ||
#[inline] | ||
pub const fn system() -> Self { | ||
// We don't currently do anything relating to class properties, but | ||
// let's just mimic what Clang does! | ||
let mut flags = Self::CLASS_PROPERTIES; | ||
|
||
if cfg!(target_simulator) { | ||
flags |= Self::IMAGE_IS_SIMULATED; | ||
} | ||
|
||
Self { version: 0, flags } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.