[swift-dev] Returning more than two scalars from C code

Jordan Rose jordan_rose at apple.com
Tue Mar 22 15:10:53 CDT 2016


> On Mar 22, 2016, at 12:06, Bryan Chan via swift-dev <swift-dev at swift.org> wrote:
> 
> jgroff at apple.com wrote on 2016-03-22 02:37:47 PM:
> 
> > The runtime functions are hacked in various unsavory ways to give 
> > them Swift-like calling conventions. Many of them also have 
> > important semantics that the compiler needs to be aware of, so if 
> > they aren't exported as standard library API in some way, you really
> > shouldn't interact with them directly. 
> > (swift_class_getInstanceExtents happens to be OK, but what are you 
> > trying to do with it?)
> 
> I am trying to build Swift on a different architecture (s390x). This
> function was causing crashes due to the ABI mismatch, and I also
> found that the issue is not 100% fixed on x86 either, so I wondered
> if the community has an opinion on the right way to deal with this
> in the runtime, or if the answer is simply "don't do this for
> 3-scalar returns".
> 

To be clear, @_silgen_name is unsupported for general use (generally true of anything that starts with an underscore). We use it in the standard library for certain things that can't be expressed in C, but there are plenty of places that can be expressed in C that maybe should be using the SwiftShims headers instead. We use it in tests because of laziness. You should really not use it for production code.

Jordan

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


More information about the swift-dev mailing list