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.