#include <wasm_sysio_validation.hpp>
Definition at line 34 of file wasm_sysio_validation.hpp.
◆ validate()
void sysio::chain::wasm_validations::globals_validation_visitor::validate |
( |
const IR::Module & | m | ) |
|
|
static |
Definition at line 40 of file wasm_sysio_validation.cpp.
40 {
41 unsigned mutable_globals_total_size = 0;
42 for(
const GlobalDef& global_def : m.
globals.defs) {
43 if(!global_def.type.isMutable)
44 continue;
45 switch(global_def.type.valueType) {
46 case ValueType::any:
47 case ValueType::num:
48 FC_THROW_EXCEPTION(wasm_execution_error,
"Smart contract has unexpected global definition value type");
49 case ValueType::i64:
50 case ValueType::f64:
51 mutable_globals_total_size += 4;
52 case ValueType::i32:
53 case ValueType::f32:
54 mutable_globals_total_size += 4;
55 }
56 }
58 FC_THROW_EXCEPTION(wasm_execution_error,
"Smart contract has more than ${k} bytes of mutable globals",
60}
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
constexpr unsigned maximum_mutable_globals
IndexSpace< GlobalDef, GlobalType > globals
The documentation for this struct was generated from the following files: