Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
2e06b9ec
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,发现更多精彩内容 >>
提交
2e06b9ec
编写于
1月 23, 2018
作者:
A
Anton Perkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add_wast_executable and add_wast_library macros in CMake, paramters for llvm, stltest that works
上级
203c7c91
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
128 addition
and
34 deletion
+128
-34
CMakeModules/wasm.cmake
CMakeModules/wasm.cmake
+14
-13
contracts/CMakeLists.txt
contracts/CMakeLists.txt
+2
-0
contracts/asserter/CMakeLists.txt
contracts/asserter/CMakeLists.txt
+6
-1
contracts/bancor/CMakeLists.txt
contracts/bancor/CMakeLists.txt
+6
-1
contracts/currency/CMakeLists.txt
contracts/currency/CMakeLists.txt
+6
-1
contracts/eosio.system/CMakeLists.txt
contracts/eosio.system/CMakeLists.txt
+6
-1
contracts/eoslib/memory.hpp
contracts/eoslib/memory.hpp
+4
-1
contracts/eoslib/types.h
contracts/eoslib/types.h
+1
-2
contracts/include/stdlib.h
contracts/include/stdlib.h
+21
-0
contracts/include/string.h
contracts/include/string.h
+2
-0
contracts/include/wchar.h
contracts/include/wchar.h
+4
-0
contracts/proxy/CMakeLists.txt
contracts/proxy/CMakeLists.txt
+6
-1
contracts/simpledb/CMakeLists.txt
contracts/simpledb/CMakeLists.txt
+5
-1
contracts/social/CMakeLists.txt
contracts/social/CMakeLists.txt
+5
-1
contracts/stltest/CMakeLists.txt
contracts/stltest/CMakeLists.txt
+2
-2
contracts/stltest/stltest.cpp
contracts/stltest/stltest.cpp
+26
-6
contracts/storage/CMakeLists.txt
contracts/storage/CMakeLists.txt
+7
-1
contracts/test_api/CMakeLists.txt
contracts/test_api/CMakeLists.txt
+5
-1
tests/wasm_tests/wasm_tests.cpp
tests/wasm_tests/wasm_tests.cpp
+0
-1
未找到文件。
CMakeModules/wasm.cmake
浏览文件 @
2e06b9ec
...
...
@@ -59,7 +59,7 @@ if( NOT ("${WASM_CLANG}" STREQUAL "" OR "${WASM_LLC}" STREQUAL "" OR "${WASM_LLV
endif
()
macro
(
compile_wast
)
cmake_parse_arguments
(
ARG
""
"TARGET"
"INCLUDE_FOLDERS
;LIBRARIES
"
${
ARGN
}
)
cmake_parse_arguments
(
ARG
""
"TARGET"
"INCLUDE_FOLDERS"
${
ARGN
}
)
set
(
target
${
ARG_TARGET
}
)
# NOTE: Setting SOURCE_FILE and looping over it to avoid cmake issue with compilation ${target}.bc's rule colliding with
...
...
@@ -115,40 +115,41 @@ macro(compile_wast)
set_property
(
DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
${
target
}
.bc
)
message
(
"OUTPUT:
${
target
}
.bc"
)
endmacro
(
compile_wast
)
macro
(
add_wast_library
)
cmake_parse_arguments
(
ARG
""
"TARGET"
"INCLUDE_FOLDERS
;LIBRARIES
"
${
ARGN
}
)
cmake_parse_arguments
(
ARG
""
"TARGET"
"INCLUDE_FOLDERS"
${
ARGN
}
)
set
(
target
${
ARG_TARGET
}
)
#compile_wast("${ARGS}")
compile_wast
(
TARGET
${
ARG_TARGET
}
INCLUDE_FOLDERS
${
ARG_INCLUDE_FOLDERS
}
LIBRARIES
${
ARG_LIBRARIES
}
)
compile_wast
(
TARGET
${
ARG_TARGET
}
INCLUDE_FOLDERS
${
ARG_INCLUDE_FOLDERS
}
)
add_custom_target
(
${
target
}
ALL DEPENDS
${
ARG_TARGET
}
.bc
)
set
(
"
${
ARG_TARGET
}
_BC_FILENAME"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
ARG_TARGET
}
.bc CACHE INTERNAL
"
${
target
}
.bc file"
)
add_custom_command
(
OUTPUT
${
target
}
.bc
DEPENDS
${
outfiles
}
${
ARG_LIBRARIES
}
COMMAND
${
WASM_LLVM_LINK
}
-o
${
target
}
.bc
${
outfiles
}
${
ARG_LIBRARIES
}
DEPENDS
${
outfiles
}
COMMAND
${
WASM_LLVM_LINK
}
-o
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
target
}
.bc
${
outfiles
}
COMMENT
"Linking LLVM bitcode library
${
target
}
.bc"
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
VERBATIM
)
message
(
"NEW TARGET:
${
target
}
.bc"
)
endmacro
(
add_wast_library
)
macro
(
add_wast_executable
)
cmake_parse_arguments
(
ARG
""
"TARGET;DESTINATION_FOLDER"
"INCLUDE_FOLDERS;LIBRARIES"
${
ARGN
}
)
cmake_parse_arguments
(
ARG
""
"TARGET;DESTINATION_FOLDER"
"INCLUDE_FOLDERS;LIBRARIES
;EXTERNAL_LIBRARIES
"
${
ARGN
}
)
set
(
target
${
ARG_TARGET
}
)
set
(
DESTINATION_FOLDER
${
ARG_DESTINATION_FOLDER
}
)
compile_wast
(
TARGET
${
ARG_TARGET
}
INCLUDE_FOLDERS
${
ARG_INCLUDE_FOLDERS
}
LIBRARIES
${
ARG_LIBRARIES
}
)
compile_wast
(
TARGET
${
ARG_TARGET
}
INCLUDE_FOLDERS
${
ARG_INCLUDE_FOLDERS
}
)
message
(
"OUTFILES:
${
outfiles
}
"
)
foreach
(
lib
${
ARG_LIBRARIES
}
)
list
(
APPEND LIBRARIES
${${
lib
}
_BC_FILENAME
}
)
endforeach
()
add_custom_command
(
OUTPUT
${
target
}
.bc
DEPENDS
${
outfiles
}
COMMAND
${
WASM_LLVM_LINK
}
-only-needed -o
${
target
}
.bc
${
outfiles
}
${
ARG
_LIBRARIES
}
DEPENDS
${
outfiles
}
"
${
ARG_LIBRARIES
}
"
${
LIBRARIES
}
COMMAND
${
WASM_LLVM_LINK
}
-only-needed -o
${
target
}
.bc
${
outfiles
}
${
LIBRARIES
}
${
ARG_EXTERNAL
_LIBRARIES
}
COMMENT
"Linking LLVM bitcode executable
${
target
}
.bc"
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
VERBATIM
...
...
contracts/CMakeLists.txt
浏览文件 @
2e06b9ec
set
(
STANDARD_INCLUDE_FOLDERS
${
CMAKE_SOURCE_DIR
}
/contracts
${
CMAKE_SOURCE_DIR
}
/contracts/stl
${
CMAKE_SOURCE_DIR
}
/contracts/include
)
add_subdirectory
(
eoslib
)
add_subdirectory
(
currency
)
add_subdirectory
(
stltest
)
#add_subdirectory(bancor)
...
...
contracts/asserter/CMakeLists.txt
浏览文件 @
2e06b9ec
file
(
GLOB ABI_FILES
"*.abi"
)
configure_file
(
"
${
ABI_FILES
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
COPYONLY
)
add_wast_target
(
asserter
"
${
STANDARD_INCLUDE_FOLDERS
}
"
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_wast_executable
(
TARGET asserter
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES eoslib
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
contracts/bancor/CMakeLists.txt
浏览文件 @
2e06b9ec
file
(
GLOB ABI_FILES
"*.abi"
)
configure_file
(
"
${
ABI_FILES
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
COPYONLY
)
add_wast_target
(
bancor
"
${
CMAKE_SOURCE_DIR
}
/contracts"
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_wast_executable
(
TARGET bancor
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES eoslib
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
contracts/currency/CMakeLists.txt
浏览文件 @
2e06b9ec
file
(
GLOB ABI_FILES
"*.abi"
)
configure_file
(
"
${
ABI_FILES
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
COPYONLY
)
add_wast_target
(
currency
"
${
STANDARD_INCLUDE_FOLDERS
}
"
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_wast_executable
(
TARGET currency
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES eoslib
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
contracts/eosio.system/CMakeLists.txt
浏览文件 @
2e06b9ec
file
(
GLOB ABI_FILES
"*.abi"
)
configure_file
(
"
${
ABI_FILES
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
COPYONLY
)
add_wast_target
(
eosio.system
"
${
CMAKE_SOURCE_DIR
}
/contracts"
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_wast_executable
(
TARGET eosio.system
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES eoslib
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
contracts/eoslib/memory.hpp
浏览文件 @
2e06b9ec
...
...
@@ -481,7 +481,9 @@ namespace eosio {
uint32_t
_active_heap
;
uint32_t
_active_free_heap
;
static
const
uint32_t
_alloc_memory_mask
=
1
<<
31
;
}
memory_heap
;
};
extern
memory_manager
memory_heap
;
/**
* Allocate a block of memory.
...
...
@@ -532,5 +534,6 @@ namespace eosio {
{
return
memory_heap
.
free
(
ptr
);
}
/// @} /// mathcppapi
}
contracts/eoslib/types.h
浏览文件 @
2e06b9ec
...
...
@@ -5,6 +5,7 @@
#pragma once
#include <stdint.h>
#include <wchar.h>
extern
"C"
{
...
...
@@ -20,8 +21,6 @@ struct uint256 {
uint64_t
words
[
4
];
};
typedef
unsigned
int
size_t
;
typedef
uint64_t
account_name
;
typedef
uint64_t
permission_name
;
typedef
uint64_t
token_name
;
...
...
contracts/include/stdlib.h
浏览文件 @
2e06b9ec
...
...
@@ -4,6 +4,8 @@
*/
#pragma once
#include <eoslib/memory.hpp>
typedef
struct
{
long
quot
;
/* Quotient. */
long
rem
;
/* Remainder. */
...
...
@@ -15,6 +17,7 @@ typedef struct {
}
lldiv_t
;
extern
"C"
{
void
abort
();
long
labs
(
long
i
);
...
...
@@ -24,4 +27,22 @@ extern "C" {
ldiv_t
ldiv
(
long
numer
,
long
denom
);
lldiv_t
lldiv
(
long
long
numer
,
long
long
denom
);
int
posix_memalign
(
void
**
memptr
,
size_t
alignment
,
size_t
size
);
}
inline
void
*
malloc
(
size_t
size
)
{
return
eosio
::
malloc
(
size
);
}
inline
void
*
realloc
(
void
*
ptr
,
size_t
size
)
{
return
eosio
::
realloc
(
ptr
,
size
);
}
inline
void
free
(
void
*
ptr
)
{
return
eosio
::
free
(
ptr
);
}
contracts/include/string.h
浏览文件 @
2e06b9ec
...
...
@@ -5,6 +5,7 @@
#pragma once
#include <stdint.h>
#include <wchar.h>
extern
"C"
{
/**
...
...
@@ -90,6 +91,7 @@ extern "C" {
char
*
strstr
(
const
char
*
haystack
,
const
char
*
needle
);
size_t
strlen
(
const
char
*
s
);
//char* strcasestr(const char *haystack, const char *needle);
//char* strnstr(const char *haystack, const char *needle, size_t len);
...
...
contracts/include/wchar.h
浏览文件 @
2e06b9ec
...
...
@@ -4,6 +4,10 @@
*/
#pragma once
#include <stdint.h>
typedef
unsigned
int
size_t
;
// if we support wstring make sure that this is correct
typedef
wchar_t
wint_t
;
#define WEOF wchar_t(-1)
...
...
contracts/proxy/CMakeLists.txt
浏览文件 @
2e06b9ec
file
(
GLOB ABI_FILES
"*.abi"
)
configure_file
(
"
${
ABI_FILES
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
COPYONLY
)
add_wast_target
(
proxy
"
${
STANDARD_INCLUDE_FOLDERS
}
"
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_wast_executable
(
TARGET proxy
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES eoslib
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
contracts/simpledb/CMakeLists.txt
浏览文件 @
2e06b9ec
file
(
GLOB ABI_FILES
"*.abi"
)
add_wast_target
(
simpledb
"
${
STANDARD_INCLUDE_FOLDERS
}
"
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_wast_executable
(
TARGET simpledb
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES eoslib
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
configure_file
(
"
${
ABI_FILES
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
COPYONLY
)
contracts/social/CMakeLists.txt
浏览文件 @
2e06b9ec
add_wast_target
(
social
"
${
CMAKE_SOURCE_DIR
}
/contracts"
${
CMAKE_CURRENT_BINARY_DIR
}
)
\ No newline at end of file
add_wast_executable
(
TARGET social
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES eoslib
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
contracts/stltest/CMakeLists.txt
浏览文件 @
2e06b9ec
...
...
@@ -2,8 +2,8 @@
set
(
ABI_FILES
"stltest.abi"
)
add_wast_executable
(
TARGET stltest
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES
${
CMAKE_SOURCE_DIR
}
/contracts/eoslib/eoslib.bc
#
/Users/antonperkov/final/src/new.bc /Users/antonperkov/final/src/vector.bc
LIBRARIES
eoslib
EXTERNAL_LIBRARIES
/Users/antonperkov/final/src/new.bc /Users/antonperkov/final/src/vector.bc
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
...
...
contracts/stltest/stltest.cpp
浏览文件 @
2e06b9ec
...
...
@@ -16,6 +16,8 @@
#include <unordered_set>
#include <string>
#include <stdexcept>
#include <eoslib/eos.hpp>
#include <eoslib/token.hpp>
...
...
@@ -52,30 +54,48 @@ namespace stltest {
};
static
void
on
(
const
message
&
msg
)
{
print
(
"STL test start."
);
print
(
"STL test start.
\n
"
);
std
::
array
<
uint32_t
,
10
>
arr
;
arr
.
fill
(
3
);
arr
[
0
]
=
0
;
std
::
vector
<
uint32_t
>
v
;
v
.
push_back
(
0
);
std
::
stack
<
char
>
stack
;
stack
.
push
(
'J'
);
stack
.
pop
();
std
::
queue
<
unsigned
int
>
q
;
q
.
push
(
0
);
std
::
deque
<
float
>
dq
;
dq
.
push_front
(
0.0
f
);
std
::
list
<
uint32_t
>
l
;
l
.
push_back
(
0
);
std
::
string
s
;
s
.
append
(
1
,
'a'
);
//std::string s;
//s.append(1, 'a');
std
::
map
<
int
,
double
>
m
;
m
.
emplace
(
0
,
1.0
);
auto
mit
=
m
.
lower_bound
(
2
);
std
::
set
<
long
>
st
;
st
.
insert
(
0
);
std
::
unordered_map
<
int
,
string
>
hm
;
st
.
erase
(
st
.
begin
());
st
.
count
(
0
);
//std::unordered_map<int, string> hm;
//hm[0] = "abc";
std
::
unordered_set
<
int
>
hs
;
//
std::unordered_set<int> hs;
//hs.insert(0);
print
(
"STL test done."
);
sort
(
dq
.
begin
(),
dq
.
end
());
auto
lit
=
find_if
(
l
.
begin
(),
l
.
end
(),
[](
float
f
)
{
return
f
<
0
;
});
print
(
"STL test done.
\n
"
);
}
static
void
apply
(
account_name
c
,
action_name
act
)
{
...
...
contracts/storage/CMakeLists.txt
浏览文件 @
2e06b9ec
file
(
GLOB ABI_FILES
"*.abi"
)
add_wast_target
(
storage
"
${
CMAKE_SOURCE_DIR
}
/contracts"
${
CMAKE_CURRENT_BINARY_DIR
}
)
configure_file
(
"
${
ABI_FILES
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
COPYONLY
)
add_wast_executable
(
TARGET storage
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES eoslib
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
contracts/test_api/CMakeLists.txt
浏览文件 @
2e06b9ec
add_wast_target
(
test_api
"
${
STANDARD_INCLUDE_FOLDERS
}
"
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_wast_executable
(
TARGET test_api
INCLUDE_FOLDERS
"
${
STANDARD_INCLUDE_FOLDERS
}
"
LIBRARIES eoslib
DESTINATION_FOLDER
${
CMAKE_CURRENT_BINARY_DIR
}
)
tests/wasm_tests/wasm_tests.cpp
浏览文件 @
2e06b9ec
...
...
@@ -666,7 +666,6 @@ BOOST_FIXTURE_TEST_CASE( stl_test, tester ) try {
produce_blocks
(
2000
);
create_accounts
(
{
N
(
stltest
),
N
(
alice
),
N
(
bob
)},
asset
::
from_string
(
"1000.0000 MYCUR"
)
);
transfer
(
N
(
inita
),
N
(),
"10.0000 MYCUR"
,
"memo"
);
produce_block
();
set_code
(
N
(
stltest
),
stltest_wast
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录