Bennie or David (or both?) were looking for examples where regions help GC. I happen to be staring at one.
I'm implementing sign/magnitude BigNums (yet again, sigh). The addition operator (among others) can have a carry out. This means that you have to allocate an intermediate vector to hold the computation result, and that vector must be one word larger than the larger of the two arguments. In most cases, you won't use that word, and you'll want to trim the vector back down to a smaller length. The temporary result vector never escapes, but allocating it eventually triggers GC. Because it never escapes, that temporary could be stack allocated. Region analysis can easily detect this, and allocating the temporary in that way reduces GC pressure. There's a surprising amount of GC pressure that is produced in this fashion. It's why the stack allocation optimization is so importnat. shap
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
