[swift-dev] Validating ABI consistency between runtime C++ and standard library Swift code

Dave Abrahams dabrahams at apple.com
Sun Oct 16 15:06:48 CDT 2016


on Tue Oct 11 2016, Joe Groff <swift-dev-AT-swift.org> wrote:

> 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.

I don't know if this helps, but I think in the long run we'd like to
code more of the runtime directly in Swift, for optimization purposes if
nothing else.  It won't make the problem go away completely, of course.

-- 
-Dave



More information about the swift-dev mailing list