freenode/#sicl - IRC Chatlog
Search
20:44:47
no-defun-allowed
I agree with ebrasca, cl-decentralise2 isn't a library for binding to a foreign library. But I don't like the name.
20:53:12
no-defun-allowed
Not really, I'm not sure how beach makes up names, except that they end up with "cl" in the name, possibly by changing a sound like "cl" to "cl".
21:50:29
no-defun-allowed
Silly question, I read that Cleavir will prove dynamic-extent declarations before stack allocating. Would it be possible to have a (non-portable) declaration that runs escape analysis on any binding? Then, say, I could ensure that a user of a mutex box isn't doing something stupid; for example, (let (x) (with-unlocked-box (x* box) (setf x x*))) may or may not be a problem.
21:55:29
no-defun-allowed
The declaration would have to accept different policies for what's okay with escaped values, say, I might have a list which I don't destructively modify, so that could escape, provided it's never destructively modified. But this analysis wouldn't be particuarly useful without verifying that the value won't escape through calling another function.
22:49:25
Bike
SICL will prove dynamic-extent declarations before stack allocating them. Cleavir does not include the part of the compiler that makes a policy decision like that.
22:49:55
Bike
Am I understanding correctly that the declaration you want is just dynamic-extent, but you want to be sure you get a warning if it's incorrect, and don't much care about the allocation?
22:51:29
no-defun-allowed
I think so, but in some cases, it might be okay to have a value escape, provided it isn't destructively modified.
22:56:06
no-defun-allowed
Not a lot. But the escape analysis is to make sure we don't use the value of a box, when the box isn't locked, and there are a couple of places where it might still be okay to pull a value out without copying it.
23:05:48
no-defun-allowed
Hm, that could get weird if you try to do something like an atomic POP on a list stored in a box. You don't share any values with the value of the box after releasing it, but the first value could be seen to have escaped.
4:07:53
beach
no-defun-allowed: I didn't understand the description of what you wanted. Did you get enough information from Bike?
4:09:00
no-defun-allowed
I'm thinking about how dynamic-extent would relate to the verification I would like. It's a good first approximation though.
4:11:08
no-defun-allowed
(Also, for reference, the .NET platform further complicates the blocking kludge with the green thread hack, to maximise throughput in the presence of blocking, while minimizing the number of OS threads used, using hill climbing <https://mattwarren.org/2017/04/13/The-CLR-Thread-Pool-Thread-Injection-Algorithm/>. Eugh.)
4:12:26
beach
If you need information about the dynamic-extent stuff from me, you need to explain it a bit more.
4:43:21
Bike
the idea of cleavir providing tools for extended compiler analyses is interesting though.
4:44:06
Bike
i've heard people say before that they'd like a no-consing declaration, meaning that the compiler signals a warning if it can't prove that a given body of code doesn't cons. like for if you're writing a garbage collector
4:45:12
beach
I bet there is a host of "warn me if this isn't true"-type declarations that could be useful.
4:49:02
no-defun-allowed
What I would like is almost dynamic-extent, but there are certain kinds of escaping that are useful, and indeed safe. For example, if a mutex box contained a list, and then I updated it to store the CDR of that list, then there would be no problem with the CAR escaping. In this case, it's fine as long as nothing escapes which is still in the box.
4:50:17
no-defun-allowed
But then, another user might be okay with the CDR escaping, as that is also safe as long as the list structure isn't modified. (It could become stale, of course, as updates wouldn't touch that list structure, but that's fine.)
4:50:43
beach
I have no idea what it means for a mutex box to contain a list. I guess I don't know what a "mutex box" is.
4:51:10
Bike
i think it's a cell except you have to hold a lock around any reads from or writes to it?
4:51:28
no-defun-allowed
Thanks for reminding me. It's what Bike said; a structure with a lock and a value, and you can only get to the value by acquiring the lock.
4:53:16
Bike
for example, it seems to me that that while an atomic pop might be okay, if two thread non atomically popped a list they could get the same car, and then if that escaped you could end up simultaneously mutating the car object in multiple threads with no ordering
4:53:44
Bike
the relation is that certain operations are only supposed to take place within the dynamic extent of a with-lock-held kind of form
4:54:07
no-defun-allowed
"The ability to access the value" has dynamic extent in my opinion. My protocol has a WITH-UNLOCKED-BOX macro, just like that.
4:56:04
Bike
it's possible the compiler could help, but i'm not sure it would have much to do with analyzing the extents of values
4:57:17
Bike
i think tsan does this kind of thing in llvm land, but i don't know much of anything about it
5:01:19
Bike
if you want to detect data races there are a lot of things to know. you kind of want to track every value throughout the program and also get a complete graph of the happens-before, or whatever that's actually called, and both of those are hard to get (the first is obviously impossible to get precisely). but if you have it you can go, here, this operation here and this operation there can race