-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepare to call jit from block machine. #2098
Changes from 1 commit
fbdabca
71d2ebd
f66c5c2
934ebb1
19d544f
6b83811
80c24f9
5528a4f
4d4111c
0076d2c
3c577c1
4e83830
9f3130a
1aadfe0
056a904
f2fee46
9415cc3
ec5d110
7cbbb8d
4490dcd
7ffdad9
09863e8
cf51774
825d0eb
d470fd7
b8864c8
ca38415
d47f695
d482821
68be580
46860a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,36 @@ impl<T: FieldElement> CompactData<T> { | |
} | ||
} | ||
|
||
/// A mutable reference into CompactData that is meant to be used | ||
/// only for a certain block of rows, starting from row index zero. | ||
/// It allows negative row indices as well. | ||
pub struct CompactDataRef<'a, T: FieldElement> { | ||
data: &'a mut CompactData<T>, | ||
row_offset: usize, | ||
} | ||
|
||
impl<'a, T: FieldElement> CompactDataRef<'a, T> { | ||
/// Creates a new reference to the data, supplying the offset of the row | ||
/// that is supposed to be "row zero". | ||
pub fn new(data: &'a mut CompactData<T>, row_offset: usize) -> Self { | ||
Self { data, row_offset } | ||
} | ||
|
||
pub fn get(&self, row: i32, col: u32) -> T { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if the 32 bit values here provide a performance advantage. Any opinions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of get and set, can this implement There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually don't think we will use those functions later on. The current interface used in #2071 uses direct memory slices. |
||
let (v, known) = self.data.get(self.inner_row(row), col as u64); | ||
assert!(known); | ||
v | ||
} | ||
|
||
pub fn set(&mut self, row: i32, col: u32, value: T) { | ||
self.data.set(self.inner_row(row), col as u64, value); | ||
} | ||
|
||
fn inner_row(&self, row: i32) -> usize { | ||
(row + self.row_offset as i32) as usize | ||
} | ||
} | ||
|
||
/// A data structure that stores witness data. | ||
/// It allows to finalize rows, which means that those rows are then stored in a more | ||
/// compact form. Information about range constraints on those rows is lost, but the | ||
|
@@ -381,11 +411,11 @@ impl<T: FieldElement> FinalizableData<T> { | |
} | ||
} | ||
|
||
// TODO somehow we need to return a row offset because of the non-finalized rows. | ||
pub fn append_new_finalized_rows(&mut self, count: usize) -> &mut CompactData<T> { | ||
pub fn append_new_finalized_rows<'a>(&'a mut self, count: usize) -> CompactDataRef<'a, T> { | ||
assert!(self.post_finalized_data.is_empty()); | ||
let row_zero = self.finalized_data.len(); | ||
self.finalized_data.append_new_rows(count); | ||
&mut self.finalized_data | ||
CompactDataRef::new(&mut self.finalized_data, row_zero) | ||
} | ||
|
||
/// Takes all data out of the [FinalizableData] and returns it as a list of columns. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?