Skip to content

Commit

Permalink
Avoid unnecessary communication in Dealer protocol.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkskeller committed Apr 3, 2023
1 parent e3ed7f6 commit 527b6b0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Processor/Input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ int InputBase<T>::get_player(SubProcessor<T>& 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;
Expand Down
18 changes: 9 additions & 9 deletions Processor/Instruction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,14 +908,14 @@ inline void Instruction::execute(Processor<sint, sgf2n>& 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]));
Expand Down Expand Up @@ -992,7 +992,7 @@ inline void Instruction::execute(Processor<sint, sgf2n>& 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:
Expand Down Expand Up @@ -1082,7 +1082,7 @@ inline void Instruction::execute(Processor<sint, sgf2n>& 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);
Expand Down Expand Up @@ -1122,14 +1122,14 @@ inline void Instruction::execute(Processor<sint, sgf2n>& 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:
Expand Down Expand Up @@ -1189,7 +1189,7 @@ inline void Instruction::execute(Processor<sint, sgf2n>& 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:
Expand All @@ -1212,7 +1212,7 @@ inline void Instruction::execute(Processor<sint, sgf2n>& 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:
{
Expand Down
6 changes: 0 additions & 6 deletions Processor/Processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@ class ArithmeticProcessor : public ProcessorBase
CheckVector<long>& get_Ci()
{ return Ci; }

virtual long sync_Ci(size_t) const
{
throw not_implemented();
}

virtual ofstream& get_public_output()
{
throw not_implemented();
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 0 additions & 6 deletions Processor/Processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,12 +883,6 @@ void Processor<sint, sgf2n>::fixinput(const Instruction& instruction)
}
}

template<class sint, class sgf2n>
long Processor<sint, sgf2n>::sync_Ci(size_t i) const
{
return sync(read_Ci(i));
}

template<class sint, class sgf2n>
long Processor<sint, sgf2n>::sync(long x) const
{
Expand Down

0 comments on commit 527b6b0

Please sign in to comment.