freenode/#clasp - IRC Chatlog
Search
14:41:20
beach
I am asking, because I am attacking that stuff for the first time now, and it is very complicated.
14:41:45
beach
... which is why I decided I wanted to do it in HIR before the HIR gets further transformed and optimized.
14:52:42
drmeister
beach: We switch over entirely to cleavir - so the argument processing is done by cleavir.
14:53:37
beach
Somewhere there must be code to loop over all the arguments to find keywords, for instance.
14:57:55
drmeister
translate calls layout-procedure and layout-procedure calls the code that does argument processing.
14:59:44
Bike
there's also some weird issues with like, optional parameters, since the enter-instruction can essentially assign them to be undefined (if nothing was provided), and the body initializes it
15:02:06
drmeister
I see. We do some argument processing setup in layout-procedure and then actually generate code from the lambda list in translate-simple-instruction
15:02:07
drmeister
https://github.com/clasp-developers/clasp/blob/dev/src/lisp/kernel/cleavir/translate-instruction.lisp#L18
15:02:59
beach
If I could figure out a way to abstract the calls to ERROR, it could likely be done in a portable way.
15:03:53
drmeister
How would you deal with optimizations like lambda lists with only required/optional arguments that can use only registers vs more complex lambda lists?
15:05:52
beach
I abstracted everything, using two new instructions, COMPUTE-ARGUMENT-COUNT and ARGUMENT (access the i:th argument). The code would be further processed by HIR transformations. I don't generate keyword parsing unless the lambda list has keywords, of course.
15:08:07
drmeister
Does ARGUMENT take a lexical variable as input or constants? I'm figuring the answer is that it takes a lexical variable.
15:09:10
Bike
we have an important optimization in clasp in that we don't put all the arguments in a vector (so to speak) if there are few enough parameters and they're all required or optional.
15:10:22
beach
If there are no keyword arguments, or if the number of required+optional parameters is greater than the number of registers used, then the ARGUMENT instruction has a constant input, so it can be turned into a register access.
15:15:41
Bike
i wrote some c pseudocode for the optional and key parsing. there's also the split i mentioned - the code generator is just completely different if we skip the vector
15:15:52
beach
It is probably easier for me to explain what i did so far by showing you the HIR snippets that I will insert: chapter 25 of metamodular.com/SICL/sicl-specification.pdf
15:18:13
beach
My intention is to do it early in HIR so that the code will benefit from optimizations in HIR.
15:21:04
Bike
we call force-output in every cl:write. seems like that will destroy any pretense of buffering pretty quickly
15:26:59
drmeister
beach: Are you considering supporting something like clasp's &va-rest parameter? sbcl has something equivalent and I don't recall what it is called at the moment.
15:29:51
drmeister
Right - something like that - an &rest that doesn't cons a list on the heap. dynamic extent allocation might be worked out.
15:30:35
Bike
in clasp (and probably sbcl) we have three different cases - normal &rest, dx &rest, and &more/&va-rest which doesn't involve a list at all, it's a pretty raw vector.
15:32:03
Bike
drmeister: this is unrelated, but how would I test whether https://github.com/clasp-developers/clasp/issues/637 is fixed? I can load cl-unicode.