freenode/#sicl - IRC Chatlog
Search
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
8:27:59
heisig
Oh, there is another naming discussion going on. 'Hucleberry' isn't so bad. A bit arbitrary, unless I missed something, but not bad.
8:29:00
heisig
And I also wonder where we'll put the code for the pretty printer. Will that be a separate project, too? Or will that be part of FORMAT?
8:44:19
heisig
Clostrum, Ecclesia, Cyclosis, Incless, Trucler, Eclector, CST, and Cleavir. Already more names than I can remember without looking them up.
8:46:23
heisig
A SICL homepage or wiki would be a great thing to lure in new developers. But it is not a pressing issue. Maybe something that could be looked at once SICL boots on its own.
8:47:12
beach
Yes, I am in no rush. I fear that I need to give more direction, or else people will work on things that I am not willing to incorporate.
8:49:24
beach
frodef: Do you have any plans to reuse any of the SICL code in order to create Fredman?
8:51:45
frodef
beach: but in general I don't want to duplicate work just for the sake of doing it, of course.
8:52:19
beach
Yes, that's also what I thought. And if Fredman can become an acceptable CLOSOS, that would save me a lot of work.
8:53:05
beach
no-defun-allowed: You need to know a bit about Scandinavian culture to get it. C.M. Bellman was an 18th century Swedish troubadour. Movitz and Fredman are recurring characters in his songs.
8:54:06
beach
frodef: It is not as ambitious as CLOSOS, but it exists, it runs, and it has lots of goodies like McCLIM.
8:55:07
frodef
I find Vreeswijk's and Åslund's "Movitz! Movitz!" to be the pinnacle of Bellman interpretation, btw.
9:02:51
beach
As I have said before, before I invented the technique for call-site optimization, I was convinced that SICL would not be among the fastest Common Lisp implementations around, so people might hesitate to make it the basis of an operating system. But now I am convinced it could be faster than any other Common Lisp implementation. But it won't happen without a lot of work.
9:04:21
beach
I would very much like to test my idea for a register allocator for instance, without which, things will be sluggish no matter what.
9:09:41
splittist
Why is register allocation so important? (You have taught me to be wary of any technique so established it is in every compiler textbook...)
9:10:54
lonjil
splittist: well, without allocating stuff to registers you can't actually do anything. What might be question is *how* registers should be allocated, I think.
9:12:19
beach
One well established technique is the global graph-coloring. It is pretty stupid in that it globally assigns a variable either to a register or to memory.
9:12:47
beach
Another one is linear scan, which is fast but presumably not as good as graph coloring.
9:13:30
frodef
beach: I have this vague inkling that there must be similar french music, but I haven't really gotten around to looking into it.
9:16:52
beach
The other idea I have is to base it on the paging algorithm OPT. Each program point would have an estimated distance to the next place each variable is used. When a variable is needed in a register and there are no registers available, evict the one that has the highest distance estimate.
9:18:13
beach
lonjil: A great popular composer is Jean-Jacques Goldman. It is not my favorite genre, but his stuff is good in that genre.
9:18:30
no-defun-allowed
There was one album Gnuxie and I enjoyed which is in French, but the musicians were from Quebec, so I don't think it counts.
9:23:18
beach
ralt: It was thanks to "Jack Allgood" who made a rule that radio must have 50% French music, that we finally got to get French quality music.
9:26:43
beach
ralt: I wish he would come back. I am working on a short story in French that contains almost 50% of English words that we hear daily on TV.
9:28:18
lonjil
frodef: Agner is probably one of the most knowledgable people in the world when it comes to what modern CPUs like or don't like.
9:28:54
ralt
language is spoken, for me, so whatever is deemed popular ends up being the language, by definition
9:29:46
beach
ralt: It is just that anglicisms in French sound very stupid, especially when they are pronounced the way they are.
9:32:36
beach
Il a monté un start-up pour acheter un cottage très cozy dans Center Parcs et c'est un véritable success-story.
9:36:09
frodef
https://www.agner.org/forum/viewtopic.php?f=1&t=41&sid=65636ac8be2a1901fcab6adb3bd0d08b stuff like this might have serious impact on run-time (and compiler) design.
9:46:52
beach
The problems with that kind of stuff are: 1. Since it is not documented, it may disappear in future processors. 2. It is specific to AMD and even to a particular processor family.
9:47:58
beach
So exploiting it in the compiler would mean some complex configuration scripts and/or run-time measures.