Exploring Swift and .NET

A couple of blog posts about my exploration of Swift and .NET:



TLDR: Based on a thing that converts LLVM bitcode to target the .NET runtime. Use that to compile the Swift runtime and Swift code for .NET. Proof of concept.


This is cool! Since this is at the LLVM level, is Swift still using refcounting, at least for native Swift classes? That seems pretty necessary given how much Swift depends on copy-on-write.

1 Like


Yes. Whenever Swift (or its runtime, or whatever) allocates memory, it comes out of what .NET calls the unmanaged heap, equivalent to a regular malloc.

Generally speaking, the primary goal is to simply compile Swift for a different platform, with no semantic changes. Integration with other .NET stuff is the second step.


And BTW, @jrose, I've spent a LOT of time reading your blog series on implementing the Swift runtime. Excellent stuff.

It sure seems like my task should be easier. I'm not implementing the runtime, I'm just trying to compile it into a form that isn't broken. But I've been through quite a few iterations, each time believing that I finally got it right, only to discover another problem. Like decoding a symbolic reference is broken. Or some piece of metadata can't be found. Or a relative pointer calculation failed. And so on. :grinning:

1 Like


1 Like
Terms of Service

Privacy Policy

Cookie Policy