mirror of
https://github.com/wownero/RandomX.git
synced 2026-10-17 23:41:39 +02:00
Interpreter debugging
This commit is contained in:
@@ -74,8 +74,9 @@ namespace RandomX {
|
||||
}
|
||||
|
||||
static void print(__m128d f) {
|
||||
uint64_t lo = *(((uint64_t*)&f) + 0);
|
||||
uint64_t hi = *(((uint64_t*)&f) + 1);
|
||||
uint64_t hi, lo;
|
||||
memcpy(&lo, &f, 8);
|
||||
memcpy(&hi, (uint8_t*)&f + 8, 8);
|
||||
std::cout << std::hex << std::setw(16) << std::setfill('0') << hi << '-' << std::hex << std::setw(16) << std::setfill('0') << lo << std::endl;
|
||||
}
|
||||
|
||||
@@ -417,6 +418,9 @@ namespace RandomX {
|
||||
_mm_store_pd(®.e[1].lo, e[1]);
|
||||
_mm_store_pd(®.e[2].lo, e[2]);
|
||||
_mm_store_pd(®.e[3].lo, e[3]);
|
||||
|
||||
printState(r, f, e, a);
|
||||
std::cout << "=================================================" << std::endl;
|
||||
}
|
||||
|
||||
static int getConditionRegister(int(®isterUsage)[8]) {
|
||||
|
||||
+13
-2
@@ -16,7 +16,7 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RandomX. If not, see<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
//#define TRACE
|
||||
#define TRACE
|
||||
#include "InterpretedVirtualMachine.hpp"
|
||||
#include "CompiledVirtualMachine.hpp"
|
||||
#include "CompiledLightVirtualMachine.hpp"
|
||||
@@ -179,11 +179,21 @@ void mine(RandomX::VirtualMachine* vm, std::atomic<uint32_t>& atomicNonce, Atomi
|
||||
for (int chain = 0; chain < RANDOMX_PROGRAM_COUNT - 1; ++chain) {
|
||||
fillAes1Rx4<softAes>((void*)hash, sizeof(RandomX::Program), vm->getProgramBuffer());
|
||||
vm->initialize();
|
||||
if (RandomX::trace) {
|
||||
std::cout << "Program " << chain << std::endl;
|
||||
std::cout << *vm->getProgramBuffer();
|
||||
std::cout << "=================================================" << std::endl;
|
||||
}
|
||||
vm->execute();
|
||||
vm->getResult<false>(nullptr, 0, hash);
|
||||
}
|
||||
fillAes1Rx4<softAes>((void*)hash, sizeof(RandomX::Program), vm->getProgramBuffer());
|
||||
vm->initialize();
|
||||
if (RandomX::trace) {
|
||||
std::cout << "Program 7" << std::endl;
|
||||
std::cout << *vm->getProgramBuffer();
|
||||
std::cout << "=================================================" << std::endl;
|
||||
}
|
||||
vm->execute();
|
||||
/*if (RandomX::trace) {
|
||||
for (int j = 0; j < RandomX::ProgramLength; ++j) {
|
||||
@@ -191,6 +201,7 @@ void mine(RandomX::VirtualMachine* vm, std::atomic<uint32_t>& atomicNonce, Atomi
|
||||
std::cout << std::hex << std::setw(16) << std::setfill('0') << res << std::endl;
|
||||
}
|
||||
}*/
|
||||
dump((char*)scratchpad, RANDOMX_SCRATCHPAD_L3, "scratchpad");
|
||||
vm->getResult<softAes>(scratchpad, RANDOMX_SCRATCHPAD_L3, hash);
|
||||
result.xorWith(hash);
|
||||
if (RandomX::trace) {
|
||||
@@ -211,7 +222,7 @@ int main(int argc, char** argv) {
|
||||
readOption("--mine", argc, argv, miningMode);
|
||||
readOption("--verify", argc, argv, verificationMode);
|
||||
readIntOption("--threads", argc, argv, threadCount, 1);
|
||||
readIntOption("--nonces", argc, argv, programCount, 1000);
|
||||
readIntOption("--nonces", argc, argv, programCount, 1);
|
||||
readIntOption("--init", argc, argv, initThreadCount, 1);
|
||||
readIntOption("--epoch", argc, argv, epoch, 0);
|
||||
readOption("--largePages", argc, argv, largePages);
|
||||
|
||||
Reference in New Issue
Block a user