Skip to content

Conversation

zhouwfang
Copy link
Contributor

Reverted #605 and keep values separate from locals for now.

#46

@zhouwfang zhouwfang requested a review from ia0 as a code owner September 16, 2024 20:02
Comment on lines +998 to 1000
fn last_frame_values_cnt(&mut self) -> usize {
self.frame().labels.iter().map(|label| label.values_cnt).sum()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ia0 The reason why this is not computed on the fly is that I suspect it could be obtained from the side table. Please let me know if this is not the case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also believe this could be known statically and doesn't need to be optimized until we get the side table computed. In particular, I expect the values_cnt fields to disappear. So all code mentioning values_cnt fields should also disappear.

@ia0 ia0 linked an issue Sep 19, 2024 that may be closed by this pull request
@ia0 ia0 linked an issue Sep 19, 2024 that may be closed by this pull request
Comment on lines +998 to 1000
fn last_frame_values_cnt(&mut self) -> usize {
self.frame().labels.iter().map(|label| label.values_cnt).sum()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also believe this could be known statically and doesn't need to be optimized until we get the side table computed. In particular, I expect the values_cnt fields to disappear. So all code mentioning values_cnt fields should also disappear.

}
values.reverse();
values
pop_values(n, || self.pop_value())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why I wrote this function like that, but it seems Vec::split_off would work (it probably didn't exist back then).

@@ -1058,25 +1064,27 @@ impl<'m> Thread<'m> {
}

fn exit_label(mut self) -> ThreadResult<'m> {
let values_cnt = self.last_frame_values_cnt();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplified this a bit. We don't need to compute this because when we enter the if, we know there was exactly one label.

self.only_pop_values(n)
}

fn only_pop_values(&mut self, n: usize) -> Vec<Val> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect this function to disappear once values_cnt disappears, since it becomes equivalent to pop_values.

@ia0 ia0 merged commit de14352 into google:dev/fast-interp Sep 19, 2024
20 checks passed
@ia0 ia0 linked an issue Sep 19, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interpreter performance and footprint
2 participants