Add a meeting Rate this page

A

So how are you all doing? Hey.

B

Guys, how are you.

A

um Like there's been some some progress yeah, you drive I'm kind of just coming from another me yeah, okay,.

B

Give me a second ouch I'll share the screen quickly, grab everyone the background.

B

How long so, basically, what we're trying to do is come up with a new way of well figuring out a way of expressing how we want to how we will be representing. How do we capture closures, so I sent out I wrote this dog over the weekend eyes and out of I, think everyone, and let me figure out how do all right- that's where Shana's all right and I think you all right here, fun. Yes, so basically what this document and list is what we currently have and I'll quickly go over all of them.

B

So initially when we do a quick pass over or user code base and I think this is very soon after we process the ASD we kind of generate for each closure that we have. We generate both local variables. We are capturing and and map it to a span which basically tells us, which is the last axis of that local variable within that closure. So if you look at c1 we over here, we map that we have this closure.

B

C1 that uses this local variable and when P we just look at the root variable, so that would be P in our case and we map it to the axis, which is the her ID for over here.

B

Once we are once we start, processing and start generating type information and build start building our type def tables. We move on to the structure, which is called. We start building these two structures. One is called for your captors.

B

The other is up for capture map and closure capture is very similar to upwards mention and it Maps the route ID to to basically not priority, which is basically that the route ID combined with the actual closure definition ID and effort captures uses this apart- that we generated in our previous step to sort of explain how we are capturing different variables. So in this case let's say and c1 all we are doing is we are reading the value. So all we need to do is get a reference to P and that's all and very good.

B

But, however, if we come down somewhere over here, we are mutating p p2. So what we want is we want a rough, we want a reference and we want it to be a mutable reference, so we see something like by reference and that's a mutable borrow and it's possible that we want to move the value inside the closure. So in case of an F and once closure, we will end up having have something like a by value and the idea is we copy by value we move, move, move the object and.

A

When is the move is independent from being everyone's? Okay,.

B

It.

A

Actually has more to do with. Does that closure or keep references into the stack, which means it can't be returned, for example, you would how many times the closure is called.

B

And move on so currently what we do is we just have reference to this road variable, so we know that we have P or we have Miller P or we have p2 and we're trying to access these variables within the closure. But what do you want to express is a lot more specifically and precisely what we calculate.

B

So it's just saying: oh we're using p2 here we want to say we're using the field X within p2 and so I think everyone similar, maybe I've, been doing a bunch of work around making what we call a place, which is which represents how memory is accessed a lot more precisely so, Archer has a PR up to store type information within each axis in a place, so, let's say 5p3 dot.

B

X then I know that I'm starting off from a local variable or in let's say, or an capture variable, which is p3 and what I do is I access. The field extra man depending on if p3, is a reference or not. We might also have something like oh I need to, firstly, reference p3 and then acts as a field X. So what Archer, just finishin I think it's been approved, is at each step.

B

We store what the resultant type was after applying what we call this projection, which is basically saying: okay, I access field, X, one important thing to note is the place: has this field called base which basically a plate? It's it represents what our starting position like very starting off. So if it's an upward, it means you're working off a capture variable if it's local. That means you're working off a local variable or an argument in our case.

B

So the way this information is generated, is we so when we do our first, so we start with an initial passes soon after the ast is built. We we build our upwards mansion, which basically captures what the root variable is being captured and barracks or how it's being captured in case. We need to report an error and by how I just mean like location in within the file average being captured, and so we basically had a hollow.

B

What you do is we trade, our waiter, a call photograph and we basically collect all the local variables that are there once that is done. We collect start going over and looking at all kinds of accesses and we figure out which ones were if the. If we know that the variable we're using was a local variable, we ignore, if it's a capture, variable, we store it and, of course mention and we collect the span, which again is used for error reporting during type check process. We start building cluttered captures and that's currently very simple.

B

We go over of course mentioned, and we create a closure for ID, which is basically pairing, the her ID and the closure def ID, and we have our ah Friday and we just store that as a map.

B

Awkward capture map is a little bit more subtle and it's so the way we do it is we define another visitor, it goes and walks our call photograph and what we do is we define this for a function context. So, within the what we want to do with this is in type over here as we want to analyze our closures within a function context. So every time they see the function, the visitor sees a function closure expression. So it will look something like so it looks something like this within our.

B

So it looks something like this with an arm as an expression. What we do is we take the body we visit the body and what did he and what we do is we go analyze this body and there's a possibility that when we analyze the Safari, there's a nested closure, but and will basically start this whole process again, it kind of was a little recursively, as you would expect, and once we are done Anna like walking over the body.

