-
Notifications
You must be signed in to change notification settings - Fork 0
Runtime apc choice #47
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
base: 1.4.1-upgrade
Are you sure you want to change the base?
Conversation
| } | ||
|
|
||
| pub fn add_apc_instruction_at_pc_index(&mut self, pc_index: usize, opcode: VmOpcode) { | ||
| pub fn add_apc_instruction_at_pc_index(&mut self, pc_index: usize, opcode: VmOpcode, condition: ApcCondition) { |
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.
This is the user facing change, where the client specifies the conditions under which the apc should be chosen
| )] | ||
| pub instructions_and_debug_infos: Vec<Option<(Instruction<F>, Option<DebugInfo>)>>, | ||
| pub apc_by_pc_index: HashMap<usize, (Instruction<F>, Option<DebugInfo>)>, | ||
| pub instructions_and_debug_infos: Vec<Option<(Decision<Instruction<F>>, Option<DebugInfo>)>>, |
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.
Simplify the program to keep track of software and apc in the same vector. This reduces our diff vs upstream.
| } | ||
|
|
||
| #[derive(Clone, Copy, Debug, Serialize, Deserialize)] | ||
| pub struct Decision<H> { |
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.
This is now used across the codebase for situations where we have the choice between software and apc: handlers, pc_entries, etc.
| /// Handler function pointers for tail call optimization. | ||
| #[cfg(feature = "tco")] | ||
| handlers: Vec<Handler<F, Ctx>>, | ||
| handlers: Vec<Decision<Handler<F, Ctx>>>, |
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.
This makes is possible to pick a tco handler at runtime.
| #[cfg_attr(feature = "tco", allow(dead_code))] | ||
| struct PreComputeInstruction<'a, F, Ctx> { | ||
| pub handler: ExecuteFunc<F, Ctx>, | ||
| pub handler: Decision<ExecuteFunc<F, Ctx>>, |
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.
Same for a non-tco execution function.
Gives the prover the power to chose whether to run software or apc at runtime.
TODO: