Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
7159ee6a
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7159ee6a
编写于
6月 18, 2017
作者:
P
Phil Mesnier
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
replace memcpy function to avoid compilation error. Some trailing whitespace eliminated too
上级
875f7826
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
13 deletion
+13
-13
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+13
-13
未找到文件。
libraries/chain/wasm_interface.cpp
浏览文件 @
7159ee6a
...
...
@@ -13,7 +13,7 @@
namespace
eos
{
namespace
chain
{
using
namespace
IR
;
using
namespace
Runtime
;
wasm_interface
::
wasm_interface
()
{
}
...
...
@@ -41,7 +41,7 @@ DEFINE_INTRINSIC_FUNCTION4(env,store,store,none,i32,keyptr,i32,keylen,i32,valuep
if
(
obj
)
{
db
.
modify
(
*
obj
,
[
&
](
auto
&
o
)
{
o
.
value
.
resize
(
valuelen
);
memcpy
(
o
.
value
.
data
(),
value
,
valuelen
);
o
.
value
.
replace
(
0
,
valuelen
,
value
);
});
}
else
{
db
.
create
<
key_value_object
>
(
[
&
](
auto
&
o
)
{
...
...
@@ -50,7 +50,7 @@ DEFINE_INTRINSIC_FUNCTION4(env,store,store,none,i32,keyptr,i32,keylen,i32,valuep
o
.
value
.
insert
(
0
,
value
,
valuelen
);
});
}
}
}
DEFINE_INTRINSIC_FUNCTION2
(
env
,
remove
,
remove
,
i32
,
i32
,
keyptr
,
i32
,
keylen
)
{
FC_ASSERT
(
keylen
>
0
);
...
...
@@ -172,13 +172,13 @@ DEFINE_INTRINSIC_FUNCTION2(env,assert,assert,none,i32,test,i32,msg) {
std
::
string
message
=
&
Runtime
::
memoryRef
<
char
>
(
wasm_interface
::
get
().
current_memory
,
msg
);
if
(
!
test
)
edump
((
message
));
FC_ASSERT
(
test
,
"assertion failed: ${s}"
,
(
"s"
,
message
)(
"ptr"
,
msg
)
);
}
}
DEFINE_INTRINSIC_FUNCTION0
(
env
,
messageSize
,
messageSize
,
i32
)
{
return
wasm_interface
::
get
().
current_validate_context
->
msg
.
data
.
size
();
}
DEFINE_INTRINSIC_FUNCTION1
(
env
,
malloc
,
malloc
,
i32
,
i32
,
size
)
{
DEFINE_INTRINSIC_FUNCTION1
(
env
,
malloc
,
malloc
,
i32
,
i32
,
size
)
{
FC_ASSERT
(
size
>
0
);
int32_t
&
end
=
Runtime
::
memoryRef
<
int32_t
>
(
Runtime
::
getDefaultMemory
(
wasm_interface
::
get
().
current_module
),
0
);
int32_t
old_end
=
end
;
...
...
@@ -202,10 +202,10 @@ DEFINE_INTRINSIC_FUNCTION2(env,print,print,none,i32,charptr,i32,size) {
wlog
(
std
::
string
(
str
,
size
)
);
}
DEFINE_INTRINSIC_FUNCTION1
(
env
,
free
,
free
,
none
,
i32
,
ptr
)
{
DEFINE_INTRINSIC_FUNCTION1
(
env
,
free
,
free
,
none
,
i32
,
ptr
)
{
}
DEFINE_INTRINSIC_FUNCTION1
(
env
,
toUpper
,
toUpper
,
none
,
i32
,
charptr
)
{
DEFINE_INTRINSIC_FUNCTION1
(
env
,
toUpper
,
toUpper
,
none
,
i32
,
charptr
)
{
std
::
cerr
<<
"TO UPPER CALLED
\n
"
;
// << charptr << "\n";
// std::cerr << "moduleInstance: " << moduleInstance << "\n";
// /*U8* base = */Runtime::getMemoryBaseAddress( Runtime::getDefaultMemory(moduleInstance) );
...
...
@@ -219,7 +219,7 @@ DEFINE_INTRINSIC_FUNCTION1(env,toUpper,toUpper,none,i32,charptr) {
wasm_interface
&
wasm_interface
::
get
()
{
static
wasm_interface
*
wasm
=
nullptr
;
if
(
!
wasm
)
if
(
!
wasm
)
{
wlog
(
"Runtime::init"
);
Runtime
::
init
();
...
...
@@ -273,7 +273,7 @@ DEFINE_INTRINSIC_FUNCTION1(env,toUpper,toUpper,none,i32,charptr) {
return
U32
(
ptr
-
&
memoryRef
<
char
>
(
current_memory
,
0
));
}
void
wasm_interface
::
vm_apply
()
void
wasm_interface
::
vm_apply
()
{
try
{
try
{
std
::
string
mangledapply
(
"onApply_"
);
...
...
@@ -297,7 +297,7 @@ DEFINE_INTRINSIC_FUNCTION1(env,toUpper,toUpper,none,i32,charptr) {
}
}
FC_CAPTURE_AND_RETHROW
()
}
void
wasm_interface
::
vm_onInit
()
void
wasm_interface
::
vm_onInit
()
{
try
{
try
{
wlog
(
"onInit"
);
...
...
@@ -375,7 +375,7 @@ DEFINE_INTRINSIC_FUNCTION1(env,toUpper,toUpper,none,i32,charptr) {
state
.
init_memory
.
resize
(
1
<<
16
);
/// TODO: actually get memory size
memcpy
(
state
.
init_memory
.
data
(),
memstart
,
state
.
init_memory
.
size
()
);
std
::
cerr
<<
"INIT MEMORY:
\n
"
;
for
(
uint32_t
i
=
0
;
i
<
10000
;
++
i
)
for
(
uint32_t
i
=
0
;
i
<
10000
;
++
i
)
if
(
memstart
[
i
]
)
std
::
cerr
<<
(
char
)
memstart
[
i
];
std
::
cerr
<<
"
\n
"
;
...
...
@@ -415,7 +415,7 @@ DEFINE_INTRINSIC_FUNCTION1(env,toUpper,toUpper,none,i32,charptr) {
if( module ) {
char* memstart = &memoryRef<char>( current_memory, 0 );
memcpy( memstart, memory_backup.data(), memory_backup.size() );
return;
return;
auto start = fc::time_point::now();
RootResolver rootResolver;
...
...
@@ -423,7 +423,7 @@ DEFINE_INTRINSIC_FUNCTION1(env,toUpper,toUpper,none,i32,charptr) {
current_module = instantiateModule( *module, std::move(linkResult.resolvedImports) );
FC_ASSERT( current_module );
current_memory = Runtime::getDefaultMemory(current_module);
auto end = fc::time_point::now();
idump(( 1000000.0 / (end-start).count() ) );
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录