B

What we do is we go analyze the places and we store them as captures, and we know or sorry whenever we see a place being used. What we do is we so easiest thing called expertise, visitor and what it does is. It can again walk the whole tree all over again and figure out how each expression is being used and what it does. It calls into this callback to.

B

Basically update the borrow kind information so initially using and I sorry I skipped over this part, but over here, if we go, we see that we can. We can have sort of hints and they're all so I guess required, and certainly, if you have something like this, you need to market or immutable. But this tells when we're processing this, that this is going to mutate something. So we can initialize all our capture States as that this is going to be a reference and we need to take a mutable reference.

B

What we we keep iterating are we slowly go and iterate over all our expressions that are within this closure body, and we try basically expert use visitor, will call in to say hey I'm, going to borrow something I'm trying to mutate something or I'm going to consume a particular place, and that gives us an idea. Okay, we need to go and update the bar opine for how an expression is being used or how a capture is being used, and that is how we slowly build a stable.

A

Specifically today, yes,.

B

And we basically build this for the route local variables and so just to take it, and if this is a, if we see a closure within a closure, what will happen is since we already process the body of the closure before we started analyzing it all. Nestor closures have been previously processed completely, so we can just read the list of captures and there borrow kind information and use that to update our information. So just to give a quick example. Let's say we have this function, food that has closure which has an extra clutter within it.

B

We'll start visiting details within foo and we see. Oh, we have a closure over here. Let's process that which means we don't go inside the body and start processing, it we'll see C 2, which is again another closure, so we'll start processing that closure. First, we process this closure.

B

We see I'll be doing a drop a so that means we I probably need to move a and consume a so we store that borrow kind information once that is done once we're done, processing, C 2 and since this is the last thing within C 1 will start analysis of the closures within C 1. So we see o or we start do the analysis on the captures within C 1 we come over here. You see. Oh, we have this closure expression over here. Now we don't need to process this again because we have already.

B

We have capture information for it, so we can just read information for it and update the information about C 1. Here now it did not say move over here. So our initial guess, first, a might have just been reference by reference by an immutable reference, but we see OC two is using requires moves, so we can consume it in our case over here and we build a stable now that again, as I mentioned already, the problem is, we are.

B

If this were, let's say, structure and I was only dropping a dot X or something like that we would be. We would be dropping the whole structure. So what you want to do is you want to use place. This is more for this. What we really want to do is we want to use a place to express how we are capturing information and store that capture information.

B

So now we have so what Nikko proposed do is have something like we have an fx index map. So the reason we need an index map is I'll actually go over some of these places. So the way the main different kinds were using, it is so either to get the her ID of the route variable that we're using. So this can be useful just to see how a variable is used and borrow checker and other places or while they're building mi RV it.

B

This is basically what identifies what's being captured so far certain places we might also need more than just oh, if it's a capture more than just that, if it's a capture variable, but also how we are capturing it. So if it's a mutable capture immutable capture, if it's a move in case we're trying to report errors, there's two ways: we can report errors either we can report an error saying all right, you're trying to there's something.

B

That's mutable or, let's say I'm, trying to report an error over here which says for some reason: I cannot mutate M effects because it wasn't. Let's say: I was trying to mediate m effects over here and it was like. Oh it's a you, cannot mutate M effects over here, because it's not it's not a mutable reference, so I would probably want to give an error over here saying it's immutable rough.

B

It's not a mutable reference and that's where you're trying to do something like this, assuming this was let's say, a minus 4x, plus 20, or some codes money and there's the other concept of definition span where we might want to point over here saying: oh, this is not my mutable and we can in a certain way so there's the concept of definition span, which is access pan.

B

So, therefore, depending on what kind of error we're trying to report, we might need access to the actual expression that captured that that caused a certain kind of capture once we start getting into the MIR rule. So we start with the attire and we started with B sugar disclosure. We try to express each capital variable as a field within a structure, and the way we just represent is like oh, the first scatter variable is. This is the first field within the structure. So what we do is we basically add some indexing, so field.

B

First capture gets the index one well index 0, the second capture gets index 1 and the reason this is opposite over here is: if we go and see 4, we see that over here we first capture mirror P dot, X and then we capture, P mitr P, has a char, ID 2, which basically means when we captured. We look at it as if it were the first capture within this larger context. So this has the index 0 and the other one has index. 1 also feel free to stop me if something does not make sense.

B

