Skip to content

Commit

Permalink
Merge pull request EOSIO#358 from EOSIO/feature/entry_llvm_attribute
Browse files Browse the repository at this point in the history
added eosio::wasm_entry attribute for user definable entry points
  • Loading branch information
larryk85 authored Jan 20, 2019
2 parents f420bd5 + 200c1b1 commit 541a348
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
1 change: 1 addition & 0 deletions imports/eosio.imports.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ memcpy
memmove
memcmp
memset
abort
29 changes: 29 additions & 0 deletions libraries/eosiolib/compiler_builtins.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extern "C" {
* printi128(&res); // Output: 10000
* @endcode
*/
__attribute__((eosio_wasm_import))
void __multi3(__int128& res, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb);

/**
Expand All @@ -50,6 +51,7 @@ extern "C" {
* printi128(&res); // Output: 1
* @endcode
*/
__attribute__((eosio_wasm_import))
void __divti3(__int128& res, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb);

/**
Expand All @@ -69,6 +71,7 @@ extern "C" {
* printi128(&res); // Output: 1
* @endcode
*/
__attribute__((eosio_wasm_import))
void __udivti3(unsigned __int128& res, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb);

/**
Expand All @@ -89,6 +92,7 @@ extern "C" {
* printi128(&res); // Output: 1
* @endcode
*/
__attribute__((eosio_wasm_import))
void __modti3(__int128& res, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb);

/**
Expand All @@ -109,6 +113,7 @@ extern "C" {
* printi128(&res); // Output: 1
* @endcode
*/
__attribute__((eosio_wasm_import))
void __umodti3(unsigned __int128& res, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb);

/**
Expand All @@ -127,6 +132,7 @@ extern "C" {
* printi128(&res); // Output: 16
* @endcode
*/
__attribute__((eosio_wasm_import))
void __lshlti3(__int128& res, uint64_t lo, uint64_t hi, uint32_t shift);

/**
Expand All @@ -145,6 +151,7 @@ extern "C" {
* printi128(&res); // Output: 4
* @endcode
*/
__attribute__((eosio_wasm_import))
void __lshrti3(__int128& res, uint64_t lo, uint64_t hi, uint32_t shift);

/**
Expand All @@ -163,6 +170,7 @@ extern "C" {
* printi128(&res); // Output: 16
* @endcode
*/
__attribute__((eosio_wasm_import))
void __ashlti3(__int128& res, uint64_t lo, uint64_t hi, uint32_t shift);

/**
Expand All @@ -181,6 +189,7 @@ extern "C" {
* printi128(&res); // Output: -4
* @endcode
*/
__attribute__((eosio_wasm_import))
void __ashrti3(__int128& res, uint64_t lo, uint64_t hi, uint32_t shift);

/**
Expand All @@ -193,6 +202,7 @@ extern "C" {
* @param hb High 64 bits of the second 128 bit factor.
* @post `ret` is replaced with the result of the operation
*/
__attribute__((eosio_wasm_import))
void __addtf3( long double& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -205,6 +215,7 @@ extern "C" {
* @param hb High 64 bits of the second 128 bit factor.
* @post `ret` is replaced with the result of the operation
*/
__attribute__((eosio_wasm_import))
void __subtf3( long double& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -217,6 +228,7 @@ extern "C" {
* @param hb High 64 bits of the second 128 bit factor.
* @post `ret` is replaced with the result of the operation
*/
__attribute__((eosio_wasm_import))
void __multf3( long double& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -229,6 +241,7 @@ extern "C" {
* @param hb High 64 bits of the second 128 bit factor.
* @post `ret` is replaced with the result of the operation
*/
__attribute__((eosio_wasm_import))
void __divtf3( long double& ret, uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -244,6 +257,7 @@ extern "C" {
* @return -1 if a less than b
* @return 1 if either a or b is NaN
*/
__attribute__((eosio_wasm_import))
int __eqtf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -259,6 +273,7 @@ extern "C" {
* @return -1 if a less than b
* @return1 if either a or b is NaN
*/
__attribute__((eosio_wasm_import))
int __netf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );


Expand All @@ -275,6 +290,7 @@ extern "C" {
* @return -1 if a less than b
* @return -1 if either a or b is NaN
*/
__attribute__((eosio_wasm_import))
int __getf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -290,6 +306,7 @@ extern "C" {
* @return -1 if a less than b
* @return 0 if either a or b is NaN
*/
__attribute__((eosio_wasm_import))
int __gttf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -305,6 +322,7 @@ extern "C" {
* @return -1 if a less than b
* @return 1 if either a or b is NaN
*/
__attribute__((eosio_wasm_import))
int __letf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -320,6 +338,7 @@ extern "C" {
* @return -1 if a less than b
* @return 0 if either a or b is NaN
*/
__attribute__((eosio_wasm_import))
int __lttf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -335,6 +354,7 @@ extern "C" {
* @return -1 if a less than b
* @return 1 if either a or b is NaN
*/
__attribute__((eosio_wasm_import))
int __cmptf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -348,6 +368,7 @@ extern "C" {
* @return 1 if either a or b is NaN
* @return 0 if either a or b is not NaN
*/
__attribute__((eosio_wasm_import))
int __unordtf2( uint64_t la, uint64_t ha, uint64_t lb, uint64_t hb );

/**
Expand All @@ -357,6 +378,7 @@ extern "C" {
* @param f Input float to be extended
* @post `ret` is replaced with the extended float
*/
__attribute__((eosio_wasm_import))
void __extendsftf2( long double& ret, float f );

/**
Expand All @@ -366,6 +388,7 @@ extern "C" {
* @param f Input float to be extended
* @post `ret` is replaced with the extended float
*/
__attribute__((eosio_wasm_import))
void __extenddftf2( long double& ret, double f );

/**
Expand All @@ -375,6 +398,7 @@ extern "C" {
* @param h High 64 bits of the first 128 bit factor.
* @return the converted 64 bit integer.
*/
__attribute__((eosio_wasm_import))
int64_t __fixtfdi( uint64_t l, uint64_t h );

/**
Expand All @@ -384,6 +408,7 @@ extern "C" {
* @param h High 64 bits of the first 128 bit factor.
* @return the converted 32 bit integer.
*/
__attribute__((eosio_wasm_import))
int32_t __fixtfsi( uint64_t l, uint64_t h );

/**
Expand All @@ -393,6 +418,7 @@ extern "C" {
* @param h High 64 bits of the first 128 bit factor.
* @return the converted 64 bit unsigned integer.
*/
__attribute__((eosio_wasm_import))
uint64_t __fixunstfdi( uint64_t l, uint64_t h );

/**
Expand All @@ -402,6 +428,7 @@ extern "C" {
* @param h High 64 bits of the first 128 bit factor.
* @return the converted 32 bit unsigned integer.
*/
__attribute__((eosio_wasm_import))
uint32_t __fixunstfsi( uint64_t l, uint64_t h );

/**
Expand All @@ -412,6 +439,7 @@ extern "C" {
* @param h High 64 bits of the first 128 bit factor.
* @return the converted double
*/
__attribute__((eosio_wasm_import))
double __trunctfdf2( uint64_t l, uint64_t h );

/**
Expand All @@ -421,6 +449,7 @@ extern "C" {
* @param h High 64 bits of the first 128 bit factor.
* @return the converted float
*/
__attribute__((eosio_wasm_import))
float __trunctfsf2( uint64_t l, uint64_t h );

void __break_point();
Expand Down
1 change: 0 additions & 1 deletion libraries/eosiolib/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* @file
* @copyright defined in eos/LICENSE
*/

#include "crypto.hpp"
#include "datastream.hpp"

Expand Down
1 change: 1 addition & 0 deletions libraries/eosiolib/dispatcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ namespace eosio {
*/
#define EOSIO_DISPATCH( TYPE, MEMBERS ) \
extern "C" { \
[[eosio::wasm_entry]] \
void apply( uint64_t receiver, uint64_t code, uint64_t action ) { \
if( code == receiver ) { \
switch( action ) { \
Expand Down
2 changes: 2 additions & 0 deletions libraries/eosiolib/simple_malloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace eosio {
heap = align(*(char**)heap_base, 8);
last_ptr = heap;
next_page = __builtin_wasm_current_memory();
pp = 1004;
}

char* operator()(size_t sz, uint8_t align_amt=8) {
Expand All @@ -49,6 +50,7 @@ namespace eosio {
char* last_ptr;
size_t offset;
size_t next_page;
size_t pp;
};
dsmalloc _dsmalloc;
} // ns eosio
Expand Down
8 changes: 2 additions & 6 deletions libraries/eosiolib/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,8 @@ extern "C" {
* eosio_exit(3);
* @endcode
*/
#ifdef __cplusplus
[[noreturn]]
#endif
__attribute__((eosio_wasm_import))
void eosio_exit( int32_t code );

__attribute__((eosio_wasm_import, noreturn))
void eosio_exit( int32_t code );

/**
* Returns the time in microseconds from 1970 of the current block
Expand Down
2 changes: 1 addition & 1 deletion tools/external/wabt/src/tools/postpass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void StripZeroedData( Module& mod, size_t& fix_bytes ) {
}

void AddHeapPointerData( Module& mod, size_t fixup, const std::vector<uint8_t>& buff, DataSegment& ds ) {
uint32_t heap_ptr = ((GetHeapPtr(mod, buff) - fixup) + 7) & ~7; // align to 8 bytes
uint32_t heap_ptr = ((GetHeapPtr(mod, buff)) + 7) & ~7; // align to 8 bytes
Const c;
c.I32(0);
std::unique_ptr<Expr> ce(new ConstExpr(c));
Expand Down

0 comments on commit 541a348

Please sign in to comment.