mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[AVR] standard library support for AVR
- when compiling embedded cross compile target standard libraries, include AVR - add 16-bit pointer as a conditional compilation condition and get the void pointer size right for gyb sources - attempt to fix clang importer not importing __swift_intptr_t correctly on 16 bit platforms - changed the unit test target to avr-none-none-elf to match the cmake build [AVR] got the standard library compiling in a somewhat restricted form: General - updated the Embedded Runtime - tweaked CTypes.swift to fix clang import on 16 bit platforms Strings - as discussed in https://forums.swift.org/t/stringguts-stringobject-internals-how-to-layout-on-16-bit-platforms/73130, I went for just using the same basic layout in 16 bit as 32 bit but with 16 bit pointers/ints... the conversation is ongoing, I think something more efficient is possible but at least this compiles and will probably work (inefficiently) Unicode - the huge arrays of unicode stuff in UnicodeStubs would not compile, so I skipped it for AVR for now. Synchronization - disabled building the Synchronization library on AVR for now. It's arguable if it adds value on this platform anyway.
This commit is contained in:
@@ -41,9 +41,12 @@ public struct HeapObject {
|
||||
#if _pointerBitWidth(_64)
|
||||
static let doNotFreeBit = Int(bitPattern: 0x8000_0000_0000_0000)
|
||||
static let refcountMask = Int(bitPattern: 0x7fff_ffff_ffff_ffff)
|
||||
#else
|
||||
#elseif _pointerBitWidth(_32)
|
||||
static let doNotFreeBit = Int(bitPattern: 0x8000_0000)
|
||||
static let refcountMask = Int(bitPattern: 0x7fff_ffff)
|
||||
#elseif _pointerBitWidth(_16)
|
||||
static let doNotFreeBit = Int(bitPattern: 0x8000)
|
||||
static let refcountMask = Int(bitPattern: 0x7fff)
|
||||
#endif
|
||||
|
||||
// Note: The immortalRefCount value of -1 is also hard-coded in IRGen in `irgen::emitConstantObject`.
|
||||
@@ -55,8 +58,10 @@ public struct HeapObject {
|
||||
|
||||
#if _pointerBitWidth(_64)
|
||||
static let bridgeObjectToPlainObjectMask = UInt(0x8fff_ffff_ffff_fff8)
|
||||
#else
|
||||
#elseif _pointerBitWidth(_32)
|
||||
static let bridgeObjectToPlainObjectMask = UInt(0xffff_ffff)
|
||||
#elseif _pointerBitWidth(_16)
|
||||
static let bridgeObjectToPlainObjectMask = UInt(0xffff)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user