freenode/#sicl - IRC Chatlog
Search
15:13:02
beach
Argument parsing can be very complex, in particular in the presence of &REST and &KEY parameters. In some situations I need to call Common Lisp functions, like ERROR if there is a problem and CONS to create the &REST parameter.
15:13:15
beach
The code for argument parsing involves registers and arbitrary memory locations, so it does not belong in HIR.
15:13:22
beach
But introducing this code after HIR has been completely processed would be painful, because calling ERROR and CONS involves hoisting FDEFINITIONs and processing the resulting shared variables, something we have already done at the HIR level.
15:13:29
beach
So I came up with this solution: I am planning to introduce some new HIR instructions that take care of chunks of what is required to process arguments, like MORE-ARGUMENTS-LEFT-TO-PROCESS-P, DECREMENT-REMAINING-ARGUMENTS-POINTER, and the like.
15:13:32
beach
This way, I can introduce argument parsing before most HIR transformations happen without violating the invariant of HIR that only Common Lisp values are manipulated.
15:14:33
beach
I have not yet come up with a list of the exact instructions I need to introduce, but I will do that in the next few days.
19:15:49
karlosz_
one thing i'd like to see is that the instructions are not too opaque, so that hir transformations could transparently optimize parts of the argument handling
19:16:41
karlosz_
especially with respect to &rest args where the rest parameter never needs to be consed because it is only queried by nth or via dolist