Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
a484af6f
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,发现更多精彩内容 >>
提交
a484af6f
编写于
8月 07, 2017
作者:
M
Matias Romeo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement missing db functions
上级
f1f42c50
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
693 addition
and
286 deletion
+693
-286
libraries/chain/include/eos/chain/message_handling_contexts.hpp
...ies/chain/include/eos/chain/message_handling_contexts.hpp
+87
-10
libraries/chain/include/eos/chain/wasm_interface.hpp
libraries/chain/include/eos/chain/wasm_interface.hpp
+5
-3
libraries/chain/message_handling_contexts.cpp
libraries/chain/message_handling_contexts.cpp
+468
-186
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+133
-87
未找到文件。
libraries/chain/include/eos/chain/message_handling_contexts.hpp
浏览文件 @
a484af6f
...
...
@@ -20,29 +20,106 @@ class apply_context {
TransactionAuthorizationChecker
*
authChecker
)
:
controller
(
con
),
db
(
db
),
trx
(
t
),
msg
(
m
),
code
(
code
),
mutable_controller
(
con
),
mutable_db
(
db
),
authChecker
(
authChecker
){}
int32_t
store_i64
(
Name
scope
,
Name
table
,
Name
key
,
const
char
*
data
,
uint32_t
len
);
int32_t
remove_i64
(
Name
scope
,
Name
table
,
Name
key
);
int32_t
remove_i128i128
(
Name
scope
,
Name
table
,
uint128_t
primary
,
uint128_t
secondary
);
int32_t
store_i128i128
(
Name
scope
,
Name
table
,
uint128_t
primary
,
uint128_t
secondary
,
const
char
*
data
,
uint32_t
len
);
int32_t
store_i64
(
Name
scope
,
Name
code
,
Name
table
,
uint64_t
*
key
,
char
*
data
,
uint32_t
len
);
int32_t
load_i64
(
Name
scope
,
Name
code
,
Name
table
,
Name
Key
,
char
*
data
,
uint32_t
maxlen
);
int32_t
update_i64
(
Name
scope
,
Name
code
,
Name
table
,
uint64_t
*
key
,
char
*
data
,
uint32_t
len
);
int32_t
remove_i64
(
Name
scope
,
Name
code
,
Name
table
,
uint64_t
*
key
,
char
*
data
,
uint32_t
len
);
int32_t
load_i64
(
Name
scope
,
Name
code
,
Name
table
,
uint64_t
*
key
,
char
*
data
,
uint32_t
maxlen
);
int32_t
front_i64
(
Name
scope
,
Name
code
,
Name
table
,
uint64_t
*
key
,
char
*
data
,
uint32_t
maxlen
);
int32_t
back_i64
(
Name
scope
,
Name
code
,
Name
table
,
uint64_t
*
key
,
char
*
data
,
uint32_t
maxlen
);
int32_t
next_i64
(
Name
scope
,
Name
code
,
Name
table
,
uint64_t
*
key
,
char
*
data
,
uint32_t
maxlen
);
int32_t
previous_i64
(
Name
scope
,
Name
code
,
Name
table
,
uint64_t
*
key
,
char
*
data
,
uint32_t
maxlen
);
int32_t
lower_bound_i64
(
Name
scope
,
Name
code
,
Name
table
,
uint64_t
*
key
,
char
*
data
,
uint32_t
maxlen
);
int32_t
upper_bound_i64
(
Name
scope
,
Name
code
,
Name
table
,
uint64_t
*
key
,
char
*
data
,
uint32_t
maxlen
);
int32_t
store_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
len
);
int32_t
update_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
len
);
int32_t
remove_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
len
);
template
<
typename
T
>
int32_t
load_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
value
,
uint32_t
valuelen
);
template
<
typename
T
>
int32_t
front_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
value
,
uint32_t
valuelen
);
template
<
typename
T
>
int32_t
back_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
value
,
uint32_t
valuelen
);
template
<
typename
T
>
int32_t
next_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
value
,
uint32_t
valuelen
);
template
<
typename
T
>
int32_t
previous_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
value
,
uint32_t
valuelen
);
template
<
typename
T
>
int32_t
lower_bound_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
value
,
uint32_t
valuelen
);
template
<
typename
T
>
int32_t
upper_bound_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
value
,
uint32_t
valuelen
);
int32_t
load_primary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
front_primary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
back_primary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
next_primary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
previous_primary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
lower_bound_primary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
upper_bound_primary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
load_secondary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
front_secondary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
back_secondary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
load_primary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
int32_t
next_secondary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
load_secondary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
int32_t
previous_secondary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
lowerbound_primary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
int32_t
lower_bound_secondary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
int32_t
lowerbound_secondary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
int32_t
upper_bound_secondary_i128i128
(
Name
scope
,
Name
code
,
Name
table
,
uint128_t
*
primary
,
uint128_t
*
secondary
,
char
*
data
,
uint32_t
maxlen
);
void
require_authorization
(
const
types
::
AccountName
&
account
);
...
...
libraries/chain/include/eos/chain/wasm_interface.hpp
浏览文件 @
a484af6f
...
...
@@ -8,8 +8,6 @@
namespace
eos
{
namespace
chain
{
class
chain_controller
;
typedef
int32_t
(
apply_context
::*
load_i128i128_fnc
)(
Name
,
Name
,
Name
,
uint128_t
*
,
uint128_t
*
,
char
*
,
uint32_t
);
/**
* @class wasm_interface
*
...
...
@@ -64,7 +62,11 @@ class wasm_interface {
wasm_interface
();
int32_t
load_i128i128_object
(
uint64_t
scope
,
uint64_t
code
,
uint64_t
table
,
int32_t
valueptr
,
int32_t
valuelen
,
load_i128i128_fnc
function
);
template
<
typename
Function
>
int32_t
validate_i128i128
(
int32_t
valueptr
,
int32_t
valuelen
,
Function
&&
func
);
template
<
typename
Function
>
int32_t
validate_i64
(
int32_t
valueptr
,
int32_t
valuelen
,
Function
&&
func
);
};
...
...
libraries/chain/message_handling_contexts.cpp
浏览文件 @
a484af6f
此差异已折叠。
点击以展开。
libraries/chain/wasm_interface.cpp
浏览文件 @
a484af6f
...
...
@@ -33,15 +33,15 @@ DEFINE_INTRINSIC_FUNCTION0(env,checktime,checktime,none) {
throw
checktime_exceeded
();
}
}
int32_t
load_i128i128_object
(
uint64_t
scope
,
uint64_t
code
,
uint64_t
table
,
int32_t
valueptr
,
int32_t
valuelen
,
load_i128i128_fnc
function
)
{
template
<
typename
Function
>
int32_t
validate_i128i128
(
int32_t
valueptr
,
int32_t
valuelen
,
Function
&&
func
)
{
static
const
uint32_t
keylen
=
2
*
sizeof
(
uint128_t
);
FC_ASSERT
(
valuelen
>=
keylen
,
"insufficient data passed"
);
auto
&
wasm
=
wasm_interface
::
get
();
FC_ASSERT
(
wasm
.
current_
validate_context
,
"no validate
context found"
);
FC_ASSERT
(
wasm
.
current_
apply_context
,
"no apply
context found"
);
char
*
value
=
memoryArrayPtr
<
char
>
(
wasm
.
current_memory
,
valueptr
,
valuelen
);
uint128_t
*
primary
=
reinterpret_cast
<
uint128_t
*>
(
value
);
...
...
@@ -50,14 +50,54 @@ DEFINE_INTRINSIC_FUNCTION0(env,checktime,checktime,none) {
valuelen
-=
keylen
;
value
+=
keylen
;
auto
res
=
(
wasm
.
current_validate_context
->*
function
)(
Name
(
scope
),
Name
(
code
),
Name
(
table
),
primary
,
secondary
,
value
,
valuelen
);
return
func
(
wasm
.
current_apply_context
,
primary
,
secondary
,
value
,
valuelen
);
}
template
<
typename
Function
>
int32_t
validate_i64
(
int32_t
valueptr
,
int32_t
valuelen
,
Function
&&
func
)
{
static
const
uint32_t
keylen
=
sizeof
(
uint64_t
);
FC_ASSERT
(
valuelen
>=
keylen
);
auto
&
wasm
=
wasm_interface
::
get
();
FC_ASSERT
(
wasm
.
current_apply_context
,
"no apply context found"
);
auto
mem
=
wasm
.
current_memory
;
char
*
value
=
memoryArrayPtr
<
char
>
(
mem
,
valueptr
,
valuelen
);
uint64_t
*
key
=
reinterpret_cast
<
uint64_t
*>
(
value
);
if
(
res
>
0
)
res
+=
keylen
;
return
res
;
valuelen
-=
keylen
;
value
+=
keylen
;
return
func
(
wasm
.
current_apply_context
,
key
,
value
,
valuelen
);
}
#define READ_i64_OBJ(func_name) \
validate_i64(valueptr, valuelen, [&](apply_context* ctx, uint64_t* key, char *data, uint32_t datalen) -> int32_t { \
auto res = ctx->func_name( Name(scope), Name(code), Name(table), key, data, datalen); \
if (res >= 0) res += sizeof(uint64_t); \
return res; \
});
#define UPDATE_i64_OBJ(func_name, data_size) \
validate_i64(valueptr, data_size, [&](apply_context* ctx, uint64_t* key, char *data, uint32_t datalen) -> int32_t { \
return ctx->func_name( Name(scope), Name(ctx->code.value), Name(table), key, data, datalen); \
});
#define READ_i128i128_OBJ(func_name) \
validate_i128i128(valueptr, valuelen, [&](apply_context* ctx, uint128_t* primary, uint128_t* secondary, char *data, uint32_t datalen) -> int32_t { \
auto res = ctx->func_name( Name(scope), Name(code), Name(table), primary, secondary, data, datalen); \
if (res >= 0) res += 2*sizeof(uint128_t); \
return res; \
});
#define UPDATE_i128i128_OBJ(func_name, data_size) \
validate_i128i128(valueptr, data_size, [&](apply_context* ctx, uint128_t* primary, uint128_t* secondary, char *data, uint32_t datalen) -> int32_t { \
return ctx->func_name( Name(scope), Name(ctx->code.value), Name(table), primary, secondary, data, datalen); \
});
DEFINE_INTRINSIC_FUNCTION3
(
env
,
assert_sha256
,
assert_sha256
,
none
,
i32
,
dataptr
,
i32
,
datalen
,
i32
,
hash
)
{
FC_ASSERT
(
datalen
>
0
);
...
...
@@ -104,25 +144,44 @@ DEFINE_INTRINSIC_FUNCTION0(env,now,now,i32) {
return
wasm_interface
::
get
().
current_validate_context
->
controller
.
head_block_time
().
sec_since_epoch
();
}
DEFINE_INTRINSIC_FUNCTION4
(
env
,
store_i128i128
,
store_i128i128
,
i32
,
i64
,
scope
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
static
const
uint32_t
keylen
=
2
*
sizeof
(
uint128_t
);
FC_ASSERT
(
valuelen
>=
keylen
,
"insufficient data passed"
);
DEFINE_INTRINSIC_FUNCTION4
(
env
,
store_i64
,
store_i64
,
i32
,
i64
,
scope
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
UPDATE_i64_OBJ
(
store_i64
,
valuelen
);
}
auto
&
wasm
=
wasm_interface
::
get
();
FC_ASSERT
(
wasm
.
current_apply_context
,
"no apply context found"
);
DEFINE_INTRINSIC_FUNCTION4
(
env
,
update_i64
,
update_i64
,
i32
,
i64
,
scope
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
UPDATE_i64_OBJ
(
update_i64
,
valuelen
);
}
DEFINE_INTRINSIC_FUNCTION3
(
env
,
remove_i64
,
remove_i64
,
i32
,
i64
,
scope
,
i64
,
table
,
i32
,
valueptr
)
{
return
UPDATE_i64_OBJ
(
remove_i64
,
sizeof
(
uint64_t
));
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
load_i64
,
load_i64
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i64_OBJ
(
load_i64
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
front_i64
,
front_i64
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i64_OBJ
(
front_i64
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
back_i64
,
back_i64
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i64_OBJ
(
back_i64
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
next_i64
,
next_i64
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i64_OBJ
(
next_i64
);
}
char
*
value
=
memoryArrayPtr
<
char
>
(
wasm
.
current_memory
,
valueptr
,
valuelen
);
uint128_t
*
primary
=
reinterpret_cast
<
uint128_t
*>
(
value
);
uint128_t
*
secondary
=
primary
+
1
;
valuelen
-=
keylen
;
value
+=
keylen
;
DEFINE_INTRINSIC_FUNCTION5
(
env
,
previous_i64
,
previous_i64
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i64_OBJ
(
previous_i64
);
}
//wdump((datalen)(valuelen)(result));
return
wasm
.
current_apply_context
->
store_i128i128
(
Name
(
scope
),
Name
(
table
),
*
primary
,
*
secondary
,
value
,
valuelen
);
DEFINE_INTRINSIC_FUNCTION5
(
env
,
lower_bound_i64
,
lower_bound_i64
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i64_OBJ
(
lower_bound_i64
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
upper_bound_i64
,
upper_bound_i64
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i64_OBJ
(
upper_bound_i64
);
}
struct
i128_keys
{
...
...
@@ -130,36 +189,72 @@ struct i128_keys {
uint128_t
secondary
;
};
DEFINE_INTRINSIC_FUNCTION
3
(
env
,
remove_i128i128
,
remove_i128i128
,
i32
,
i64
,
scope
,
i64
,
table
,
i32
,
data
)
{
auto
&
wasm
=
wasm_interface
::
get
(
);
FC_ASSERT
(
wasm
.
current_apply_context
,
"not a valid apply context"
);
DEFINE_INTRINSIC_FUNCTION
4
(
env
,
store_i128i128
,
store_i128i128
,
i32
,
i64
,
scope
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
UPDATE_i128i128_OBJ
(
store_i128i128
,
valuelen
);
}
const
i128_keys
&
keys
=
memoryRef
<
const
i128_keys
>
(
wasm
.
current_memory
,
data
);
return
wasm_interface
::
get
().
current_apply_context
->
remove_i128i128
(
Name
(
scope
),
Name
(
table
),
keys
.
primary
,
keys
.
secondary
);
DEFINE_INTRINSIC_FUNCTION4
(
env
,
update_i128i128
,
update_i128i128
,
i32
,
i64
,
scope
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
UPDATE_i128i128_OBJ
(
update_i128i128
,
valuelen
);
}
DEFINE_INTRINSIC_FUNCTION3
(
env
,
remove_i128i128
,
remove_i128i128
,
i32
,
i64
,
scope
,
i64
,
table
,
i32
,
valueptr
)
{
return
UPDATE_i128i128_OBJ
(
remove_i128i128
,
2
*
sizeof
(
uint128_t
));
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
load_primary_i128i128
,
load_primary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
load_i128i128_object
(
scope
,
code
,
table
,
valueptr
,
valuelen
,
&
apply_context
::
load_primary_i128i128
);
return
READ_i128i128_OBJ
(
load_primary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
load_secondary_i128i128
,
load_second
ary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
load_i128i128_object
(
scope
,
code
,
table
,
valueptr
,
valuelen
,
&
apply_context
::
load_second
ary_i128i128
);
DEFINE_INTRINSIC_FUNCTION5
(
env
,
front_primary_i128i128
,
front_prim
ary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i128i128_OBJ
(
front_prim
ary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
back_primary_i128i128
,
back_primary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
load_i128i128_object
(
scope
,
code
,
table
,
valueptr
,
valuelen
,
&
apply_context
::
back_primary_i128i128
);
return
READ_i128i128_OBJ
(
back_primary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
front_primary_i128i128
,
front_primary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
load_i128i128_object
(
scope
,
code
,
table
,
valueptr
,
valuelen
,
&
apply_context
::
front_primary_i128i128
);
DEFINE_INTRINSIC_FUNCTION5
(
env
,
next_primary_i128i128
,
next_primary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i128i128_OBJ
(
next_primary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
previous_primary_i128i128
,
previous_primary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i128i128_OBJ
(
previous_primary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
upper_bound_primary_i128i128
,
upper_bound_primary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i128i128_OBJ
(
upper_bound_primary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
lower_bound_primary_i128i128
,
lower_bound_primary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i128i128_OBJ
(
lower_bound_primary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
load_secondary_i128i128
,
load_secondary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i128i128_OBJ
(
load_secondary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
back_secondary_i128i128
,
back_secondary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
load_i128i128_object
(
scope
,
code
,
table
,
valueptr
,
valuelen
,
&
apply_context
::
back_secondary_i128i128
);
return
READ_i128i128_OBJ
(
back_secondary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
front_secondary_i128i128
,
front_secondary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
load_i128i128_object
(
scope
,
code
,
table
,
valueptr
,
valuelen
,
&
apply_context
::
front_secondary_i128i128
);
return
READ_i128i128_OBJ
(
front_secondary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
next_secondary_i128i128
,
next_secondary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i128i128_OBJ
(
next_secondary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
previous_secondary_i128i128
,
previous_secondary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i128i128_OBJ
(
previous_secondary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
upper_bound_secondary_i128i128
,
upper_bound_secondary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i128i128_OBJ
(
upper_bound_secondary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
lower_bound_secondary_i128i128
,
lower_bound_secondary_i128i128
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
return
READ_i128i128_OBJ
(
lower_bound_secondary_i128i128
);
}
DEFINE_INTRINSIC_FUNCTION0
(
env
,
currentCode
,
currentCode
,
i64
)
{
...
...
@@ -182,55 +277,6 @@ DEFINE_INTRINSIC_FUNCTION1(env,requireScope,requireScope,none,i64,scope) {
wasm_interface
::
get
().
current_validate_context
->
require_scope
(
scope
);
}
DEFINE_INTRINSIC_FUNCTION4
(
env
,
store_i64
,
store_i64
,
i32
,
i64
,
scope
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
static
const
uint32_t
keylen
=
sizeof
(
uint64_t
);
FC_ASSERT
(
valuelen
>=
sizeof
(
uint64_t
)
);
auto
&
wasm
=
wasm_interface
::
get
();
FC_ASSERT
(
wasm
.
current_apply_context
,
"no apply context found"
);
auto
mem
=
wasm
.
current_memory
;
char
*
value
=
memoryArrayPtr
<
char
>
(
mem
,
valueptr
,
valuelen
);
uint64_t
*
key
=
reinterpret_cast
<
uint64_t
*>
(
value
);
valuelen
-=
keylen
;
value
+=
keylen
;
//idump((Name(scope))(Name(code))(Name(table))(Name(key))(valuelen) );
return
wasm
.
current_apply_context
->
store_i64
(
scope
,
table
,
*
key
,
value
,
valuelen
);
}
DEFINE_INTRINSIC_FUNCTION5
(
env
,
load_i64
,
load_i64
,
i32
,
i64
,
scope
,
i64
,
code
,
i64
,
table
,
i32
,
valueptr
,
i32
,
valuelen
)
{
//idump((Name(scope))(Name(code))(Name(table))(Name(key))(valuelen) );
static
const
uint32_t
keylen
=
sizeof
(
uint64_t
);
FC_ASSERT
(
valuelen
>=
keylen
);
auto
&
wasm
=
wasm_interface
::
get
();
FC_ASSERT
(
wasm
.
current_validate_context
,
"no validate context found"
);
auto
mem
=
wasm
.
current_memory
;
char
*
value
=
memoryArrayPtr
<
char
>
(
mem
,
valueptr
,
valuelen
);
uint64_t
*
key
=
reinterpret_cast
<
uint64_t
*>
(
value
);
valuelen
-=
keylen
;
value
+=
keylen
;
auto
res
=
wasm
.
current_validate_context
->
load_i64
(
scope
,
code
,
table
,
*
key
,
value
,
valuelen
);
if
(
res
>
0
)
res
+=
keylen
;
return
res
;
}
DEFINE_INTRINSIC_FUNCTION3
(
env
,
remove_i64
,
remove_i64
,
i32
,
i64
,
scope
,
i64
,
table
,
i64
,
key
)
{
auto
&
wasm
=
wasm_interface
::
get
();
FC_ASSERT
(
wasm
.
current_apply_context
,
"no apply context found"
);
return
wasm
.
current_apply_context
->
remove_i64
(
scope
,
table
,
key
);
}
DEFINE_INTRINSIC_FUNCTION3
(
env
,
memcpy
,
memcpy
,
i32
,
i32
,
dstp
,
i32
,
srcp
,
i32
,
len
)
{
auto
&
wasm
=
wasm_interface
::
get
();
auto
mem
=
wasm
.
current_memory
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录