libera/#sicl - IRC Chatlog
Search
15:44:46
beach
One thing that seems fairly simple to do about BLOCK/RETURN-FROM and TAGBODY/GO at the AST level is to determine whether unwinding is necessary or not. If the two are in different functions, then it is necessary, otherwise not. Unless I am missing something of course.
15:46:21
beach
Anyway, I think I have done enough work for today, so I'll spend the rest of the day thinking of other things I can do at the AST level.
15:54:28
bike
yeah, that's all you need, assuming you can still handle local unwinding like undoing special bindings etc.
15:56:44
beach
Ah, yes, forgot about that one. What I really need is to compare dynamic environments at the two points.
15:57:46
beach
It is funny how it all comes back to the same decisions we made at some point at the AST level. I had kind of expected things to be a bit more different.
15:58:22
beach
... like when we introduced the lexical variable holding the dynamic environment at the HIR level.
16:04:43
beach
Maybe I should introduce an explicit LET-AST for the dynamic environment. I mean, the dynamic environment comes as an argument to the function entry, and when there is a binding or a BLOCK or a TAGBODY, then I could bind the variable like (LET ((DYNAMIC-ENVIRONMENT DYNAMIC-ENVIRONMENT)) ... ). The question is then when to do that.
18:16:37
beach
You are right of course. Unwinding has to do with the stack and is needed only of the target is in a different stack frame. As long as things like bindings of special variables are dropped, unwinding is not necessary if the origin and the target of an exit point are in the same stack frame.
18:17:23
beach
And it is an important optimization because if unwinding is not necessary, then it is also not necessary to push an entry onto the dynamic environment.
18:19:25
beach
Another thing I just thought about is lambda lifting, which would be fairly simple at the AST level. But thinking some more about it, I think I found that lambda lifting is useful only in very particular cases. Lambda lifting alters the signature of the callee, so if the callee escapes, then lambda lifting can't be used.
18:19:28
bike
yeah. i called those operations local unwinding. getting that right was important back when clasp's unwinding was really slow, and it's nice to not have to allocate and push a dynamic environment regardless.
18:20:42
beach
[about lambda lifting] And if the function is not part of a cycle in the call graph, its environment can be merged with that of the caller, so then lambda-lifting is not needed.
18:21:06
beach
So that leaves the case where the function does not escape, and is part of a cycle in the call graph.
18:21:51
beach
I suppose, then, it is more efficient to pass another parameter than it is to access the static environment.
18:22:01
bike
i think lambda lifting is more or less subsumed by local calls, but i haven't thought deeply about it. it's the same thing of special stuff you can do with functions that don't escape so you can control their calling convention.
18:24:47
beach
It would be especially valuable when the static environment could then be eliminated entirely.