Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
e729fc0d
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,发现更多精彩内容 >>
提交
e729fc0d
编写于
2月 07, 2018
作者:
B
Brian Johnson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding passing a integer value (hard coded currently) to checktime.
上级
71c5f6dd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
23 deletion
+22
-23
libraries/chain/apply_context.cpp
libraries/chain/apply_context.cpp
+1
-1
libraries/chain/include/eosio/chain/apply_context.hpp
libraries/chain/include/eosio/chain/apply_context.hpp
+1
-1
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+3
-4
libraries/wasm-jit/Source/WASM/WASMSerialization.cpp
libraries/wasm-jit/Source/WASM/WASMSerialization.cpp
+17
-17
未找到文件。
libraries/chain/apply_context.cpp
浏览文件 @
e729fc0d
...
...
@@ -238,7 +238,7 @@ void apply_context::checktime_start() {
_checktime_start
=
fc
::
time_point
::
now
();
}
void
apply_context
::
checktime
()
const
{
void
apply_context
::
checktime
(
uint32_t
instruction_count
)
const
{
if
((
fc
::
time_point
::
now
()
-
_checktime_start
).
count
()
>
_checktime_limit
)
{
throw
checktime_exceeded
();
}
...
...
libraries/chain/include/eosio/chain/apply_context.hpp
浏览文件 @
e729fc0d
...
...
@@ -368,7 +368,7 @@ class apply_context {
void
checktime_start
();
void
checktime
()
const
;
void
checktime
(
uint32_t
instruction_count
)
const
;
void
update_db_usage
(
const
account_name
&
payer
,
int64_t
delta
)
{
require_write_lock
(
payer
);
...
...
libraries/chain/wasm_interface.cpp
浏览文件 @
e729fc0d
...
...
@@ -220,7 +220,6 @@ namespace eosio { namespace chain {
try
{
Serialization
::
MemoryInputStream
stream
((
const
U8
*
)
wasm_binary
,
wasm_binary_size
);
#warning TODO: restore checktime injection?
WASM
::
serializeWithInjection
(
stream
,
*
module
);
validate_eosio_wasm_constraints
(
*
module
);
...
...
@@ -516,8 +515,8 @@ class checktime_api : public context_aware_api {
public:
using
context_aware_api
::
context_aware_api
;
void
checktime
()
{
context
.
checktime
();
void
checktime
(
uint32_t
instruction_count
)
{
context
.
checktime
(
instruction_count
);
}
};
...
...
@@ -951,7 +950,7 @@ REGISTER_INTRINSICS(privileged_api,
);
REGISTER_INTRINSICS
(
checktime_api
,
(
checktime
,
void
())
(
checktime
,
void
(
int
))
);
REGISTER_INTRINSICS
(
producer_api
,
...
...
libraries/wasm-jit/Source/WASM/WASMSerialization.cpp
浏览文件 @
e729fc0d
...
...
@@ -186,14 +186,14 @@ public:
{}
void
addCall
(
Module
&
module
,
Serialization
::
OutputStream
&
inByte
Stream
)
void
addCall
(
const
Module
&
module
,
OperatorEncoderStream
&
operatorEncoderStream
,
CodeValidationStream
&
codeValidation
Stream
)
{
// 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
encodedOperator
->
imm
.
functionIndex
=
checktimeIndex
(
module
);
LiteralImm
<
I32
>
param_imm
{
11
};
codeValidationStream
.
i32_const
(
param_imm
);
operatorEncoderStream
.
i32_const
(
param_imm
);
CallImm
checktime_imm
{
checktimeIndex
(
module
)
}
;
codeValidationStream
.
call
(
checktime_imm
);
operatorEncoderStream
.
call
(
checktime_imm
);
}
static
U32
checktimeIndex
(
const
Module
&
module
)
...
...
@@ -203,7 +203,7 @@ public:
void
setTypeSlot
(
const
Module
&
module
,
ResultType
returnType
,
const
std
::
vector
<
ValueType
>&
parameterTypes
)
{
if
(
returnType
==
ResultType
::
none
&&
!
parameterTypes
.
size
()
)
if
(
returnType
==
ResultType
::
none
&&
parameterTypes
.
size
()
==
1
&&
parameterTypes
[
0
]
==
ValueType
::
i32
)
typeSlot
=
module
.
types
.
size
()
-
1
;
}
...
...
@@ -213,7 +213,7 @@ public:
{
// add a type for void func(void)
typeSlot
=
module
.
types
.
size
();
module
.
types
.
push_back
(
FunctionType
::
get
(
ResultType
::
none
));
module
.
types
.
push_back
(
FunctionType
::
get
(
ResultType
::
none
,
std
::
vector
<
ValueType
>
(
1
,
ValueType
::
i32
)
));
}
}
...
...
@@ -229,20 +229,20 @@ public:
}
}
void
conditionallyAddCall
(
Opcode
opcode
,
const
ControlStructureImm
&
imm
,
Module
&
module
,
Serialization
::
OutputStream
&
inByte
Stream
)
void
conditionallyAddCall
(
Opcode
opcode
,
const
ControlStructureImm
&
imm
,
const
Module
&
module
,
OperatorEncoderStream
&
operatorEncoderStream
,
CodeValidationStream
&
codeValidation
Stream
)
{
switch
(
opcode
)
{
case
Opcode
::
loop
:
case
Opcode
::
block
:
addCall
(
module
,
inByte
Stream
);
addCall
(
module
,
operatorEncoderStream
,
codeValidation
Stream
);
default:
break
;
};
}
template
<
typename
Imm
>
void
conditionallyAddCall
(
Opcode
,
const
Imm
&
,
Module
&
,
Serialization
::
Output
Stream
&
)
void
conditionallyAddCall
(
Opcode
,
const
Imm
&
,
const
Module
&
,
OperatorEncoderStream
&
,
CodeValidation
Stream
&
)
{
}
...
...
@@ -278,12 +278,12 @@ private:
struct
NoOpInjection
{
void
addCall
(
Module
&
,
Serialization
::
Output
Stream
&
)
{}
void
addCall
(
const
Module
&
,
OperatorEncoderStream
&
,
CodeValidation
Stream
&
)
{}
void
setTypeSlot
(
const
Module
&
,
ResultType
,
const
std
::
vector
<
ValueType
>&
)
{}
void
addTypeSlot
(
Module
&
)
{}
void
addImport
(
Module
&
)
{}
template
<
typename
Imm
>
void
conditionallyAddCall
(
Opcode
,
const
Imm
&
,
Module
&
,
Serialization
::
Output
Stream
&
)
{}
void
conditionallyAddCall
(
Opcode
,
const
Imm
&
,
const
Module
&
,
OperatorEncoderStream
&
,
CodeValidation
Stream
&
)
{}
void
adjustIfFunctionIndex
(
Uptr
&
,
ObjectKind
)
{}
void
adjustExportIndex
(
Module
&
)
{}
template
<
typename
Imm
>
...
...
@@ -619,10 +619,10 @@ namespace WASM
// Deserialize the function code, validate it, and re-encode it in the IR format.
ArrayOutputStream
irCodeByteStream
;
injection
.
addCall
(
module
,
irCodeByteStream
);
CodeValidationStream
codeValidationStream
(
module
,
functionDef
);
OperatorEncoderStream
irEncoderStream
(
irCodeByteStream
);
CodeValidationStream
codeValidationStream
(
module
,
functionDef
);
injection
.
addCall
(
module
,
irEncoderStream
,
codeValidationStream
);
while
(
bodyStream
.
capacity
())
{
Opcode
opcode
;
...
...
@@ -638,7 +638,7 @@ namespace WASM
injection.adjustCallIndex(module, imm); \
codeValidationStream.name(imm); \
irEncoderStream.name(imm); \
injection.conditionallyAddCall(opcode, imm, module, ir
CodeByte
Stream); \
injection.conditionallyAddCall(opcode, imm, module, ir
EncoderStream, codeValidation
Stream); \
break; \
}
ENUM_NONFLOAT_OPERATORS
(
VISIT_OPCODE
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录