-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Conversation
…mplemented remainder of simd ops
Codecov Report
@@ Coverage Diff @@
## develop #4201 +/- ##
===========================================
+ Coverage 67.35% 67.54% +0.19%
===========================================
Files 302 302
Lines 23257 23363 +106
===========================================
+ Hits 15664 15781 +117
+ Misses 7593 7582 -11
|
@winsvega clang won't compile the std::array initializer in fuzzHelper, but gcc and vcc will.
C++11 requires extra braces, C++14 doesn't. So I added the silly braces. They didn't break gcc, will see soon if the heal clang. |
snark: Add ECADD and ECMUL benchmark tests
Fix STATICCALL
@@ -14,8 +14,6 @@ | |||
You should have received a copy of the GNU General Public License | |||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
/** @file VM.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we agreed on keeping these @file directives in the files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think (could be wrong) Pawel asked me to remove them. I took a lot out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libevm/VM.cpp
Outdated
@@ -115,6 +113,22 @@ void VM::adjustStack(unsigned _removed, unsigned _added) | |||
#endif | |||
} | |||
|
|||
void VM::sstoreGas() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe name it updateGasForSstore
libevm/VM.cpp
Outdated
@@ -115,6 +113,22 @@ void VM::adjustStack(unsigned _removed, unsigned _added) | |||
#endif | |||
} | |||
|
|||
void VM::sstoreGas() | |||
{ | |||
if (m_ext->staticCall) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better leave this check out of the function updating the gas, it't not related to gas in any way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the existing code in SSTORE exactly. Could move this one piece to SSTORE and to XSTORE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I should, it's included as a preamble to lots of functions that way. Somebody slipped them in while I wasn't looking ;)
libevm/VM.cpp
Outdated
ON_OP(); | ||
updateIOGas(); | ||
|
||
xmul(m_code[++m_PC]); ++m_PC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better put each statement on the separate line for readability and easier debugging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created one function for advancing the PC and fetching the simd type.
libevm/VM.cpp
Outdated
ON_OP(); | ||
updateIOGas(); | ||
|
||
xoor(m_code[++m_PC]); ++m_PC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's VM::xoor
and VM::xxor
, shoudn't the latter be called here?
Also where's the case for XOOR
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think xoor is a typo and only one of them is needed, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong. Seems xor
is now a keyword, so I called the function xoor
, and it needs a case to call it too.
libevm/VMSIMD.cpp
Outdated
|
||
void VM::vtow(uint8_t _b, const u256& _in, u256& _out) | ||
{ | ||
const uint8_t n = pow2N((_b) & 0xf), t = (_b) >> 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One declaration per line, according to coding standards
libevm/VMSIMD.cpp
Outdated
void VM::wtov(uint8_t _b, const u256& _in, u256& _out) | ||
|
||
{ | ||
const uint8_t n = pow2N((_b) & 0xf), t = (_b) >> 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This calculation is duplicated all over the place, create a couple of helper functions to get number of elements and type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
libevm/VMSIMD.cpp
Outdated
typedef uint32_t a32x8 [8]; | ||
typedef uint16_t a16x16[16]; | ||
typedef uint8_t a8x32 [32]; | ||
a64x4& v64x4 ( u256& _stack_item) { return (a64x4&) *(a64x4*) &_stack_item; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare these functions inline
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. (Though compilers are pretty good now.)
libevm/VMSIMD.cpp
Outdated
case 1: | ||
for (int j = n, v = 0, i = 0; 0 < n; ++i) | ||
{ | ||
v |= p[--j]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p[--j]
is uint8_t
, so you bit-or it with lowest 8 bits of v
and then on the next line you shift right 8 bits, loosing what you've just read from p
? What am I getting wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like I pasted the mstore() code as a starting template and then failed to reverse the shifts. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
libevm/VMSIMD.cpp
Outdated
switch (t) | ||
{ | ||
case 0: | ||
for (int i = 0; i < n; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Braces on separate lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another bad habit. Messed up less often than usual in this code...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that one function looks to be the only place. A record!
I haven't finished looking through all of the VMSIMD.cpp yet, will try to continue tomorrow. So far I mostly have style-related comments and some clarifying questions. |
Thanks @gumb0 Andrei |
This should improve performance.
This branch is gitted to death. Work has moved to /pull/4233. |
Trashed and closed. Work continues here - #4233 |
This is a portable implementation of the ethereum/EIPs#616 SIMD proposal.