diff options
| author | Rose Hogenson <rhogenson@google.com> | 2022-07-20 15:39:23 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-07-20 20:08:14 -0700 |
| commit | e615308b928585013461482f879f536527c5acc2 (patch) | |
| tree | dd00eef6713c103f755b98c5ffde1e2ca2d994f7 /csc/encoding.csc | |
| parent | Add builtin operations to IR1. (diff) | |
| download | chromatopelma-e615308b928585013461482f879f536527c5acc2.tar.zst | |
Perform argument conversion.
The point of argument conversion is to validate on each function call
that the right number of arguments were passed, and to ensure that no
function has more than 1 argument. This second condition makes CPS
slightly simpler, and ensures that the arguments will all fit in locals.
We take the strategy of allocating a vector for each function call.
Ideally we would optimize away most of these allocations, but for now I
just want it to work.
Diffstat (limited to 'csc/encoding.csc')
| -rw-r--r-- | csc/encoding.csc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/csc/encoding.csc b/csc/encoding.csc index 21ee88f..5c06bec 100644 --- a/csc/encoding.csc +++ b/csc/encoding.csc @@ -3,6 +3,14 @@ (import (scheme base) (only (csc match) match)) (begin + ; I'm only going to say this once, so pay attention. + ; The format of unboxed constants is described in bytecocde/src/data.rs. + ; Boxed values are represented by a pointer to an array on the heap. The + ; first position in the array is an integer code indicating what type the + ; object is. Vectors have code 0, codes for other types are not stable. + ; Vectors are represented as an array, the first element of which is the + ; integer 0 (the type code), the second element is the vector length, and + ; the remaining slots hold the array values. (define (right-shift n1 n2) |
