Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
1a08bd91
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,发现更多精彩内容 >>
未验证
提交
1a08bd91
编写于
2月 06, 2018
作者:
W
wanderingbort
提交者:
GitHub
2月 06, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1316 from EOSIO/feature/fix-memory-tests
fixes for wasm memory tests
上级
9d5f9e98
20853c52
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
32 deletion
+20
-32
libraries/chain/contracts/eosio_contract.cpp
libraries/chain/contracts/eosio_contract.cpp
+4
-0
libraries/wasm-jit/Source/WASM/WASMSerialization.cpp
libraries/wasm-jit/Source/WASM/WASMSerialization.cpp
+15
-7
tests/wasm_tests/wasm_tests.cpp
tests/wasm_tests/wasm_tests.cpp
+1
-25
未找到文件。
libraries/chain/contracts/eosio_contract.cpp
浏览文件 @
1a08bd91
...
...
@@ -116,6 +116,10 @@ void apply_eosio_setcode(apply_context& context) {
auto
code_id
=
fc
::
sha256
::
hash
(
act
.
code
.
data
(),
act
.
code
.
size
()
);
// TODO: remove this compilation step in favor of validation without compilation
auto
&
code
=
context
.
mutable_controller
.
get_wasm_cache
().
checkout
(
code_id
,
act
.
code
.
data
(),
act
.
code
.
size
());
context
.
mutable_controller
.
get_wasm_cache
().
checkin
(
code_id
,
code
);
const
auto
&
account
=
db
.
get
<
account_object
,
by_name
>
(
act
.
account
);
// wlog( "set code: ${size}", ("size",act.code.size()));
db
.
modify
(
account
,
[
&
](
auto
&
a
)
{
...
...
libraries/wasm-jit/Source/WASM/WASMSerialization.cpp
浏览文件 @
1a08bd91
...
...
@@ -186,8 +186,10 @@ public:
{}
void
addCall
(
const
Module
&
module
,
Serialization
::
OutputStream
&
inByteStream
)
void
addCall
(
Module
&
module
,
Serialization
::
OutputStream
&
inByteStream
)
{
// make sure the import is added
addImport
(
module
);
OpcodeAndImm
<
CallImm
>*
encodedOperator
=
(
OpcodeAndImm
<
CallImm
>*
)
inByteStream
.
advance
(
sizeof
(
OpcodeAndImm
<
CallImm
>
));
encodedOperator
->
opcode
=
Opcode
::
call
;
// checktime will be the last defined import
...
...
@@ -217,11 +219,17 @@ public:
void
addImport
(
Module
&
module
)
{
const
U32
functionTypeIndex
=
typeSlot
;
module
.
functions
.
imports
.
push_back
({{
functionTypeIndex
},
std
::
move
(
u8"env"
),
std
::
move
(
u8"checktime"
)});
if
(
module
.
functions
.
imports
.
size
()
==
0
||
module
.
functions
.
imports
.
back
().
exportName
.
compare
(
u8"checktime"
)
!=
0
)
{
if
(
typeSlot
<
0
)
{
addTypeSlot
(
module
);
}
const
U32
functionTypeIndex
=
typeSlot
;
module
.
functions
.
imports
.
push_back
({{
functionTypeIndex
},
std
::
move
(
u8"env"
),
std
::
move
(
u8"checktime"
)});
}
}
void
conditionallyAddCall
(
Opcode
opcode
,
const
ControlStructureImm
&
imm
,
const
Module
&
module
,
Serialization
::
OutputStream
&
inByteStream
)
void
conditionallyAddCall
(
Opcode
opcode
,
const
ControlStructureImm
&
imm
,
Module
&
module
,
Serialization
::
OutputStream
&
inByteStream
)
{
switch
(
opcode
)
{
...
...
@@ -234,7 +242,7 @@ public:
}
template
<
typename
Imm
>
void
conditionallyAddCall
(
Opcode
,
const
Imm
&
,
const
Module
&
,
Serialization
::
OutputStream
&
)
void
conditionallyAddCall
(
Opcode
,
const
Imm
&
,
Module
&
,
Serialization
::
OutputStream
&
)
{
}
...
...
@@ -270,12 +278,12 @@ private:
struct
NoOpInjection
{
void
addCall
(
const
Module
&
,
Serialization
::
OutputStream
&
)
{}
void
addCall
(
Module
&
,
Serialization
::
OutputStream
&
)
{}
void
setTypeSlot
(
const
Module
&
,
ResultType
,
const
std
::
vector
<
ValueType
>&
)
{}
void
addTypeSlot
(
Module
&
)
{}
void
addImport
(
Module
&
)
{}
template
<
typename
Imm
>
void
conditionallyAddCall
(
Opcode
,
const
Imm
&
,
const
Module
&
,
Serialization
::
OutputStream
&
)
{}
void
conditionallyAddCall
(
Opcode
,
const
Imm
&
,
Module
&
,
Serialization
::
OutputStream
&
)
{}
void
adjustIfFunctionIndex
(
Uptr
&
,
ObjectKind
)
{}
void
adjustExportIndex
(
Module
&
)
{}
template
<
typename
Imm
>
...
...
tests/wasm_tests/wasm_tests.cpp
浏览文件 @
1a08bd91
...
...
@@ -522,33 +522,9 @@ BOOST_FIXTURE_TEST_CASE( memory_operators, tester ) try {
BOOST_CHECK_THROW
(
set_code
(
N
(
current_memory
),
current_memory_wast
),
eosio
::
chain
::
wasm_execution_error
);
produce_blocks
(
1
);
{
signed_transaction
trx
;
action
act
;
act
.
account
=
N
(
current_memory
);
act
.
authorization
=
vector
<
permission_level
>
{{
N
(
current_memory
),
config
::
active_name
}};
trx
.
actions
.
push_back
(
act
);
set_tapos
(
trx
);
trx
.
sign
(
get_private_key
(
N
(
current_memory
),
"active"
),
chain_id_type
());
BOOST_CHECK_THROW
(
push_transaction
(
trx
),
fc
::
unhandled_exception
);
}
produce_blocks
(
1
);
set_code
(
N
(
current_memory
),
grow_memory_wast
);
BOOST_CHECK_THROW
(
set_code
(
N
(
current_memory
),
grow_memory_wast
),
eosio
::
chain
::
wasm_execution_error
);
produce_blocks
(
1
);
{
signed_transaction
trx
;
action
act
;
act
.
account
=
N
(
current_memory
);
act
.
authorization
=
vector
<
permission_level
>
{{
N
(
current_memory
),
config
::
active_name
}};
trx
.
actions
.
push_back
(
act
);
set_tapos
(
trx
);
trx
.
sign
(
get_private_key
(
N
(
current_memory
),
"active"
),
chain_id_type
());
BOOST_CHECK_THROW
(
push_transaction
(
trx
),
fc
::
unhandled_exception
);
produce_blocks
(
1
);
}
}
FC_LOG_AND_RETHROW
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录