zink-lang / zink

Rustic programming language that targets the Ethereum Virtual Machine
https://zink-lang.org
GNU General Public License v3.0
139 stars 13 forks source link

Mark vector-like types as empty pointers for the EVM target #235

Closed clearloop closed 1 month ago

clearloop commented 2 months ago

Describe the feature

Even we're using WASM as IR, we can not compile all of them WASM bytecode into EVM, vector like types are really hard to be compiled, however, we can compile them as empty functions to mark them in the compiler

#[cfg(target = "wasm")]
struct Address;

#[cfg(not(target = "wasm"))]
struct Address = [u8; 20]

fn method(address: Address) {
  // fn:  wasm.load_address() 
  // push20 ...
   let address = address.load();
}

Solution

No response