Hi @Arnold - could you help me decipher the storeEnumTagSinglePayload of value witness for Swift.UInt8 type.
From my understanding, this will be done during compiler build phase. What I don't understand is why storeEnumTagSinglePayload assembly code for Swift.UInt8 and Swift._UIntBuffer.Index are so different and more importantly how are these 2 related (UInt8 and UIntBuffer.Index) and where is this relationship defined. From my understanding, GenType.cpp is responsible for IR code gen of storeEnumTagSinglePayload for all the data types.
storeEnumTagSinglePayload for Swift.UInt8
* thread #1, name = 'art', stop reason = breakpoint 1.269
frame #0: 0x000003fffdd6e928 libswiftCore.so`storeEnumTagSinglePayload value witness for Swift.UInt8
libswiftCore.so`storeEnumTagSinglePayload value witness for Swift.UInt8:
-> 0x3fffdd6e928 <+0>: stmg %r11, %r15, 88(%r15)
0x3fffdd6e92e <+6>: lgr %r11, %r15
0x3fffdd6e932 <+10>: lmg %r11, %r15, 88(%r11)
0x3fffdd6e938 <+16>: jg 4398010217664 ; storeEnumTagSinglePayload value witness for Swift._UIntBuffer.Index at <unknown>
storeEnumTagSinglePayload for _UIntBuffer.Index
libswiftCore.so`storeEnumTagSinglePayload for _UIntBuffer.Index:
0x3fffdd634c0 <+0>: stmg %r11, %r15, 88(%r15)
0x3fffdd634c6 <+6>: aghi %r15, -160
0x3fffdd634ca <+10>: lgr %r11, %r15
-> 0x3fffdd634ce <+14>: cije %r4, 0, 4398010217806 ; <+142> at <unknown>
0x3fffdd634d4 <+20>: ahi %r4, 255
0x3fffdd634d8 <+24>: srl %r4, 8
0x3fffdd634dc <+28>: ahi %r4, 1
...
I also see this warning during compiler build phase but not sure if it is a red-herring - part of me thinks this may have implications on this platform:
Foundation/NSString.swift:301:24: warning: 'unsafeBitCast' from 'UnsafeMutablePointer<Unicode.UTF8.CodeUnit>' (aka 'UnsafeMutablePointer<UInt8>') to 'UnsafePointer<Int8>' changes pointee type and may lead to undefined behavior; use the 'withMemoryRebound' method on 'UnsafeMutablePointer<Unicode.UTF8.CodeUnit>' (aka 'UnsafeMutablePointer<UInt8>') to rebind the type of memory
return unsafeBitCast(_storage._core.startASCII, to: UnsafePointer<Int8>.self)
Thanks again for any insight.