-
Notifications
You must be signed in to change notification settings - Fork 110
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
WIP: feat: support uniarg to reduce instruction number #299
base: main
Are you sure you want to change the base?
Conversation
d8a1254
to
7300281
Compare
d913162
to
34043f2
Compare
let d = allocator.alloc_u64_cell(); | ||
let d_flag_helper_diff = allocator.alloc_common_range_cell(); | ||
let d_flag_helper_diff = allocator.alloc_common_range_cell(); // TODO: u16?? |
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.
todo
|
347d0a9
to
551b6fa
Compare
b417ded
to
4005c32
Compare
Add a u16 column to replace common range with u16 as possible, thus I should remove a common range col |
0f53a8c
to
d2f9cf9
Compare
d2f9cf9
to
4a46c6d
Compare
const INDEX_SHIFT: u32 = DROP_SHIFT + COMMON_RANGE_OFFSET; | ||
const DROP_SHIFT: u32 = KEEP_SHIFT + COMMON_RANGE_OFFSET; | ||
const KEEP_SHIFT: u32 = DST_PC_SHIFT + COMMON_RANGE_OFFSET; | ||
const FID_SHIFT: u32 = IID_SHIFT + IID_BITS; |
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.
Add assertion that IID_BITS, FID_BITS are one of (u8, u16, ucommon), so we know they are limited by range check in circuit.
crates/specs/src/encode/opcode.rs
Outdated
impl<const N: usize> From<&[UniArg; N]> for UniArgEncode<N, BigUint> { | ||
fn from(uniargs: &[UniArg; N]) -> Self { | ||
UniArgEncode::Value( | ||
uniargs |
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.
directly map on array
crates/specs/src/itable.rs
Outdated
} | ||
} | ||
|
||
pub fn try_decease_stack_depth(&mut self, diff: usize) { |
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.
typo
crates/specs/src/itable.rs
Outdated
BigUint::from(3u64) << 64 | ||
} | ||
|
||
pub fn i64_i32_const_tag() -> BigUint { |
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.
maybe call it tag_diff
crates/specs/src/itable.rs
Outdated
matches!(self, UniArg::Pop) | ||
} | ||
|
||
pub fn get_const_value(&self) -> u64 { |
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.
return option
crates/specs/src/state.rs
Outdated
@@ -17,10 +17,11 @@ pub struct InitializationState<T> { | |||
pub maximal_memory_pages: T, | |||
} | |||
|
|||
pub const INITIALIZATION_STATE_FIELD_COUNT: usize = 10; | |||
impl<T> InitializationState<T> { | |||
// TODO: try to remove the magic number |
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.
comment, or sizeof
rename |
* remove TODO.md * fix UniargEncode From trait * fix typo * rename i64_i32_const_tag, COMMON_RANGE_BITS * refactor get_const_value * comment INITIALIZATION_STATE_FIELD_COUNT by code
let memory_table_lookup_stack_read_return_value = allocator | ||
.alloc_memory_table_lookup_read_cell_with_value( | ||
"op_br_if_eqz stack read return value", | ||
constraint_builder, | ||
eid, | ||
move |____| constant_from!(LocationType::Stack as u64), | ||
move |meta| sp.expr(meta) + constant_from!(2), | ||
move |meta| Self::sp_after_uniarg(sp, &uniarg_configs, meta) + constant_from!(1), |
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.
sp constrained by unused uniarg_configs
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.
not bug because uniarg_configs' size is limited.
No description provided.