I, don't know if I'm going to break here so.

B

Basically, this is what we want to do. Is you want to associate and and I like a capture with an index and also the other way around? If I give an index, I need to be able to find out what kind of thing I'm captured? What is the actual capture behind it?.

A

This time check is for 17 minutes in I. Do have to go at the half hour. Probably so far everything sounds quite accurate, I, don't know. If you running how much you want to say, you might want to make sure you get to it, though. All.

B

Right, ok, that's that's! That's fair! So, ok, what what nigo proposed was. We have something like an effort index map where we have the her place and capture information, so capture information is very being used, so this allows us to get the access band capture mode allows us to yet again it's similar as to capture kind, where we store how we are storing that information.

B

Now we are using an index map so that we can satisfy our needs of being able to associate a capture place with an index, and what we want to do over here is I think this should work for the most part, mostly because her place will have the base place location. So we know from the place base. We know what the route variable is.

B

Projections will allow us to classify things a lot more. Accurate will allow us to capture places more precisely.

B

The only thing I am actually it might not be in you might so. There are places where we try to get information based on the her ID of the capture, so we might want to be able to associate, have be able to query this map using what the her ideas are. Some some kind of information related to capture so.

A

One thing there are two things maybe first of all, it certainly is possible to make a place from the variable here ID easily, and so we could do that. But one concern I have is I, think long term.

A

We're probably going to want to evolve this structure or a few times is my guess, and in particular, if you, if you think about the stuff that compiles to mirror I, think that we don't wanna work is gonna, be an expression like a dot, B, dot, C right and some prefix of that we may have got sure Dan we can uh you're gonna recur, sit down so you're gonna start from a dot, B, dot, C and then that's gonna process, a dot, B and then that's gonna press.

A

It hey, that's how it works today, and so we can either on that way down detect ah this whole piece of expression is they're. Actually gonna reference, a closure, a part or we could do it on the way up right. So we get all the way down to a and we say Oh a comes from outside, and maybe we don't yet. Maybe we actually captured eight be right, so it might return.

A

Then I will be probably at that point where we're just looking at the a expression I can't pick which apart you want to use yet because we need to know that it's a dot B, but we've gone too far in so what we might do in that case would be to return something. That's like this was an up bar, here's the place so far, but it doesn't yet match any of my captures right.

A

It's like an incomplete match and then, when we get to the dot B, we would say: oh I'm, adding the field B I'm, extending this place. I have that ah this is a match. Here's what I want to use I think that's how we're gonna probably want to do it. Okay, I think.

B

That does make sense and.

A

Well, the sense, but now that I say it out loud I, see that many of this data structure would even work for that algorithm. I.

B

Was imagining we.

A

Might want more like a tree based thing or something actually might work just like it is, but for the interim I think we would build it like this and then, whenever you have to borrow your ID, you just make a dummy place with no projections and the base is always a local variable and the type is the type of that local variable and I. Don't think that type I think that should work.

B

Indexing the map would require like like we can like derive partial EQ, but my concern would be that a dot, B, dot C and a dot b. Dot d are two very separate, like they're they're, the completely disjoint over here, and if we build a partial place with our projections, then we might have conflicts well,.

A

Well, you know, for the time being, all the keys are always going to be just a local variable right. Yes,.

B

Burnley, yes,.

A

Right, okay, your eyes, partial EQ and then but then you don't want a dot, B and a dot C to be equal, they're different places right.

A

The lettering would be if we can't produce the same exact types because we're getting.

B

In the corner- and we just build with our projection and little feature when we start doing things, we build it with with projections, and then we do there. Okay, that makes sense, is okay. My couple couple questions is air from a performance perspective: does it make sense to catch some of this information so that we don't have to build certain.

B

Certain places over and over like if we can, I like, does her expression, provide some kind of partial EQ in the sense that if two expressions are technically the same, just.

A

Different variety.

B

No.

A

So here it's like that's sort of there's two notions of equality, so to speak. That's why place exists to kind of abstract out the same place, different locations from two different expressions in two different locations.

B

Like.

A

Creating a place is cheap okay, because if no allocations involved, it's just an empty vectors, all knows yeah.

B

Well, that would be again at the start right, but when we start building.

B

So there's like a is there anything that we can do it in I guess my question is around incremental compiles. Is there something that we can do better over here? That will improve or make incremental compiles quicker, or is there something that we're doing that's good and that will make incremental compile better I saw there's a new group. That's trying.

A

