I think, at a higher level, using *any* language as a compiler target requires thorough understanding of the target language semantics—even assembly language
-
-
Replying to @jckarter @RichFelker
I agree…so why make life hard for yourself? :) Pick an intermediate language that was designed as a compiler target.
2 replies 0 retweets 1 like -
Replying to @pcwalton @RichFelker
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.
2 replies 0 retweets 2 likes -
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 -
Replying to @pcwalton @RichFelker
Fair, I've never tried to write a GC language targeting C. The portability situation is better now, sure; back when I started playing with LLVM even Windows support was shaky.
1 reply 0 retweets 2 likes -
A GC language could target C by storing all heap pointers on a shadow stack or similar. Remember how the Factor runtime used macros and later smart pointers for that
1 reply 0 retweets 1 like -
Yeah, you could do that, or you could use conservative GC. It won’t be perf-competitive with the best GCs though.
2 replies 0 retweets 1 like -
Replying to @pcwalton @slava_pestov and
Why wouldn’t a conservative GC be competitive?
1 reply 0 retweets 0 likes -
Replying to @jfbastien @slava_pestov and
It can’t be a moving GC, which means it can’t have bump allocating TLABs in the nursery. So malloc will be slower than it needs to be.
1 reply 0 retweets 0 likes -
Replying to @pcwalton @slava_pestov and
The JSC GC is conservative and non-moving, seems to be doing fine. Agreed malloc when you can't just bump a pointer isn't as fast, but you have other costs that this, no?
2 replies 0 retweets 0 likes
Well, to be honest I don’t really have the motivation for a Twitter debate about GC strategies right now :) Suffice it to say that if you’re targeting C you’re limited in your choice of GC algorithms.
-
-
Replying to @pcwalton @slava_pestov and
We're debating?
Agreed that targeting C limits GC algorithms. Really it's Boehm or do something else than C
https://www.youtube.com/watch?v=wxrbOVeRonQ …1 reply 0 retweets 1 like -
Replying to @jfbastien @pcwalton and
Boehm is "something else than C". It's 100% filthy UB. But you can do GC in C. Just not on arbitrary C objects, rather higher-level object you implement in terms of C ones.
1 reply 0 retweets 0 likes - 4 more replies
New conversation -
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.