I've written compilers targeting both C and LLVM, and while LLVM does make some things easier, it also makes things like FFI harder (even with C), and like Rich says you give up a lot of portability.
-
-
Replying to @jckarter @RichFelker
You give up some portability. Not “a lot” of portability. Compiling to C also makes things like proper debug info and stack maps/register maps for GC harder (and by “harder” I mean “impossible”)
2 replies 0 retweets 1 like -
No, you just put the necessary data structures for walking live objects inside your objects rather than trying to access some underlying layer that would make it intrinsically nonportable.
1 reply 0 retweets 0 likes -
Replying to @RichFelker @jckarter
How, without runtime overhead? I see no way around having to spill every root to the stack around every function call (and that’s assuming you can walk your stack). “Portable” GC is a nonstarter from a performance point of view.
1 reply 0 retweets 1 like -
You don't make objects collectable if their lifetime can be known statically. Only objects where reference patterns don't admit static analysis need to be walkable.
1 reply 0 retweets 0 likes -
Replying to @RichFelker @jckarter
“Knowing the lifetime statically” means “stack and register maps”, which are impossible to do in C.
2 replies 0 retweets 0 likes -
No, that's dynamic. Static is a property you can determine in your HLL before doing any transpiling.
1 reply 0 retweets 0 likes -
Replying to @RichFelker @jckarter
I think you’ll find if you try to implement it that “static lifetimes” end up being equivalent to stack and register maps.
1 reply 0 retweets 0 likes -
It's not because it happens at a level where there's no such thing as stack or registers.
1 reply 0 retweets 0 likes -
Replying to @RichFelker @jckarter
All “statically live” objects have to be traced, no? So at collection time you have to find the set of objects that are “statically live”. That’s just a root set. If you’re keeping a dynamic list of “statically live” objects to scan, that’s just a shadow stack. Etc.
1 reply 0 retweets 0 likes
Not necessarily. No new ref needs to be tracked if you know its lifetime is a subset of that of an already tracked ref. This principle is very powerful for GC or ARC.
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.