Skip to content

Commit

Permalink
make all ops but keccak and things that use Wording const fns 💥
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 committed Dec 2, 2024
1 parent 492330b commit f367785
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions core/src/zisk_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ pub const fn op_flag(_a: u64, _b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_flag()
#[inline(always)]
pub fn opc_flag(ctx: &mut InstContext) {
pub const fn opc_flag(ctx: &mut InstContext) {

Check failure on line 300 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_flag(ctx.a, ctx.b);
}

Expand All @@ -309,7 +309,7 @@ pub const fn op_copyb(_a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_copyb()
#[inline(always)]
pub fn opc_copyb(ctx: &mut InstContext) {
pub const fn opc_copyb(ctx: &mut InstContext) {

Check failure on line 312 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_copyb(ctx.a, ctx.b);
}

Expand All @@ -327,7 +327,7 @@ pub const fn op_signextend_b(_a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_signextend_b()
#[inline(always)]
pub fn opc_signextend_b(ctx: &mut InstContext) {
pub const fn opc_signextend_b(ctx: &mut InstContext) {

Check failure on line 330 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_signextend_b(ctx.a, ctx.b);
}

Expand All @@ -343,7 +343,7 @@ pub const fn op_signextend_h(_a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_signextend_h()
#[inline(always)]
pub fn opc_signextend_h(ctx: &mut InstContext) {
pub const fn opc_signextend_h(ctx: &mut InstContext) {

Check failure on line 346 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_signextend_h(ctx.a, ctx.b);
}

Expand All @@ -359,7 +359,7 @@ pub const fn op_signextend_w(_a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_signextend_w()
#[inline(always)]
pub fn opc_signextend_w(ctx: &mut InstContext) {
pub const fn opc_signextend_w(ctx: &mut InstContext) {

Check failure on line 362 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_signextend_w(ctx.a, ctx.b);
}

Expand Down Expand Up @@ -424,7 +424,7 @@ pub const fn op_sll(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_sll()
#[inline(always)]
pub fn opc_sll(ctx: &mut InstContext) {
pub const fn opc_sll(ctx: &mut InstContext) {

Check failure on line 427 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_sll(ctx.a, ctx.b);
}

Expand All @@ -450,7 +450,7 @@ pub const fn op_sra(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_sra()
#[inline(always)]
pub fn opc_sra(ctx: &mut InstContext) {
pub const fn opc_sra(ctx: &mut InstContext) {

Check failure on line 453 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_sra(ctx.a, ctx.b);
}

Expand All @@ -463,7 +463,7 @@ pub const fn op_srl(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_srl()
#[inline(always)]
pub fn opc_srl(ctx: &mut InstContext) {
pub const fn opc_srl(ctx: &mut InstContext) {

Check failure on line 466 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_srl(ctx.a, ctx.b);
}

Expand Down Expand Up @@ -507,7 +507,7 @@ pub const fn op_eq(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_eq()
#[inline(always)]
pub fn opc_eq(ctx: &mut InstContext) {
pub const fn opc_eq(ctx: &mut InstContext) {

Check failure on line 510 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_eq(ctx.a, ctx.b);
}

Expand All @@ -524,7 +524,7 @@ pub const fn op_eq_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_eq_w()
#[inline(always)]
pub fn opc_eq_w(ctx: &mut InstContext) {
pub const fn opc_eq_w(ctx: &mut InstContext) {

Check failure on line 527 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_eq_w(ctx.a, ctx.b);
}

Expand All @@ -541,7 +541,7 @@ pub const fn op_ltu(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_ltu()
#[inline(always)]
pub fn opc_ltu(ctx: &mut InstContext) {
pub const fn opc_ltu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_ltu(ctx.a, ctx.b);
}

Expand All @@ -558,7 +558,7 @@ pub const fn op_lt(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_lt()
#[inline(always)]
pub fn opc_lt(ctx: &mut InstContext) {
pub const fn opc_lt(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_lt(ctx.a, ctx.b);
}

Expand All @@ -575,7 +575,7 @@ pub const fn op_ltu_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_ltu_w()
#[inline(always)]
pub fn opc_ltu_w(ctx: &mut InstContext) {
pub const fn opc_ltu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_ltu_w(ctx.a, ctx.b);
}

Expand All @@ -592,7 +592,7 @@ pub const fn op_lt_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_lt_w()
#[inline(always)]
pub fn opc_lt_w(ctx: &mut InstContext) {
pub const fn opc_lt_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_lt_w(ctx.a, ctx.b);
}

Expand All @@ -609,7 +609,7 @@ pub const fn op_leu(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_leu()
#[inline(always)]
pub fn opc_leu(ctx: &mut InstContext) {
pub const fn opc_leu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_leu(ctx.a, ctx.b);
}

Expand All @@ -626,7 +626,7 @@ pub const fn op_le(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_le()
#[inline(always)]
pub fn opc_le(ctx: &mut InstContext) {
pub const fn opc_le(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_le(ctx.a, ctx.b);
}

Expand All @@ -643,7 +643,7 @@ pub const fn op_leu_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_leu_w()
#[inline(always)]
pub fn opc_leu_w(ctx: &mut InstContext) {
pub const fn opc_leu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_leu_w(ctx.a, ctx.b);
}

Expand All @@ -660,7 +660,7 @@ pub const fn op_le_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_le_w()
#[inline(always)]
pub fn opc_le_w(ctx: &mut InstContext) {
pub const fn opc_le_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_le_w(ctx.a, ctx.b);
}

Expand All @@ -674,7 +674,7 @@ pub const fn op_and(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_and()
#[inline(always)]
pub fn opc_and(ctx: &mut InstContext) {
pub const fn opc_and(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_and(ctx.a, ctx.b);
}

Expand All @@ -686,7 +686,7 @@ pub const fn op_or(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_or()
#[inline(always)]
pub fn opc_or(ctx: &mut InstContext) {
pub const fn opc_or(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_or(ctx.a, ctx.b);
}

Expand All @@ -698,7 +698,7 @@ pub const fn op_xor(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_xor()
#[inline(always)]
pub fn opc_xor(ctx: &mut InstContext) {
pub const fn opc_xor(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_xor(ctx.a, ctx.b);
}

Expand Down Expand Up @@ -748,7 +748,7 @@ pub const fn op_muluh(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_muluh()
#[inline(always)]
pub fn opc_muluh(ctx: &mut InstContext) {
pub const fn opc_muluh(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_muluh(ctx.a, ctx.b);
}

Expand All @@ -760,7 +760,7 @@ pub const fn op_mulh(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_mulh()
#[inline(always)]
pub fn opc_mulh(ctx: &mut InstContext) {
pub const fn opc_mulh(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_mulh(ctx.a, ctx.b);
}

Expand All @@ -772,7 +772,7 @@ pub const fn op_mulsuh(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_mulsuh()
#[inline(always)]
pub fn opc_mulsuh(ctx: &mut InstContext) {
pub const fn opc_mulsuh(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_mulsuh(ctx.a, ctx.b);
}

Expand All @@ -789,7 +789,7 @@ pub const fn op_divu(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_divu()
#[inline(always)]
pub fn opc_divu(ctx: &mut InstContext) {
pub const fn opc_divu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_divu(ctx.a, ctx.b);
}

Expand All @@ -808,7 +808,7 @@ pub const fn op_div(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_div()
#[inline(always)]
pub fn opc_div(ctx: &mut InstContext) {
pub const fn opc_div(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_div(ctx.a, ctx.b);
}

Expand All @@ -825,7 +825,7 @@ pub const fn op_divu_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_divu_w()
#[inline(always)]
pub fn opc_divu_w(ctx: &mut InstContext) {
pub const fn opc_divu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_divu_w(ctx.a, ctx.b);
}

Expand All @@ -842,7 +842,7 @@ pub const fn op_div_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_div_w()
#[inline(always)]
pub fn opc_div_w(ctx: &mut InstContext) {
pub const fn opc_div_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_div_w(ctx.a, ctx.b);
}

Expand All @@ -859,7 +859,7 @@ pub const fn op_remu(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_remu()
#[inline(always)]
pub fn opc_remu(ctx: &mut InstContext) {
pub const fn opc_remu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_remu(ctx.a, ctx.b);
}

Expand All @@ -876,7 +876,7 @@ pub const fn op_rem(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_rem()
#[inline(always)]
pub fn opc_rem(ctx: &mut InstContext) {
pub const fn opc_rem(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_rem(ctx.a, ctx.b);
}

Expand All @@ -893,7 +893,7 @@ pub const fn op_remu_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_remu_w()
#[inline(always)]
pub fn opc_remu_w(ctx: &mut InstContext) {
pub const fn opc_remu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_remu_w(ctx.a, ctx.b);
}

Expand All @@ -910,7 +910,7 @@ pub const fn op_rem_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_rem_w()
#[inline(always)]
pub fn opc_rem_w(ctx: &mut InstContext) {
pub const fn opc_rem_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_rem_w(ctx.a, ctx.b);
}

Expand All @@ -928,7 +928,7 @@ pub const fn op_minu(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_minu()
#[inline(always)]
pub fn opc_minu(ctx: &mut InstContext) {
pub const fn opc_minu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_minu(ctx.a, ctx.b);
}

Expand All @@ -944,7 +944,7 @@ pub const fn op_min(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_min()
#[inline(always)]
pub fn opc_min(ctx: &mut InstContext) {
pub const fn opc_min(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_min(ctx.a, ctx.b);
}

Expand All @@ -960,7 +960,7 @@ pub const fn op_minu_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_minu_w()
#[inline(always)]
pub fn opc_minu_w(ctx: &mut InstContext) {
pub const fn opc_minu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_minu_w(ctx.a, ctx.b);
}

Expand All @@ -976,7 +976,7 @@ pub const fn op_min_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_min_w()
#[inline(always)]
pub fn opc_min_w(ctx: &mut InstContext) {
pub const fn opc_min_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_min_w(ctx.a, ctx.b);
}

Expand All @@ -992,7 +992,7 @@ pub const fn op_maxu(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_maxu()
#[inline(always)]
pub fn opc_maxu(ctx: &mut InstContext) {
pub const fn opc_maxu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_maxu(ctx.a, ctx.b);
}

Expand All @@ -1008,7 +1008,7 @@ pub const fn op_max(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_max()
#[inline(always)]
pub fn opc_max(ctx: &mut InstContext) {
pub const fn opc_max(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_max(ctx.a, ctx.b);
}

Expand All @@ -1024,7 +1024,7 @@ pub const fn op_maxu_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_maxu_w()
#[inline(always)]
pub fn opc_maxu_w(ctx: &mut InstContext) {
pub const fn opc_maxu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_maxu_w(ctx.a, ctx.b);
}

Expand All @@ -1040,7 +1040,7 @@ pub const fn op_max_w(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_max_w()
#[inline(always)]
pub fn opc_max_w(ctx: &mut InstContext) {
pub const fn opc_max_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_max_w(ctx.a, ctx.b);
}

Expand Down Expand Up @@ -1077,8 +1077,8 @@ pub fn opc_keccak(ctx: &mut InstContext) {
/// Unimplemented. Keccak can only be called from the system call context via InstContext.
/// This is provided just for completeness.
#[inline(always)]
pub fn op_keccak(_a: u64, _b: u64) -> (u64, bool) {
unimplemented!("op_keccak() is not implemented");
pub const fn op_keccak(_a: u64, _b: u64) -> (u64, bool) {
panic!("op_keccak() is not implemented");
}

impl From<ZiskRequiredOperation> for ZiskOp {
Expand All @@ -1096,7 +1096,7 @@ pub const fn op_pubout(a: u64, b: u64) -> (u64, bool) {

/// InstContext-based wrapper over op_pubout()
#[inline(always)]
pub fn opc_pubout(ctx: &mut InstContext) {
pub const fn opc_pubout(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_pubout(ctx.a, ctx.b);
//println!("public ${} = {:#010x}", ctx.a, ctx.b);
}

0 comments on commit f367785

Please sign in to comment.