Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::wasm_validations::globals_validation_visitor Struct Reference

#include <wasm_sysio_validation.hpp>

Static Public Member Functions

static void validate (const IR::Module &m)
 

Detailed Description

Definition at line 34 of file wasm_sysio_validation.hpp.

Member Function Documentation

◆ 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 }
57 if(mutable_globals_total_size > wasm_constraints::maximum_mutable_globals)
58 FC_THROW_EXCEPTION(wasm_execution_error, "Smart contract has more than ${k} bytes of mutable globals",
60}
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
IndexSpace< GlobalDef, GlobalType > globals
Definition Module.h:136

The documentation for this struct was generated from the following files: