[swift-dev] Builtin.loadRaw

Slava Pestov spestov at apple.com
Thu Sep 28 16:24:32 CDT 2017


Hi Sam,

The builtin is defined in lib/SILGen/SILGenBuiltin.cpp, look for the function named emitBuiltinLoadRaw().

However I suspect the problem in this case is not that the builtin is implemented incorrectly (it eventually lowers to an LLVM load instruction) but that something further upstream is going wrong, perhaps with alignment or endianness.

Can you tell us which unit tests are failing specifically?

Slava

> On Sep 28, 2017, at 2:16 PM, Sam Ding via swift-dev <swift-dev at swift.org> wrote:
> 
> I am testing a test case "KeyPath.swift" on s390x for v4.0 . It is found that " Builtin.loadRaw" as the below of 
> "stdlib/public/core/UnsafeRawPointer.swift.gyb" returns a different value than that on x86-64. 
> @_inlineable
> public func load<T>(fromByteOffset offset: Int = 0, as type: T.Type) -> T {
> _debugPrecondition(0 == (UInt(bitPattern: self + offset)
> & (UInt(MemoryLayout<T>.alignment) - 1)),
> "load from misaligned raw pointer")
> 
> return Builtin.loadRaw((self + offset)._rawValue) // return a different value on s390x vs x86-64
> }
> My debugger (lldb) does not guide me to the detailed of " Builtin.loadRaw". Searching "loadRaw" and finding
> swift/include/swift/AST/Builtins.def:BUILTIN_SIL_OPERATION(LoadRaw, "loadRaw", Special)
> 
> But I could not find the definition of this "LoadRaw" from the whole swift v4.
> Can anyone give me a hint where its implementation is?
> 
> Thanks,
> 
> 
> Sam Ding,
> Linux on z Systems Open Source Ecosystem
> IBM Toronto Lab, 
> email: samding at ca.ibm.com
> phone: (905)413-2947
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170928/fddb5d21/attachment.html>


More information about the swift-dev mailing list