freenode/#sicl - IRC Chatlog
Search
5:45:13
alandipert
yesterday i learned the penalty of doing my reader the async/incremental way... 10x, my ~50 line nascent boot.lisp took 100ms to compile
5:46:37
alandipert
i didn't notice the slowness since i'd been doing everything at a repl so far. fortunately i switched to sync pretty easily and now it's down to 8ms
6:32:44
beach
I need to sort out all the cases of non-local control transfer. And by that I mean a case where one HIR instruction is executed in some dynamic environment DE, but its successor is executed in a dynamic environment that is a strict suffix of DE.
6:35:32
beach
So let DE be the list of entries (e0 e1 ... en) and let the strict suffix environment SE be (ei ei+1 ... en) where 0 < i <= n.
6:36:59
beach
The simple case is when we have an UNWIND-INSTRUCTION. This instruction is emitted when we do not know what entries might exist in the prefix, because of some arbitrary intervening function invocations.
6:37:28
beach
Then we need to do a full transfer to an exit point as the Common Lisp HyperSpec describes.
6:39:43
beach
We traverse DE to find the entry to which we transfer control, "abandoning" intermediate entries. If no entry is found, signal an error. If an entry is found, unwind by abandoning the intermediate entries, calling thunks established by unwind-protect, etc.
6:41:14
beach
We can generate code for the UNWIND-INSTRUCTION as a call to a function that does all this, and then returns as usual. The generated code ends with a jump to instruction where execution must continue.
6:42:32
beach
Now for the tricky case. It is when there is no UNWIND-INSTRUCTION. Yet, we have a non-local control transfer.
7:05:33
beach
There are two complications that I need to return to. One is the dynamic environment of the successors of the CATCH-INSTRUCTION. The other has to do with whether entries of the dynamic environment are allocated on the stack or on the heap.
7:07:48
beach
Also, let's say that DE = (e0 ... en) is itself a prefix that has been established by the current function, and that the full dynamic environment FE is really (e0 ... en en+1 ... em) so that the current function was called with (en+1 ... em) as the dynamic environment.
7:08:23
beach
Now, for the case where we have a non-local control transfer, but no UNWIND-INSTRUCTION.
7:09:57
beach
There are two cases where this can happen. Case 1 is when the control transfer is a result of compiling a RETURN-FROM or a GO. Case 2 when it is not.
7:14:46
beach
In the first case, there is a BIND-INSTRUCTION that establishes an environment entry, and in the second case, there is an UNWIND-PROTECT-INSTRUCTION that also establishes an entry.
7:17:42
beach
A third case is the last instruction of a BLOCK. And a fourth, the last instruction of a TAGBODY.
7:20:36
beach
In case 2, there can be more than one entry in (e0 ... ei-1) because LETs can be nested, or A LET can be nested inside an UNWIND-PROTECT, etc.