ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

一起来读源码7-eos vm

2020-06-14 22:05:22  阅读:567  来源: 互联网

标签:1024 max hpp vm eos host 源码 分配器 size


摘要:

 

详情:

allocator.hpp

提供了以下内存分配器:

1.边界内存分配器

2.连续内存分配器

3.jit分配器

4.自增内存分配器

5.栈分配器

6.wasm分配器

 

backend.hpp

定义类:

jit:jit类

backend:后台类

//后台初始化

inline backend& initialize(Host* host=nullptr);

//曲线调用

template <typename... Args>

inline bool call_indirect( Host* host, uint32_t func_index, Args... args );

//调用

template <typename... Args>

inline bool call( Host* host, uint32_t func_index, Args... args );

//调用

template <typename... Args>

inline bool call( Host* host, const std::string_view& mod, const std::string_view& func, Args... args );

//调用

template <typename... Args>

inline auto call_with_return(Host* host, const std::string_view& mod, const std::string_view& func, Args... args);

//跑时间

template <typename Watchdog, typename F>

void timed_run(Watchdog&& wd, F&& f);

//执行所有watchdog任务

template <typename Watchdog>

inline void execute_all(Watchdog&& wd, Host* host = nullptr);

//读wasm文件

static std::vector<uint8_t> read_wasm(const std::string& fname);

 

base_visitor.hpp

visitor类

 

bitcode_writer.hpp

二进制中间码写入器

 

config.hpp

全局定义了一些变量

EOS_VM_ALIGN_MEMORY_OPS:内存对齐选项

EOS_VM_SOFTFLOAT: 软浮点

EOS_VM_FULL_DEBUG: 调试

 

constants.hpp

定义常量:

magic = 0x6D736100 //魔幻数字

version = 0x1 //版本

magic_size = sizeof(uint32_t) //魔幻数字类型大小

version_size = sizeof(uint32_t) //版本类型大小

id_size = sizeof(uint8_t) //id大小

varuint32_size = 5

max_nested_structures = 1024 //网络结构体尺寸

max_call_depth = 250 //调用深度

max_stack_size = 8*1024 //栈尺寸

initial_module_size = 1*1024*1024 //初始化module尺寸

max_memory = 4ull << 31 //最大内存

max_useable_memory = (33 * 1024 * 1024) //最大可用内存,33mb

page_size = 64ull * 1024 //页尺寸64kb

max_pages = (max_useable_memory/page_size) //最大页数量

 

debug_visitor.hpp

调试访问器

 

disassembly_visitor.hpp

拆解访问器

 

error_codes_def.hpp

错误码类别:

parser_errors:解析错误

memory_errors:内存错误

system_errors:系统错误

auxiliary_errors:辅助错误

 

error_codes_pp.hpp

错误码

 

error_codes.hpp

错误码

 

exceptions.hpp

异常类

 

execution_context.hpp

执行上下文

 

guarded_ptr.hpp

host_function.hpp

interpret_visitor.hpp

leb128.hpp

memory_dump.hpp

opcodes_def.hpp

opcode.hpp

outcome.hpp

parser.hpp

sections.hpp

signals.hpp

softfloat.hpp

stack_elem.hpp

types.hpp

utils.hpp

validation.hpp

variant.hpp

vector.hpp

wasm_stack.hpp

watchdog.hpp

x86_64.hpp

标签:1024,max,hpp,vm,eos,host,源码,分配器,size
来源: https://blog.csdn.net/qq_27304213/article/details/106716992

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有