<div dir="ltr">> <span style="font-size:12.8px">getting the ABI slightly wrong</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Does this call for something like a validation pass? It would seem appropriate to apply it to SIL and not LLVM IR since it's inter-language ABI specific to Swift frontend.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 11, 2016 at 8:17 PM, Daniel Dunbar via swift-dev <span dir="ltr"><<a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can you directly pass arguments to the function crossing the ABI boundary, and can you directly access them on the other side? If so, what you can do is simply synthesize arguments that cross the full range of the bit-representation of the argument types, and validate that you see the same range on the other side.<br>
<br>
I don't know anything about what this interface looks like so I don't have more specific ideas, but if you can give me a little more context I've worked on this in the past...<br>
<br>
Technically you can't necessarily compare the LLVM IR, since there are ways to represent the same ABI call with different #s of IR arguments in corner cases.<br>
<br>
- Daniel<br>
<div class="HOEnZb"><div class="h5"><br>
> On Oct 11, 2016, at 8:10 PM, Joe Groff via swift-dev <<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a>> wrote:<br>
><br>
> I just tracked down a bug due to C++ code in the Swift runtime code trying to interface with standard library code written in Swift, but getting the ABI slightly wrong and leading to some nasty hard-to-reproduce heisenbugs. While I've narrowed down the bug in this specific case, it seems like this is a potentially continuing source of maintenance bugs, especially as we try to bring up the Swift calling convention in the coming year. I'm wondering if there's anything we could do to help validate that C++ and Swift code in the runtime is correctly interfacing. We could at least check that we're passing the right number of arguments by comparing the LLVM IR of the runtime and stdlib, perhaps, though this would have to be a fuzzy type-level match since Clang and Swift aren't normally going to agree on the exact pointer types of arguments.<br>
><br>
> -Joe<br>
> ______________________________<wbr>_________________<br>
> swift-dev mailing list<br>
> <a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-dev" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-dev</a><br>
<br>
______________________________<wbr>_________________<br>
swift-dev mailing list<br>
<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-dev" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-dev</a><br>
</div></div></blockquote></div><br></div>