This repository has been archived by the owner on Oct 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
SIMD #4201
Closed
Closed
SIMD #4201
Changes from 20 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
d239486
Fix STATICCALL giving stipend
chfast 6702b18
redesignd stack use to minimize impact of simd on remainer of code, i…
gcolvin f372161
fuzzHelper wants 615 opcodes
gcolvin 18bc1c8
Update fuzzHelper.cpp
gcolvin cbe4b17
Fix STATICCALL forwarding call value
chfast 5bca159
update tests
winsvega f17ed62
snark: Add ECADD and ECMUL benchmark tests
chfast 8a68de6
Fix clang build issue
chfast e232db4
Update tests to include two new tests about staticcall not inheriting…
pirapira 631c875
Merge branch 'develop' into fix-staticcall
pirapira e2c2a0a
Merge pull request #4178 from ethereum/snark-benchmarks
pirapira 53be05a
Update tests
pirapira 1809582
Update tests
pirapira 5ad949e
Merge pull request #4200 from ethereum/fix-staticcall
winsvega 7d0fae1
redesignd stack use to minimize impact of simd on remainer of code, i…
gcolvin cdf9b02
fuzzHelper wants 615 opcodes
gcolvin 65cf38b
Andrei's suggestions
gcolvin 30b996c
conflicts
gcolvin a4fcfc9
commit now or comments later
gcolvin b4bacee
more of Andrei's suggestions, more cleanup, get it all compiling again
gcolvin 05a1e2e
redesignd stack use to minimize impact of simd on remainer of code, i…
gcolvin 59250cc
fuzzHelper wants 615 opcodes
gcolvin 77769e8
more of Andrei's suggestions, more cleanup, get it all compiling again
gcolvin 7d2c989
get instruction configuration cleaned up and working on windows, othe…
gcolvin 7136b98
conflicts
gcolvin d7cc1e9
conflicts still
gcolvin 0e0d45d
construct in place rather than assign where destination is trash, oth…
gcolvin bbfeb5d
Check names of GeneralStateTest test fillers against filenames
pirapira 45dbc24
EVMJIT: STATICCALL
chfast b242a2c
Fix Boost build on Gentoo
chfast d2201dd
travis_wait 80
winsvega 4405261
travis_wait on `brew install llvm`, which takes more than 10 minutes
pirapira a860a9d
eth: Drop old interactive mode
chfast 25e009e
logs: Simplify log output handling
chfast e17b1a5
common: Remove SpinLock class
chfast d14407e
eth: Remove obsolete command line options
chfast efb99c0
trace to logChannel in State and DB
winsvega 4011184
general blockchain tests
winsvega 0f3f057
bcExample
winsvega 939832c
more debuginfo
winsvega 4bfa739
bcForgedTest
winsvega 47afcf2
fix style
winsvega 883c8b4
fix GasPricer tests
winsvega bf1d1dd
limit mining threads to 1 for testeth
winsvega 63fe8ba
fix style issues
winsvega 7f78291
correct --fillchain option for new blockchain fillers
winsvega c9b3bfe
fixes and style update
winsvega e803179
change throw 1; to exit(1)
winsvega 9e487a6
still trying to force github to accept push
gcolvin 67ab2a7
yes, still trying to force github to accept push
gcolvin d2c2e80
why am I still messing with this branch?
gcolvin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ set(SOURCES | |
VM.cpp | ||
VMOpt.cpp | ||
VMCalls.cpp | ||
VMSIMD.cpp | ||
VMValidate.cpp | ||
VMFactory.cpp | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
*/ | ||
|
||
#include <libethereum/ExtVM.h> | ||
#include "VMConfig.h" | ||
|
@@ -115,6 +113,19 @@ void VM::adjustStack(unsigned _removed, unsigned _added) | |
#endif | ||
} | ||
|
||
void VM::updateSSGas() | ||
{ | ||
if (!m_ext->store(m_SP[0]) && m_SP[1]) | ||
m_runGas = toInt63(m_schedule->sstoreSetGas); | ||
else if (m_ext->store(m_SP[0]) && !m_SP[1]) | ||
{ | ||
m_runGas = toInt63(m_schedule->sstoreResetGas); | ||
m_ext->sub.refunds += m_schedule->sstoreRefundGas; | ||
} | ||
else | ||
m_runGas = toInt63(m_schedule->sstoreResetGas); | ||
} | ||
|
||
|
||
uint64_t VM::gasForMem(u512 _size) | ||
{ | ||
|
@@ -172,7 +183,6 @@ void VM::fetchInstruction() | |
#define updateIOGas() | ||
#endif | ||
|
||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// interpreter entry point | ||
|
@@ -643,7 +653,318 @@ void VM::interpretCases() | |
number &= mask; | ||
} | ||
} | ||
NEXT | ||
NEXT | ||
|
||
#if EIP_616 | ||
|
||
CASE(XADD) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xadd(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XMUL) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xmul(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSUB) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xsub(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XDIV) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xdiv(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSDIV) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xsdiv(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XMOD) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xmod(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSMOD) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xsmod(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XLT) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xlt(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XGT) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xgt(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSLT) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xslt(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSGT) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xsgt(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XEQ) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xeq(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XISZERO) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xzero(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XAND) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xand(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XOOR) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xoor(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XXOR) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xxor(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XNOT) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xnot(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSHL) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xshl(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSHR) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xshr(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSAR) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xsar(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XROL) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xrol(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XROR) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xror(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XMLOAD) | ||
{ | ||
updateMem(toInt63(m_SP[0]) + 32); | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xmload(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XMSTORE) | ||
{ | ||
updateMem(toInt63(m_SP[0]) + 32); | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xmstore(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSLOAD) | ||
{ | ||
m_runGas = toInt63(m_schedule->sloadGas); | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xsload(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSSTORE) | ||
{ | ||
if (m_ext->staticCall) | ||
throwDisallowedStateChange(); | ||
|
||
updateSSGas(); | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xsstore(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XVTOWIDE) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xvtowide(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XWIDETOV) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xwidetov(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XPUSH) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xpush(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XPUT) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
uint8_t b = ++m_PC; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably because I forgot. Thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh - ON_OP() just because I forgot. The rest because they have complicated gas functions I haven't written yet. |
||
uint8_t c = ++m_PC; | ||
xput(m_code[b], m_code[c]); ++m_PC; | ||
} | ||
CONTINUE | ||
|
||
CASE(XGET) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
uint8_t b = ++m_PC; | ||
uint8_t c = ++m_PC; | ||
xget(m_code[b], m_code[c]); ++m_PC; | ||
} | ||
CONTINUE | ||
|
||
CASE(XSWIZZLE) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xswizzle(simdType()); | ||
} | ||
CONTINUE | ||
|
||
CASE(XSHUFFLE) | ||
{ | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
xshuffle(simdType()); | ||
} | ||
CONTINUE | ||
#endif | ||
|
||
CASE(ADDRESS) | ||
{ | ||
|
@@ -1142,16 +1463,8 @@ void VM::interpretCases() | |
{ | ||
if (m_ext->staticCall) | ||
throwDisallowedStateChange(); | ||
|
||
if (!m_ext->store(m_SP[0]) && m_SP[1]) | ||
m_runGas = toInt63(m_schedule->sstoreSetGas); | ||
else if (m_ext->store(m_SP[0]) && !m_SP[1]) | ||
{ | ||
m_runGas = toInt63(m_schedule->sstoreResetGas); | ||
m_ext->sub.refunds += m_schedule->sstoreRefundGas; | ||
} | ||
else | ||
m_runGas = toInt63(m_schedule->sstoreResetGas); | ||
|
||
updateSSGas(); | ||
ON_OP(); | ||
updateIOGas(); | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@chriseth ?