Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
83a4a26a
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,发现更多精彩内容 >>
提交
83a4a26a
编写于
3月 15, 2018
作者:
B
Bucky Kittinger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Started soft float tests
上级
71e801c5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
120 addition
and
2 deletion
+120
-2
contracts/CMakeLists.txt
contracts/CMakeLists.txt
+1
-0
contracts/eosiolib/datastream.hpp
contracts/eosiolib/datastream.hpp
+27
-0
contracts/floattest/CMakeLists.txt
contracts/floattest/CMakeLists.txt
+8
-0
contracts/floattest/floattest.abi
contracts/floattest/floattest.abi
+21
-0
contracts/floattest/floattest.cpp
contracts/floattest/floattest.cpp
+9
-0
contracts/floattest/floattest.hpp
contracts/floattest/floattest.hpp
+37
-0
libraries/chain/include/eosio/chain/wasm_eosio_injection.hpp
libraries/chain/include/eosio/chain/wasm_eosio_injection.hpp
+17
-2
未找到文件。
contracts/CMakeLists.txt
浏览文件 @
83a4a26a
...
...
@@ -28,6 +28,7 @@ add_subdirectory(simpledb)
#add_subdirectory(social)
add_subdirectory
(
test.system
)
add_subdirectory
(
noop
)
add_subdirectory
(
floattest
)
file
(
GLOB SKELETONS RELATIVE
${
CMAKE_SOURCE_DIR
}
/contracts
"skeleton/*"
)
...
...
contracts/eosiolib/datastream.hpp
浏览文件 @
83a4a26a
...
...
@@ -154,6 +154,33 @@ inline datastream<Stream>& operator>>(datastream<Stream>& ds, key256& d) {
return
ds
;
}
/**
* Serialize a float into a stream
* @brief Serialize a float
* @param ds stream to write
* @param d value to serialize
*/
template
<
typename
Stream
>
inline
datastream
<
Stream
>&
operator
<<
(
datastream
<
Stream
>&
ds
,
float
d
)
{
uint32_t
val
=
*
(
uint32_t
*
)(
&
d
);
ds
.
write
(
(
const
char
*
)
&
val
,
sizeof
(
val
)
);
return
ds
;
}
/**
* Deserialize a float from a stream
* @brief Deserialize a float
* @param ds stream to read
* @param d destination for deserialized value
*/
template
<
typename
Stream
>
inline
datastream
<
Stream
>&
operator
>>
(
datastream
<
Stream
>&
ds
,
float
&
d
)
{
uint32_t
val
=
0
;
ds
.
read
((
char
*
)
&
val
,
sizeof
(
val
)
);
d
=
*
(
float
*
)(
&
val
);
return
ds
;
}
/**
* Serialize a double into a stream
* @brief Serialize a double
...
...
contracts/floattest/CMakeLists.txt
0 → 100644
浏览文件 @
83a4a26a
file
(
GLOB ABI_FILES
"*.abi"
)
configure_file
(
"
${
ABI_FILES
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
COPYONLY
)
add_wast_executable
(
TARGET floattest
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES libc++ libc eosiolib
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
contracts/floattest/floattest.abi
0 → 100644
浏览文件 @
83a4a26a
{
"types": [{
"new_type_name": "account_name",
"type": "name"
}
],
"structs": [{
"name": "f32add",
"base": "",
"fields": [
{ "name" : "test_output", "type" : "vector<float>" }
]
}
],
"actions": [{
"name":"f32add",
"type":"f32add"
}
],
"tables": []
}
contracts/floattest/floattest.cpp
0 → 100644
浏览文件 @
83a4a26a
#include <floattest/floattest.hpp>
namespace
floattest
{
extern
"C"
{
void
apply
(
uint64_t
code
,
uint64_t
action
)
{
eosio
::
dispatch
<
floattest
,
floattest
::
f32add
>
(
code
,
action
);
}
}
}
contracts/floattest/floattest.hpp
0 → 100644
浏览文件 @
83a4a26a
/**
* @file
* @copyright defined in eos/LICENSE.txt
*/
#pragma once
#include <vector>
#include <eosiolib/eosio.hpp>
#include <eosiolib/dispatcher.hpp>
namespace
floattest
{
using
std
::
string
;
/**
noop contract
All it does is require sender authorization.
Actions: anyaction
*/
class
floattest
{
public:
ACTION
(
N
(
floattest
),
f32add
)
{
f32add
()
{
}
f32add
(
std
::
vector
<
float
>
outs
)
:
outputs
(
outs
)
{}
std
::
vector
<
float
>
outputs
;
EOSLIB_SERIALIZE
(
f32add
,
(
outputs
))
};
static
void
on
(
const
f32add
&
act
)
{
prints
(
"Hello
\n
"
);
}
};
}
/// noop
libraries/chain/include/eosio/chain/wasm_eosio_injection.hpp
浏览文件 @
83a4a26a
...
...
@@ -151,7 +151,6 @@ namespace eosio { namespace chain { namespace wasm_injections {
static
constexpr
bool
post
=
true
;
static
void
init
()
{
checktime_idx
=
-
1
;
}
static
void
accept
(
wasm_ops
::
instr
*
inst
,
wasm_ops
::
visitor_arg
&
arg
)
{
#if 1
// first add the import for checktime
injector_utils
::
add_import
<
ResultType
::
none
,
ValueType
::
i32
>
(
*
(
arg
.
module
),
u8"env"
,
u8"checktime"
,
checktime_idx
);
...
...
@@ -167,7 +166,6 @@ namespace eosio { namespace chain { namespace wasm_injections {
std
::
vector
<
U8
>
tmp
=
chktm
.
pack
();
injected
.
insert
(
injected
.
end
(),
tmp
.
begin
(),
tmp
.
end
()
);
arg
.
new_code
->
insert
(
arg
.
new_code
->
end
(),
injected
.
begin
(),
injected
.
end
()
);
#endif
}
static
int32_t
checktime_idx
;
};
...
...
@@ -191,7 +189,22 @@ namespace eosio { namespace chain { namespace wasm_injections {
}
};
// float injections
struct
f32_add_injector
{
static
constexpr
bool
kills
=
true
;
static
constexpr
bool
post
=
false
;
static
void
init
()
{}
static
void
accept
(
wasm_ops
::
instr
*
inst
,
wasm_ops
::
visitor_arg
&
arg
)
{
int32_t
idx
;
injector_utils
::
add_import
<
ResultType
::
f32
,
ValueType
::
f32
,
ValueType
::
f32
>
(
*
(
arg
.
module
),
u8"env"
,
u8"f32_add"
,
idx
);
wasm_ops
::
op_types
<>::
call_t
f32add
;
f32add
.
field
=
idx
;
std
::
vector
<
U8
>
injected
=
f32add
.
pack
();
arg
.
new_code
->
insert
(
arg
.
new_code
->
end
(),
injected
.
begin
(),
injected
.
end
()
);
}
};
struct
pre_op_injectors
:
wasm_ops
::
op_types
<
pass_injector
>
{
using
block_t
=
wasm_ops
::
block
<
instruction_counter
,
checktime_injector
>
;
using
loop_t
=
wasm_ops
::
loop
<
instruction_counter
,
checktime_injector
>
;
...
...
@@ -309,6 +322,8 @@ namespace eosio { namespace chain { namespace wasm_injections {
using
i64_rotl_t
=
wasm_ops
::
i64_rotl
<
instruction_counter
>
;
using
i64_rotr_t
=
wasm_ops
::
i64_rotr
<
instruction_counter
>
;
using
f32_add_t
=
wasm_ops
::
f32_add
<
instruction_counter
,
f32_add_injector
>
;
using
i32_wrap_i64_t
=
wasm_ops
::
i32_wrap_i64
<
instruction_counter
>
;
using
i64_extend_s_i32_t
=
wasm_ops
::
i64_extend_s_i32
<
instruction_counter
>
;
using
i64_extend_u_i32_t
=
wasm_ops
::
i64_extend_u_i32
<
instruction_counter
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录