Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
wasm_sysio_constraints.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <vector>
5
6namespace IR {
7 struct Module;
8}
9
10namespace sysio { namespace chain { namespace wasm_constraints {
11 constexpr unsigned maximum_linear_memory = 33*1024*1024;//bytes
12 constexpr unsigned maximum_mutable_globals = 1024; //bytes
13 constexpr unsigned maximum_table_elements = 1024; //elements
14 constexpr unsigned maximum_section_elements = 1024; //elements
15 constexpr unsigned maximum_linear_memory_init = 64*1024; //bytes
16 constexpr unsigned maximum_func_local_bytes = 8192; //bytes
17 constexpr unsigned maximum_call_depth = 250; //nested calls
18 constexpr unsigned maximum_code_size = 20*1024*1024;
19
20 static constexpr unsigned wasm_page_size = 64*1024;
21
22 static_assert(maximum_linear_memory%wasm_page_size == 0, "maximum_linear_memory must be mulitple of wasm page size");
23 static_assert(maximum_mutable_globals%4 == 0, "maximum_mutable_globals must be mulitple of 4");
24 static_assert(maximum_table_elements*8%4096 == 0, "maximum_table_elements*8 must be mulitple of 4096");
25 static_assert(maximum_linear_memory_init%wasm_page_size == 0, "maximum_linear_memory_init must be mulitple of wasm page size");
26 static_assert(maximum_func_local_bytes%8 == 0, "maximum_func_local_bytes must be mulitple of 8");
27 static_assert(maximum_func_local_bytes>32 , "maximum_func_local_bytes must be greater than 32");
28} // namespace wasm_constraints
29
30}} // namespace sysio, chain