4 ms·
Oh got it. So like c# but compiles to native a la Swift?
by flafla2 2y ago
Oh got it. So like c# but compiles to native a la Swift?
- bru 2y agoThere's more languages than Swift...
- zamalek 2y agoDidn't you watch the latest WWDC? Apple invented programming languages.
- neonsunset 2y agoWhat does .NET JIT emit? What does NativeAOT compile .NET applications to? :)
- flafla2 2y agoOh neat I’ve never heard of NativeAOT. I’ve only used Unity’s AOT compiler “Burst” for C# (I assume that is something different?). Cool stuff. edit: Actually I meant to say Unity’s IL2CPP, which transpiles IR to C++. Burst is a different tool with similar goals—it compiles IR straight down to native via LLVM.
- neonsunset 2y agoTo be precise, runtime is an umbrella term. Swift, C++ and Rust usually have """runtime""" just as much. Which includes but not limited to: - Automatic or semi-automatic memory management - Threadpool and, optionally, async abstraction implementation - APIs to introspect type system properties / reflection Swift very much has all these. And so does .NET. As for Unity, it has diverged and lags behind "vanilla" .NET in features, language versions and performance significantly, so the experience of using it won't translate to what is expected to be "normal" C#/.NET of today.
- pizlonator 2y ago(I’ve worked in an AOT for .NET and I’m a JIT expert.) Even if you compile MSIL to native, you’re compiling to the GC’s ABI, which is definitely very different from what Vala and Swift do.
- neonsunset 2y ago.NET follows platform calling convention. GC reference assignment to a memory location does involve going through a write barrier (main user of which is concurrent mark phase of GC) but otherwise it's just plain Windows or System V ABI for the respective ISA. Practically speaking, you cannot call .NET methods directly unless they are annotated with [UnmanagedCallersOnly] which is necessary to ensure GC is in consistent state, module initializers have ran, etc. This is a concern for NativeAOT libraries as you don't have to explicitly call their entrypoint before calling them AFAIK. This, however, is true for most languages that are not C. This is also a constraint for both Swift, which has its own reference counting and ABI (Library Evolution ABI) and likely Vala assuming it is reference counted. The runtime vs runtime-less arguments are not exactly helpful given the context - there are """runtime"""-heavy interpreted languages like Python, Elixir or JS, there is Java which assumes JVM, but is already lower level, and then there's .NET, which under the hood looks a lot like a strange flavour of C++ when you e.g. inspect the AOT binaries with Ghidra. Fun fact, native profilers work with NAOT applications transparently on all platforms. You can hit "sample" in activity monitor on macOS and it will show you fully symbolicated trace if symbols are available. Just recently, I used Samply to perform multi-threaded profiling and it worked just as well as it would for something written in Rust, if not better.
- pizlonator 2y agoSwift and Vala and any other eagerly reference counted language don’t have to worry about native C code squirreling away a reference to a GC’s object and not responding to a GC marking callback (either because the mechanism doesn’t exist or because it isn’t used correctly). That’s an enormous difference in ABI.
- neonsunset 2y ago