[bitc-dev] Change to handling of procedure args/returns

Jonathan S. Shapiro shap at eros-os.com
Tue Jul 8 09:08:56 CDT 2008


Last night I introduced the following pragmatics changes into the C code
generator:

  1. Functions returning unit are now emitted to C as functions
     returning void.

  2. Parameters of unit type are no longer emitted in the corresponding
     C declarations or definitions, and are not passed at apply time.

     Note that by the time we reach the C code generator, an SSA pass
     has already been applied. This means that any side effects of the
     expression that computed the suppressed value still occur.

     This particular change wasn't critical; it was merely the simplest
     way to implement (3) below.

  3. If [after unit-type argument suppression] a procedure accepts no
     arguments, it will be explicitly emitted in C as taking no
     arguments.

The change is not a "deep" change: a procedure accepting an argument of
type (pair int unit) will still generate a C structure containing an
element of type bitc_unit_t. This should perhaps be optimized at some
later point.

I believe that these changes are all sensible. Since these
implementation choices have significant impact on linkage with other
languages, I believe that once we settle on a final set of pragmatic
representations of this form, they should be added to the specification
as implementation requirements.


shap



More information about the bitc-dev mailing list