11std::vector<uint8_t>
read_wasm(
const std::string& fname ) {
12 std::ifstream wasm_file(fname, std::ios::binary);
13 FC_ASSERT( wasm_file.is_open(),
"wasm file cannot be found" );
14 wasm_file.seekg(0, std::ios::end);
15 std::vector<uint8_t> wasm;
16 int len = wasm_file.tellg();
19 wasm_file.seekg(0, std::ios::beg);
20 wasm_file.read((
char*)wasm.data(), wasm.size());
35 high_resolution_clock::time_point start;
37 memory_manager::set_memory_limits( 128*1024, 64*1024 );
41 start = high_resolution_clock::now();
42 bp.parse_module( test, mod );
44 std::cout <<
"FAIL : " << e.
what() <<
"\n";
46 auto stop = high_resolution_clock::now();
47 auto duration = duration_cast<microseconds>(stop - start);
48 std::cout <<
"TIME : " << duration.count() <<
"us\n";
51 catch ( wasm_parse_exception& ex ) {
52 }
catch ( wasm_interpreter_exception& ex ) {
53 }
catch ( wasm_section_length_exception& ex ) {
54 }
catch ( wasm_bad_alloc& ex ) {
55 }
catch ( wasm_double_free& ex ) {
56 }
catch ( wasm_vector_oob_exception& ex ) {
57 }
catch ( wasm_memory_exception& ex ) {
58 }
catch ( wasm_unsupported_import_exception& ex ) {
59 }
catch ( wasm_illegal_opcode_exception& ex ) {
60 }
catch ( guarded_ptr_exception& ex ) {