From 527b6b083b8d232199b35df08c983d224856f9c8 Mon Sep 17 00:00:00 2001 From: Marcel Keller Date: Mon, 3 Apr 2023 13:45:53 +1000 Subject: [PATCH] Avoid unnecessary communication in Dealer protocol. --- Processor/Input.hpp | 2 +- Processor/Instruction.hpp | 18 +++++++++--------- Processor/Processor.h | 6 ------ Processor/Processor.hpp | 6 ------ 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Processor/Input.hpp b/Processor/Input.hpp index 2eb8a63a..09c6e056 100644 --- a/Processor/Input.hpp +++ b/Processor/Input.hpp @@ -293,7 +293,7 @@ int InputBase::get_player(SubProcessor& Proc, int arg, bool player_from_re if (player_from_reg) { assert(Proc.Proc); - auto res = Proc.Proc->sync_Ci(arg); + auto res = Proc.Proc->read_Ci(arg); if (res >= Proc.P.num_players()) throw runtime_error("player id too large: " + to_string(res)); return res; diff --git a/Processor/Instruction.hpp b/Processor/Instruction.hpp index 969ae06b..dd62afc4 100644 --- a/Processor/Instruction.hpp +++ b/Processor/Instruction.hpp @@ -908,14 +908,14 @@ inline void Instruction::execute(Processor& Proc) const n++; break; case LDMCI: - Proc.write_Cp(r[0], Proc.machine.Mp.read_C(Proc.sync_Ci(r[1]))); + Proc.write_Cp(r[0], Proc.machine.Mp.read_C(Proc.read_Ci(r[1]))); break; case STMC: Proc.machine.Mp.write_C(n,Proc.read_Cp(r[0])); n++; break; case STMCI: - Proc.machine.Mp.write_C(Proc.sync_Ci(r[1]), Proc.read_Cp(r[0])); + Proc.machine.Mp.write_C(Proc.read_Ci(r[1]), Proc.read_Cp(r[0])); break; case MOVC: Proc.write_Cp(r[0],Proc.read_Cp(r[1])); @@ -992,7 +992,7 @@ inline void Instruction::execute(Processor& Proc) const Procp.protocol.randoms_inst(Procp.get_S(), *this); return; case INPUTMASKREG: - Procp.DataF.get_input(Proc.get_Sp_ref(r[0]), Proc.temp.rrp, Proc.sync_Ci(r[2])); + Procp.DataF.get_input(Proc.get_Sp_ref(r[0]), Proc.temp.rrp, Proc.read_Ci(r[2])); Proc.write_Cp(r[1], Proc.temp.rrp); break; case INPUTMASK: @@ -1082,7 +1082,7 @@ inline void Instruction::execute(Processor& Proc) const return; case MATMULSM: Proc.Procp.protocol.matmulsm(Proc.Procp, Proc.machine.Mp.MS, *this, - Proc.sync_Ci(r[1]), Proc.sync_Ci(r[2])); + Proc.read_Ci(r[1]), Proc.read_Ci(r[2])); return; case CONV2DS: Proc.Procp.protocol.conv2ds(Proc.Procp, *this); @@ -1122,14 +1122,14 @@ inline void Instruction::execute(Processor& Proc) const Proc.PC += (signed int) n; break; case JMPI: - Proc.PC += (signed int) Proc.sync_Ci(r[0]); + Proc.PC += (signed int) Proc.read_Ci(r[0]); break; case JMPNZ: - if (Proc.sync_Ci(r[0]) != 0) + if (Proc.read_Ci(r[0]) != 0) { Proc.PC += (signed int) n; } break; case JMPEQZ: - if (Proc.sync_Ci(r[0]) == 0) + if (Proc.read_Ci(r[0]) == 0) { Proc.PC += (signed int) n; } break; case PRINTREG: @@ -1189,7 +1189,7 @@ inline void Instruction::execute(Processor& Proc) const Proc.machine.join_tape(r[0]); break; case CRASH: - if (Proc.sync_Ci(r[0])) + if (Proc.read_Ci(r[0])) throw crash_requested(); break; case STARTGRIND: @@ -1212,7 +1212,7 @@ inline void Instruction::execute(Processor& Proc) const // *** case LISTEN: // listen for connections at port number n - Proc.external_clients.start_listening(Proc.sync_Ci(r[0])); + Proc.external_clients.start_listening(Proc.read_Ci(r[0])); break; case ACCEPTCLIENTCONNECTION: { diff --git a/Processor/Processor.h b/Processor/Processor.h index 414aeb93..f6ffade9 100644 --- a/Processor/Processor.h +++ b/Processor/Processor.h @@ -171,11 +171,6 @@ public: CheckVector& get_Ci() { return Ci; } - virtual long sync_Ci(size_t) const - { - throw not_implemented(); - } - virtual ofstream& get_public_output() { throw not_implemented(); @@ -286,7 +281,6 @@ class Processor : public ArithmeticProcessor void fixinput(const Instruction& instruction); // synchronize in asymmetric protocols - long sync_Ci(size_t i) const; long sync(long x) const; ofstream& get_public_output(); diff --git a/Processor/Processor.hpp b/Processor/Processor.hpp index 1d5a0d3b..34cb5b36 100644 --- a/Processor/Processor.hpp +++ b/Processor/Processor.hpp @@ -883,12 +883,6 @@ void Processor::fixinput(const Instruction& instruction) } } -template -long Processor::sync_Ci(size_t i) const -{ - return sync(read_Ci(i)); -} - template long Processor::sync(long x) const {