freenode/#sicl - IRC Chatlog
Search
9:10:05
beach
So I need a method that differs from the one on funcall-instruction in that it should do (funcall (car ...) ,@(loop...)) or (apply (car ...) (loop...)) except that i don't know what to put in place of ...
9:14:34
heisig
Let me check whether I understood that correctly. You want somethings like a 'symbol-funcall' instruction where the symbol is always a constant.
9:16:25
beach
So when the HIR program is tied to the environment, the function cell is populated from the environment, using the name.
9:17:00
heisig
So the only difference to a funcall instruction is that it doesn't call the first argument, but the car of the cell it closes over.
9:17:23
beach
The current method, specialized to FUNCALL-INSTRUCTION does (funcall ,@(loop...)) or (apply (loop...))
9:18:14
beach
What I need is then (funcall (car <the cell>) ,@(loop ...)) and (apply (car <the cell>) (loop...))
9:18:58
beach
Otherwise, the method would be almost identical to the one specialized to FUNCALL-INSTRUCTION.
9:19:33
heisig
If you can tell me how (and when) to pick the cell from the environment, I can write the rest.
9:20:47
heisig
And I can look that up directly while translating instructions to thunks, or do I have to wait until some tying phase?
9:26:04
heisig
No, MAKE-THUNK expands more or less into (lambda () ...). So one can just close over thinks.
15:27:30
beach
Here is what I am currently working on. I want to adapt the structure of the HIR code so that it is easier to translate to the final executable that is described in the draft paper on call-site optimization.
15:27:40
beach
To do that, I introduced an AST class and a HIR class for calls to global functions explicitly named on the call site. So a call such as (F ...) where F is global will no longer get translated to an FDEFINITION followed by a CALL, but instead to an instance of the new class.
15:27:46
beach
Then, instead of hoisting FDEFINITION-INSTRUCTIONS, I will just leave the NAMED-CALL-INSTRUCTIONs as they are for further translation. This translation will ultimately lead to an instance of something like CALL-SITE in the code object, and an unconditional JUMP instruction in the final code.
15:28:04
beach
But for the purpose of the HIR evaluator, I subclass the NAMED-CALL-INSTRUCTION and give it the function cell in a slot. I already have code for the HIR evaluator to translate this new instructions, and I have code to collect the NAMED-CALL-INSTRUCTIONs in HIR and stick them in a list in the TOP-LEVEL-ENTER-INSTRUCTION (which should probably be in the code object at some point instead).
15:28:06
beach
I now need to define the TIE function so that it goes through that list and fills in the function cells before the top-level function is called.