On Fri, Feb 27, 2015 at 11:22 AM, Keean Schupke <[email protected]> wrote:

> On 27 February 2015 at 19:17, Jonathan S. Shapiro <[email protected]>
> wrote:
>
>>
>> From a type system perspective I agree that you can supply as many
>> arguments as the function type supports. The problem is that you can't pass
>> two arguments in the same register.
>>
>
> Registerisation is an optimisation, at the language level we should assume
> there are infinite slots for arguments, which get passed on the stack.
> Putting arguments into registers should be an optimisation pass. This is
> what 'C' does and its plenty fast enough...
>

In very significant measure, the progress we have made from work on
functional languages has been possible *because* simplifying and
regularizing assumptions like this one were made, and implementation
realities were set aside. That, by the way, was a conscious decision at
Cambridge, and probably a good one.

But BitC isn't an academic language. In practical languages we eventually
need to deal with annoying and ugly inconveniences. Things like:

  - The calling convention sometimes isn't something we get to negotiate
  - The fact that natural alignments in memory matter
  - The stack is so much slower than registers that the difference *is*
semantic
  - We don't get to make the assumption that we can rewrite things
arbitrarily

As an abstract model from which to proceed with optimization, I agree with
what you say. Conceptually we can stack the extra arguments and move them
back into registers later. It brings on some tricky alias analysis in the
presence of by-reference arguments, but it can be done. It may even be a
good approach to consider from an optimization perspective.


shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to