[bitc-dev] Opinions wanted: Infix shift operators

Jonathan S. Shapiro shap at eros-os.org
Fri Aug 6 13:50:54 PDT 2010


On Fri, Aug 6, 2010 at 11:45 AM, wren ng thornton <wren at freegeek.org> wrote:

> Jonathan S. Shapiro wrote:
> > I would actually prefer to use the currying syntax myself, and if someone
> > can show me how to make that work I think I would adopt it.
>
> For value-level stuff, the approach used by the spineless taggless
> g-machine (GHC's runtime machine) offers one way of implementing
> currying without the overhead you get from the naive implementation.
>
> Essentially, you use a closure of the eta-expanded form. The first
> pointer is to the code block, and the remaining pointers/values are the
> stack frame. (Thus, you can take over the extra pointer in the C call
> stack, just like OOP does for passing an object's vtable.) I'm assuming
> BitC uses a C-like call stack instead of putting everything in the heap
> like functional languages do, so the exact approach would need some
> modification to fit in with BitC's execution model, but I don't foresee
> any show-stopping issues.
>

I'ld be happy to look again, but this approach didn't seem to play well with
the registerized argument passing conventions used by most modern
processors. Basically, it works well if arguments can be accumulated on the
stack, but not very well if accumulating them requires shifting them around
between registers.

Beyond that, the decision to registerize arguments in BitC isn't elective;
it's prescriptive. It is mandatory to use the native calling convention.

If there is a way to do this without tying arity into function types, I'ld
really like that, and I'll definitely look at the spineless tagless G
machine work.

shap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.coyotos.org/pipermail/bitc-dev/attachments/20100806/3cb0ac52/attachment.html 


More information about the bitc-dev mailing list