mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 16:23:12 +00:00
Remove unnecessary changes in the Operation enum
This commit is contained in:
parent
c3cb227896
commit
10bbda039b
@ -42,7 +42,8 @@ pub(crate) fn gas_to_charge(op: Operation) -> u64 {
|
|||||||
Push(1..) => G_VERYLOW,
|
Push(1..) => G_VERYLOW,
|
||||||
Dup(_) => G_VERYLOW,
|
Dup(_) => G_VERYLOW,
|
||||||
Swap(_) => G_VERYLOW,
|
Swap(_) => G_VERYLOW,
|
||||||
ContextOp(_) => KERNEL_ONLY_INSTR,
|
GetContext => KERNEL_ONLY_INSTR,
|
||||||
|
SetContext => KERNEL_ONLY_INSTR,
|
||||||
ExitKernel => KERNEL_ONLY_INSTR,
|
ExitKernel => KERNEL_ONLY_INSTR,
|
||||||
MloadGeneral => KERNEL_ONLY_INSTR,
|
MloadGeneral => KERNEL_ONLY_INSTR,
|
||||||
MstoreGeneral => KERNEL_ONLY_INSTR,
|
MstoreGeneral => KERNEL_ONLY_INSTR,
|
||||||
|
|||||||
@ -45,7 +45,8 @@ pub(crate) enum Operation {
|
|||||||
Push(u8),
|
Push(u8),
|
||||||
Dup(u8),
|
Dup(u8),
|
||||||
Swap(u8),
|
Swap(u8),
|
||||||
ContextOp(bool),
|
GetContext,
|
||||||
|
SetContext,
|
||||||
ExitKernel,
|
ExitKernel,
|
||||||
MloadGeneral,
|
MloadGeneral,
|
||||||
MstoreGeneral,
|
MstoreGeneral,
|
||||||
@ -292,19 +293,6 @@ pub(crate) fn generate_jumpdest<F: Field>(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn generate_context_op<F: Field>(
|
|
||||||
is_set: bool,
|
|
||||||
state: &mut GenerationState<F>,
|
|
||||||
row: CpuColumnsView<F>,
|
|
||||||
) -> Result<(), ProgramError> {
|
|
||||||
// SET_CONTEXT uses mem_channels[0..=2]
|
|
||||||
if is_set {
|
|
||||||
generate_set_context(state, row)
|
|
||||||
} else {
|
|
||||||
generate_get_context(state, row)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn generate_get_context<F: Field>(
|
pub(crate) fn generate_get_context<F: Field>(
|
||||||
state: &mut GenerationState<F>,
|
state: &mut GenerationState<F>,
|
||||||
mut row: CpuColumnsView<F>,
|
mut row: CpuColumnsView<F>,
|
||||||
|
|||||||
@ -134,8 +134,8 @@ fn decode(registers: RegistersState, opcode: u8) -> Result<Operation, ProgramErr
|
|||||||
(0xf3, _) => Ok(Operation::Syscall(opcode, 2, false)), // RETURN
|
(0xf3, _) => Ok(Operation::Syscall(opcode, 2, false)), // RETURN
|
||||||
(0xf4, _) => Ok(Operation::Syscall(opcode, 6, false)), // DELEGATECALL
|
(0xf4, _) => Ok(Operation::Syscall(opcode, 6, false)), // DELEGATECALL
|
||||||
(0xf5, _) => Ok(Operation::Syscall(opcode, 4, false)), // CREATE2
|
(0xf5, _) => Ok(Operation::Syscall(opcode, 4, false)), // CREATE2
|
||||||
(0xf6, true) => Ok(Operation::ContextOp(false)), // GET_CONTEXT
|
(0xf6, true) => Ok(Operation::GetContext),
|
||||||
(0xf7, true) => Ok(Operation::ContextOp(true)), // SET_CONTEXT
|
(0xf7, true) => Ok(Operation::SetContext),
|
||||||
(0xf9, true) => Ok(Operation::ExitKernel),
|
(0xf9, true) => Ok(Operation::ExitKernel),
|
||||||
(0xfa, _) => Ok(Operation::Syscall(opcode, 6, false)), // STATICCALL
|
(0xfa, _) => Ok(Operation::Syscall(opcode, 6, false)), // STATICCALL
|
||||||
(0xfb, true) => Ok(Operation::MloadGeneral),
|
(0xfb, true) => Ok(Operation::MloadGeneral),
|
||||||
@ -182,7 +182,8 @@ fn fill_op_flag<F: Field>(op: Operation, row: &mut CpuColumnsView<F>) {
|
|||||||
Operation::Jump | Operation::Jumpi => &mut flags.jumps,
|
Operation::Jump | Operation::Jumpi => &mut flags.jumps,
|
||||||
Operation::Pc => &mut flags.pc,
|
Operation::Pc => &mut flags.pc,
|
||||||
Operation::Jumpdest => &mut flags.jumpdest,
|
Operation::Jumpdest => &mut flags.jumpdest,
|
||||||
Operation::ContextOp(_) => &mut flags.context_op,
|
Operation::GetContext => &mut flags.context_op,
|
||||||
|
Operation::SetContext => &mut flags.context_op,
|
||||||
Operation::ExitKernel => &mut flags.exit_kernel,
|
Operation::ExitKernel => &mut flags.exit_kernel,
|
||||||
Operation::MloadGeneral => &mut flags.mload_general,
|
Operation::MloadGeneral => &mut flags.mload_general,
|
||||||
Operation::MstoreGeneral => &mut flags.mstore_general,
|
Operation::MstoreGeneral => &mut flags.mstore_general,
|
||||||
@ -218,7 +219,8 @@ fn perform_op<F: Field>(
|
|||||||
Operation::Jumpi => generate_jumpi(state, row)?,
|
Operation::Jumpi => generate_jumpi(state, row)?,
|
||||||
Operation::Pc => generate_pc(state, row)?,
|
Operation::Pc => generate_pc(state, row)?,
|
||||||
Operation::Jumpdest => generate_jumpdest(state, row)?,
|
Operation::Jumpdest => generate_jumpdest(state, row)?,
|
||||||
Operation::ContextOp(is_set) => generate_context_op(is_set, state, row)?,
|
Operation::GetContext => generate_get_context(state, row)?,
|
||||||
|
Operation::SetContext => generate_set_context(state, row)?,
|
||||||
Operation::ExitKernel => generate_exit_kernel(state, row)?,
|
Operation::ExitKernel => generate_exit_kernel(state, row)?,
|
||||||
Operation::MloadGeneral => generate_mload_general(state, row)?,
|
Operation::MloadGeneral => generate_mload_general(state, row)?,
|
||||||
Operation::MstoreGeneral => generate_mstore_general(state, row)?,
|
Operation::MstoreGeneral => generate_mstore_general(state, row)?,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user