A pointer is enough because after a split point has been
setup master and slaves thread end up calling sp_search() or
sp_search_pv() and here a full copy of split point position is
done again, note that even master does another copy (of itself)
and this is done before any do_move() call so that master Position
is never updated between split() and sp_search().
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
// Constructors
Position();
// Constructors
Position();
- Position(const Position& pos);
- Position(const std::string& fen);
+ explicit Position(const Position& pos);
+ explicit Position(const std::string& fen);
// Text input/output
void from_fen(const std::string& fen);
// Text input/output
void from_fen(const std::string& fen);
assert(threadID >= 0 && threadID < ActiveThreads);
assert(ActiveThreads > 1);
assert(threadID >= 0 && threadID < ActiveThreads);
assert(ActiveThreads > 1);
- Position pos;
- pos.fast_copy(sp->pos);
+ Position pos(*sp->pos);
CheckInfo ci(pos);
SearchStack* ss = sp->sstack[threadID];
Value value = -VALUE_INFINITE;
CheckInfo ci(pos);
SearchStack* ss = sp->sstack[threadID];
Value value = -VALUE_INFINITE;
assert(threadID >= 0 && threadID < ActiveThreads);
assert(ActiveThreads > 1);
assert(threadID >= 0 && threadID < ActiveThreads);
assert(ActiveThreads > 1);
- Position pos;
- pos.fast_copy(sp->pos);
+ Position pos(*sp->pos);
CheckInfo ci(pos);
SearchStack* ss = sp->sstack[threadID];
Value value = -VALUE_INFINITE;
CheckInfo ci(pos);
SearchStack* ss = sp->sstack[threadID];
Value value = -VALUE_INFINITE;
splitPoint = SplitPointStack[master] + Threads[master].activeSplitPoints;
Threads[master].activeSplitPoints++;
splitPoint = SplitPointStack[master] + Threads[master].activeSplitPoints;
Threads[master].activeSplitPoints++;
- // Initialize the split point object and copy current position
+ // Initialize the split point object
splitPoint->parent = Threads[master].splitPoint;
splitPoint->finished = false;
splitPoint->ply = ply;
splitPoint->parent = Threads[master].splitPoint;
splitPoint->finished = false;
splitPoint->ply = ply;
splitPoint->mp = mp;
splitPoint->moves = *moves;
splitPoint->cpus = 1;
splitPoint->mp = mp;
splitPoint->moves = *moves;
splitPoint->cpus = 1;
- splitPoint->pos.fast_copy(p);
splitPoint->parentSstack = sstck;
for (i = 0; i < ActiveThreads; i++)
splitPoint->slaves[i] = 0;
splitPoint->parentSstack = sstck;
for (i = 0; i < ActiveThreads; i++)
splitPoint->slaves[i] = 0;
- // Detach splitPoint Position from the master one
- splitPoint->pos.detach();
-
// Copy the tail of current search stack to the master thread
memcpy(splitPoint->sstack[master] + ply - 1, sstck + ply - 1, 3 * sizeof(SearchStack));
Threads[master].splitPoint = splitPoint;
// Copy the tail of current search stack to the master thread
memcpy(splitPoint->sstack[master] + ply - 1, sstck + ply - 1, 3 * sizeof(SearchStack));
Threads[master].splitPoint = splitPoint;
struct SplitPoint {
SplitPoint *parent;
struct SplitPoint {
SplitPoint *parent;
SearchStack sstack[THREAD_MAX][PLY_MAX_PLUS_2];
SearchStack *parentSstack;
int ply;
SearchStack sstack[THREAD_MAX][PLY_MAX_PLUS_2];
SearchStack *parentSstack;
int ply;
string token;
int depth, tm, n;
string token;
int depth, tm, n;
- Position pos = RootPosition;
+ Position pos(RootPosition);
if (!(uip >> depth))
return;
if (!(uip >> depth))
return;