summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0fc9a01)
Still keep 'sp' name when used as local
variable with limited scope.
From Jundery.
No functional change.
/// from the split point's shared MovePicker object. This function is not thread
/// safe so must be lock protected by the caller.
template<>
/// from the split point's shared MovePicker object. This function is not thread
/// safe so must be lock protected by the caller.
template<>
-Move MovePicker::next_move<true>() { return ss->sp->movePicker->next_move<false>(); }
+Move MovePicker::next_move<true>() { return ss->splitPoint->movePicker->next_move<false>(); }
Move movesSearched[64];
StateInfo st;
const TTEntry *tte;
Move movesSearched[64];
StateInfo st;
const TTEntry *tte;
+ SplitPoint* splitPoint;
Key posKey;
Move ttMove, move, excludedMove, bestMove, threatMove;
Depth ext, newDepth;
Key posKey;
Move ttMove, move, excludedMove, bestMove, threatMove;
Depth ext, newDepth;
- sp = ss->sp;
- bestMove = sp->bestMove;
- threatMove = sp->threatMove;
- bestValue = sp->bestValue;
+ splitPoint = ss->splitPoint;
+ bestMove = splitPoint->bestMove;
+ threatMove = splitPoint->threatMove;
+ bestValue = splitPoint->bestValue;
tte = NULL;
ttMove = excludedMove = MOVE_NONE;
ttValue = VALUE_NONE;
tte = NULL;
ttMove = excludedMove = MOVE_NONE;
ttValue = VALUE_NONE;
- assert(sp->bestValue > -VALUE_INFINITE && sp->moveCount > 0);
+ assert(splitPoint->bestValue > -VALUE_INFINITE && splitPoint->moveCount > 0);
goto split_point_start;
}
goto split_point_start;
}
if (!pos.pl_move_is_legal(move, ci.pinned))
continue;
if (!pos.pl_move_is_legal(move, ci.pinned))
continue;
- moveCount = ++sp->moveCount;
- sp->mutex.unlock();
+ moveCount = ++splitPoint->moveCount;
+ splitPoint->mutex.unlock();
&& (!threatMove || !refutes(pos, move, threatMove)))
{
if (SpNode)
&& (!threatMove || !refutes(pos, move, threatMove)))
{
if (SpNode)
+ splitPoint->mutex.lock();
if (!PvNode && futilityValue < beta)
{
if (SpNode)
if (!PvNode && futilityValue < beta)
{
if (SpNode)
+ splitPoint->mutex.lock();
&& pos.see_sign(move) < 0)
{
if (SpNode)
&& pos.see_sign(move) < 0)
{
if (SpNode)
+ splitPoint->mutex.lock();
ss->reduction = reduction<PvNode>(depth, moveCount);
Depth d = std::max(newDepth - ss->reduction, ONE_PLY);
if (SpNode)
ss->reduction = reduction<PvNode>(depth, moveCount);
Depth d = std::max(newDepth - ss->reduction, ONE_PLY);
if (SpNode)
+ alpha = splitPoint->alpha;
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d);
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d);
if (doFullDepthSearch)
{
if (SpNode)
if (doFullDepthSearch)
{
if (SpNode)
+ alpha = splitPoint->alpha;
value = newDepth < ONE_PLY ?
givesCheck ? -qsearch<NonPV, true>(pos, ss+1, -(alpha+1), -alpha, DEPTH_ZERO)
value = newDepth < ONE_PLY ?
givesCheck ? -qsearch<NonPV, true>(pos, ss+1, -(alpha+1), -alpha, DEPTH_ZERO)
// Step 18. Check for new best move
if (SpNode)
{
// Step 18. Check for new best move
if (SpNode)
{
- sp->mutex.lock();
- bestValue = sp->bestValue;
- alpha = sp->alpha;
+ splitPoint->mutex.lock();
+ bestValue = splitPoint->bestValue;
+ alpha = splitPoint->alpha;
}
// Finished searching the move. If Signals.stop is true, the search
}
// Finished searching the move. If Signals.stop is true, the search
- bestValue = SpNode ? sp->bestValue = value : value;
+ bestValue = SpNode ? splitPoint->bestValue = value : value;
- bestMove = SpNode ? sp->bestMove = move : move;
+ bestMove = SpNode ? splitPoint->bestMove = move : move;
if (PvNode && value < beta) // Update alpha! Always alpha < beta
if (PvNode && value < beta) // Update alpha! Always alpha < beta
- alpha = SpNode ? sp->alpha = value : value;
+ alpha = SpNode ? splitPoint->alpha = value : value;
else
{
assert(value >= beta); // Fail high
if (SpNode)
else
{
assert(value >= beta); // Fail high
if (SpNode)
+ splitPoint->cutoff = true;
Position pos(*sp->pos, this);
memcpy(ss, sp->ss - 1, 4 * sizeof(Stack));
Position pos(*sp->pos, this);
memcpy(ss, sp->ss - 1, 4 * sizeof(Stack));
+ (ss+1)->splitPoint = sp;
/// has its own array of Stack objects, indexed by the current ply.
struct Stack {
/// has its own array of Stack objects, indexed by the current ply.
struct Stack {
+ SplitPoint* splitPoint;
int ply;
Move currentMove;
Move excludedMove;
int ply;
Move currentMove;
Move excludedMove;