Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
options.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5namespace sysio { namespace vm {
6
8 params = 1,
9 locals = 2,
10 stack = 4
11};
13 return static_cast<max_func_local_bytes_flags_t>(static_cast<int>(lhs) | static_cast<int>(rhs));
14}
16 return static_cast<max_func_local_bytes_flags_t>(static_cast<int>(lhs) & static_cast<int>(rhs));
17}
18
19struct options {
20 std::uint64_t max_mutable_global_bytes;
21 std::uint32_t max_table_elements;
22 std::uint32_t max_section_elements;
23 std::uint32_t max_type_section_elements;
24 std::uint32_t max_import_section_elements;
26 std::uint32_t max_global_section_elements;
27 std::uint32_t max_export_section_elements;
28 std::uint32_t max_element_section_elements;
29 std::uint32_t max_data_section_elements;
30 // code is the same as functions
31 // memory and tables are both 1.
32 std::uint32_t max_element_segment_elements;
33 std::uint32_t max_data_segment_bytes;
34 std::uint32_t max_linear_memory_init;
35 std::uint64_t max_func_local_bytes;
36 std::uint32_t max_local_sets;
37 std::uint32_t max_nested_structures;
38 std::uint32_t max_br_table_elements;
39 // The maximum length of symbols used for import and export
40 std::uint32_t max_symbol_bytes;
41 // The maximum offset used for load and store
42 std::uint32_t max_memory_offset;
43 // The maximum size of a function body
44 std::uint32_t max_code_bytes;
45 // The maximum size of linear memory in page units.
46 std::uint32_t max_pages;
47 // The maximum function call depth
48 std::uint32_t max_call_depth;
49 // Can mutable globals be exported
51 // Very strange non-conforming behavior
53 // Whether limits types such as for tables and memory are restricted to a
54 // single byte 0|1 (matching the spec) or can be a 32-bit value.
55 bool allow_u32_limits_flags = false;
56 // Determines whether an local set of size 0 with an invalid type should be accepted.
58 bool allow_zero_blocktype = false;
59 // Determines which components are counted towards max_function_local_bytes
61};
62
64};
65
67 static constexpr std::uint32_t max_mutable_global_bytes = 1024;
68 static constexpr std::uint32_t max_table_elements = 1024;
69 // maximum_section_elements in nodeop is a lie.
70 static constexpr std::uint32_t max_section_elements = 8191;
71 static constexpr std::uint32_t max_function_section_elements = 1023;
72 static constexpr std::uint32_t max_import_section_elements = 1023;
73 static constexpr std::uint32_t max_element_segment_elements = 8191;
74 static constexpr std::uint32_t max_data_segment_bytes = 8191;
75 static constexpr std::uint32_t max_linear_memory_init = 64*1024;
76 static constexpr std::uint32_t max_func_local_bytes = 8192;
77 static constexpr std::uint32_t max_local_sets = 1023;
78 static constexpr std::uint32_t sysio_max_nested_structures = 1023;
79 static constexpr std::uint32_t max_br_table_elements = 8191;
80 static constexpr std::uint32_t max_symbol_bytes = 8191;
81 static constexpr std::uint32_t max_memory_offset = (33*1024*1024 - 1);
82 static constexpr std::uint32_t max_pages = 528; // 33 MiB
83 static constexpr std::uint32_t max_call_depth = 251;
84
85 static constexpr bool forbid_export_mutable_globals = true;
86 static constexpr bool allow_code_after_function_end = true;
87 static constexpr bool allow_u32_limits_flags = true;
88 static constexpr bool allow_invalid_empty_local_set = true;
89 static constexpr bool allow_zero_blocktype = true;
90};
91
92}}
constexpr max_func_local_bytes_flags_t operator|(max_func_local_bytes_flags_t lhs, max_func_local_bytes_flags_t rhs)
Definition options.hpp:12
constexpr max_func_local_bytes_flags_t operator&(max_func_local_bytes_flags_t lhs, max_func_local_bytes_flags_t rhs)
Definition options.hpp:15
max_func_local_bytes_flags_t
Definition options.hpp:7
std::uint64_t max_func_local_bytes
Definition options.hpp:35
bool allow_invalid_empty_local_set
Definition options.hpp:57
std::uint32_t max_data_segment_bytes
Definition options.hpp:33
max_func_local_bytes_flags_t max_func_local_bytes_flags
Definition options.hpp:60
std::uint32_t max_table_elements
Definition options.hpp:21
std::uint32_t max_call_depth
Definition options.hpp:48
std::uint32_t max_type_section_elements
Definition options.hpp:23
bool allow_u32_limits_flags
Definition options.hpp:55
bool allow_zero_blocktype
Definition options.hpp:58
bool allow_code_after_function_end
Definition options.hpp:52
std::uint32_t max_code_bytes
Definition options.hpp:44
std::uint32_t max_import_section_elements
Definition options.hpp:24
std::uint32_t max_function_section_elements
Definition options.hpp:25
std::uint32_t max_data_section_elements
Definition options.hpp:29
std::uint32_t max_nested_structures
Definition options.hpp:37
std::uint64_t max_mutable_global_bytes
Definition options.hpp:20
std::uint32_t max_pages
Definition options.hpp:46
std::uint32_t max_local_sets
Definition options.hpp:36
std::uint32_t max_memory_offset
Definition options.hpp:42
std::uint32_t max_export_section_elements
Definition options.hpp:27
bool forbid_export_mutable_globals
Definition options.hpp:50
std::uint32_t max_global_section_elements
Definition options.hpp:26
std::uint32_t max_element_section_elements
Definition options.hpp:28
std::uint32_t max_section_elements
Definition options.hpp:22
std::uint32_t max_linear_memory_init
Definition options.hpp:34
std::uint32_t max_symbol_bytes
Definition options.hpp:40
std::uint32_t max_element_segment_elements
Definition options.hpp:32
std::uint32_t max_br_table_elements
Definition options.hpp:38
static constexpr bool forbid_export_mutable_globals
Definition options.hpp:85
static constexpr std::uint32_t max_function_section_elements
Definition options.hpp:71
static constexpr bool allow_code_after_function_end
Definition options.hpp:86
static constexpr std::uint32_t max_section_elements
Definition options.hpp:70
static constexpr std::uint32_t max_br_table_elements
Definition options.hpp:79
static constexpr std::uint32_t max_symbol_bytes
Definition options.hpp:80
static constexpr std::uint32_t max_linear_memory_init
Definition options.hpp:75
static constexpr std::uint32_t max_table_elements
Definition options.hpp:68
static constexpr std::uint32_t max_local_sets
Definition options.hpp:77
static constexpr std::uint32_t max_pages
Definition options.hpp:82
static constexpr bool allow_zero_blocktype
Definition options.hpp:89
static constexpr std::uint32_t max_func_local_bytes
Definition options.hpp:76
static constexpr std::uint32_t max_mutable_global_bytes
Definition options.hpp:67
static constexpr std::uint32_t max_data_segment_bytes
Definition options.hpp:74
static constexpr std::uint32_t sysio_max_nested_structures
Definition options.hpp:78
static constexpr bool allow_u32_limits_flags
Definition options.hpp:87
static constexpr std::uint32_t max_call_depth
Definition options.hpp:83
static constexpr std::uint32_t max_element_segment_elements
Definition options.hpp:73
static constexpr std::uint32_t max_memory_offset
Definition options.hpp:81
static constexpr bool allow_invalid_empty_local_set
Definition options.hpp:88
static constexpr std::uint32_t max_import_section_elements
Definition options.hpp:72