To I think yeah I know this is all pretty orthogonal from okay, okay, everything you're doing your should fit fine. The incremental. We don't do incremental compilation within one function, but I checked saved parts of type checking of a function. We do it. Maybe the entire function can be reused or not. No, it should be okay.

B

Yeah I think they should for what it stands over here. I think the suggestion should most likely most probably work really.

A

Removing spans is good, yeah.

B

I think this I, like this association, that instead of it's like yeah, it's a different way of associating that information sort of having a complete composite or an exit. Yeah now.

A

There's also just too many maps I mean part of that is that closure captures was meant to evolve into the one true map, but that hasn't happened yet so the current state listen or duplicating yeah.

B

I think we just need to be a little bit more careful about what span reaches I, guess or a little I. Think last one should probably work. You.

A

Know yeah as long as it's deterministic yeah.

B

I think.

A

What we want is probably it's not like last is fine. When we get into this capturing of paths, you want to pick a representative one right like it may not be the last year's the last use was a read, but there was also a right yeah yeah.

B

Currently, we are only relying on the last one because the span is coming from our party mansion and it just puts the last one in so yes that that was basically, why was yeah? My point was like if that's working, this should probably work, but it's still concerning okay, yeah I think we just to give an idea at how much work we've already getting done over the next two weeks is I. Think what half of us will have some couple hours over the next two weeks to get things done.

B

It's getting we're closing in on end offer. Well, we have it through a term. So this is like a big deliverable of time for us, but I. Think half of us have cycles in the push work, trip.

A

Okay, I think like adapting the data structure described here, seems to me to be a fairly straightforward task. Yeah. Any super big surprises.

B

Along.

C

The way.

A

Yeah.

B

It shouldn't be, I might just create a pair for moving the herati and everything should we move creating places also to middle her, like libris in middle and her, because I think it'll be using a couple different places. I, don't know how our dependencies will basically.

A

A.

B

Strong part of a good part of my categorization I I, don't have, there will be dependency issues, but it's.

A

It's currently in one three, five.

B

Jack.

A

I see I see because.

B

Basically, everything down here is part of either marveled. Our middle Murr are actually the brassy mark, I.

A

Think that makes sense I don't think we want to add dependencies to the type-check cradle yeah, but for this because then any random change in type check would trigger rebuilds of stuff Danny. This stuff isn't yeah I, think that makes sense. I mean there would also be the option of making its own crate for it.

A

It already has to be sorry, I'm, just remember bringing some of this stuff back in cash. Some of some of this isn't I check, results, right or type check tables, which is now being renamed to tuck check results. Another side note, but that stuff is already well, but we already had to move the place definition into the middle. Create. Is that right? Yes,.

C

Yes,.

A

We have to so you're talking about basically adding some supporting code for constructing.

B

Basically, yes, Bernie. Well, not the constructor itself, but like the actual categorization part where we do the whole.

A

I would hold off on that until we know we are clear, I, don't think we're gonna get or okay, we might be able to move just some helper functions.

A

Yeah.

B

That's yeah, okay, I think! That's all you have any other questions or does anyone else have any questions.

A

I guess from my part, I'll just say this is great. Thank you guys for golfer, like digging in so deeply it's nice yeah. One thing I would add, is I hope that when we finish this work, this moving some of this documentation. Perhaps we well not yeah the old state, but you know documenting the closure, is better in rusty up guy would be an excellent yeah.

B

I think those are talking about writing some some stuff, especially around I, think setting III, don't remember the exact details or might be able to add more, but getting set up with this whole environment and I can move this dog as well once we're done with like actually how we use them later on yeah.

C

Meet me Elliman had the same idea, basically that, as I was going through. All of these things there's a lot of context. You basically need and I wasn't able to get all of that from the guide. So I was making notes, as I was learning about these things, and hopefully we can move those to the depth. I can make it easy for anyone else in the future. I think.

A

What would be great is especially the closure inference and just just just taking an example: closure like you've done and showing features that come out from that. That's the best kind of Ducks yeah.

B

Yeah keep on updating this once the project is done, we can take parts of it, make it more easy for Oh, like whatever fits the actual. However, it's like the Democrat is worried. We can make some amendments, but I think yeah we can I can keep updating this doc as we keep making changes to versus system all right. Thank you.

A

Thanks everybody all right, see ya. Thank you. Thank you.
youtube image
From YouTube: RFC 2229 Sync Meeting (2020-07-01)

Description

No description was provided for this meeting.
If this is YOUR meeting, an easy way to fix this is to add a description to your video, wherever mtngs.io found it (probably YouTube).