jasmin-lang / jasmin

Language for high-assurance and high-speed cryptography
MIT License
268 stars 55 forks source link

Slices #498

Open cryptojedi opened 1 year ago

cryptojedi commented 1 year ago

This is a feature request to support function arguments that are "slices", i.e., arrays of variable length that is known at compile time for all contexts from which a function is called, but possibly different from different contexts. So, we would like to do something like

fn foo(reg ptr u8[reg u64 n]) {
...
}

fn bar(){
  stack u8[128] a;
  stack u8[256] b;
  foo(a);
  foo(b);
}

Syntax to be discussed. This will avoid code duplication both source level and in binaries produced from jasmin code.

cassiersg commented 3 months ago

Summary of discussion in Bristol:

This expands on the subarray_unknown_index.

Add integer parameters to functions that can be used as array sizes.

Would like to have:

cc @eponier @mbbarbosa @bgregoir @cryptojedi @Rixxc