mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-27 12:36:15 +08:00
StateInfo is usually allocated on the stack by search()
And passed in do_move(), this ensures maximum efficiency and speed and at the same time unlimited move numbers. The draw back is that to handle Position init we need to reserve a StateInfo inside Position itself and use at init time and when copying from another Position. After lazy SMP we don't need anymore this gimmick and we can get rid of this special case and always pass an external StateInfo to Position object. Also rewritten and simplified Position constructors. Verified it does not regress with a 3 threads SMP test: ELO: -0.00 +-12.7 (95%) LOS: 50.0% Total: 1000 W: 173 L: 173 D: 654 No functional change.
This commit is contained in:
11
src/search.h
11
src/search.h
@@ -22,8 +22,6 @@
|
||||
#define SEARCH_H_INCLUDED
|
||||
|
||||
#include <atomic>
|
||||
#include <memory> // For std::unique_ptr
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
|
||||
#include "misc.h"
|
||||
@@ -65,7 +63,7 @@ struct RootMove {
|
||||
std::vector<Move> pv;
|
||||
};
|
||||
|
||||
typedef std::vector<RootMove> RootMoveVector;
|
||||
typedef std::vector<RootMove> RootMoves;
|
||||
|
||||
/// LimitsType struct stores information sent by GUI about available time to
|
||||
/// search the current move, maximum depth/time, if we are in analysis mode or
|
||||
@@ -74,8 +72,8 @@ typedef std::vector<RootMove> RootMoveVector;
|
||||
struct LimitsType {
|
||||
|
||||
LimitsType() { // Init explicitly due to broken value-initialization of non POD in MSVC
|
||||
nodes = time[WHITE] = time[BLACK] = inc[WHITE] = inc[BLACK] = npmsec = movestogo =
|
||||
depth = movetime = mate = infinite = ponder = 0;
|
||||
nodes = time[WHITE] = time[BLACK] = inc[WHITE] = inc[BLACK] =
|
||||
npmsec = movestogo = depth = movetime = mate = infinite = ponder = 0;
|
||||
}
|
||||
|
||||
bool use_time_management() const {
|
||||
@@ -95,11 +93,8 @@ struct SignalsType {
|
||||
std::atomic_bool stop, stopOnPonderhit;
|
||||
};
|
||||
|
||||
typedef std::unique_ptr<std::stack<StateInfo>> StateStackPtr;
|
||||
|
||||
extern SignalsType Signals;
|
||||
extern LimitsType Limits;
|
||||
extern StateStackPtr SetupStates;
|
||||
|
||||
void init();
|
||||
void clear();
|
||||
|
||||
Reference in New Issue
Block a user