How Swift Achieved Dynamic Linking Where Rust Couldn't A look at what's required to ship a dynamically linked system interface, the most interesting parts of Swift's stabilized ABI, and their incredibly ambitious resilient library evolution system https://gankra.github.io/blah/swift-abi/
-
Show this thread
-
Replying to @Gankra_
Nice writeup! I should mention that Rust tried in its early days to do witness tables (“type descriptors”/“tydescs”). I wrote a lot of that code. Ironically, one of the big reasons we ripped it out was because of code bloat.
1 reply 0 retweets 27 likes -
IIRC switching to monomorphization actually *reduced* code size by quite a bit. Though the biggest reason was just performance: we couldn’t get type descriptor overhead below 20% of the program runtime or so, which was unacceptable.
4 replies 0 retweets 23 likes -
My final attempt to save tydescs was actually to compress addref/release/etc code into a generic interpreter that could parse an abstract description of the type. This reduced code size/compile time a lot but brought the overhead of tydescs to ~30% IIRC (could be misremembering).
3 replies 0 retweets 3 likes -
A problem we're running into is that unspecialized value witnesses tend to accrete and become super slow because tiny functions bump one refcount then call another generic field value witness
1 reply 0 retweets 1 like -
It seems like, at system scale, the interpreter approach could start winning because you can always build a flat interpreter string and do away with the intermediate abstraction barriers. Also you can use it as a uniquing key to find prespecialized layout-specific value witnesses
1 reply 0 retweets 0 likes
It feels to me like if you squint you always ship an IR somehow. Either you have a classic tree-walking IR with nested type descriptors, or you have an IR just for type layout, or you have an IR for the entire language (JIT or Rust’s approach), or you just ship AST.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.