X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=e75251f472a8b532e91226b78a76ea3f8cc2fd19;hp=5586d64d0315ac1c68acd70103a5bd1bd44b823b;hb=fecefbb99cb0147f37d6895765a315f34c935786;hpb=068561f86a3bac39398eeef87f7569d7067b9776 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 5586d64d..e75251f4 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -232,11 +232,6 @@ namespace { PASSED = 12, UNSTOPPABLE = 13, SPACE = 14, TOTAL = 15 }; - // Pawn and material hash tables, indexed by the current thread id. - // Note that they will be initialized at 0 being global variables. - MaterialInfoTable* MaterialTable[MAX_THREADS]; - PawnInfoTable* PawnTable[MAX_THREADS]; - // Function prototypes template Value do_evaluate(const Position& pos, Value& margin); @@ -269,16 +264,6 @@ namespace { } -/// prefetchTables() is called in do_move() to prefetch pawn and material -/// hash tables data that will be needed shortly after in evaluation. - -void prefetchTables(Key pKey, Key mKey, int threadID) { - - PawnTable[threadID]->prefetch(pKey); - MaterialTable[threadID]->prefetch(mKey); -} - - /// evaluate() is the main evaluation function. It always computes two /// values, an endgame score and a middle game score, and interpolates /// between them based on the remaining material. @@ -318,7 +303,7 @@ Value do_evaluate(const Position& pos, Value& margin) { margins[WHITE] = margins[BLACK] = VALUE_ZERO; // Probe the material hash table - MaterialInfo* mi = MaterialTable[pos.thread()]->get_material_info(pos); + MaterialInfo* mi = ThreadsMgr[pos.thread()].materialTable.get_material_info(pos); bonus += mi->material_value(); // If we have a specialized evaluation function for the current material @@ -330,7 +315,7 @@ Value do_evaluate(const Position& pos, Value& margin) { } // Probe the pawn hash table - ei.pi = PawnTable[pos.thread()]->get_pawn_info(pos); + ei.pi = ThreadsMgr[pos.thread()].pawnTable.get_pawn_info(pos); bonus += apply_weight(ei.pi->pawns_value(), Weights[PawnStructure]); // Initialize attack and king safety bitboards @@ -431,39 +416,6 @@ Value do_evaluate(const Position& pos, Value& margin) { } // namespace -/// init_eval() initializes various tables used by the evaluation function - -void init_eval(int threads) { - - assert(threads <= MAX_THREADS); - - for (int i = 0; i < MAX_THREADS; i++) - { - if (i >= threads) - { - delete PawnTable[i]; - delete MaterialTable[i]; - PawnTable[i] = NULL; - MaterialTable[i] = NULL; - continue; - } - if (!PawnTable[i]) - PawnTable[i] = new PawnInfoTable(); - - if (!MaterialTable[i]) - MaterialTable[i] = new MaterialInfoTable(); - } -} - - -/// quit_eval() releases heap-allocated memory at program termination - -void quit_eval() { - - init_eval(0); -} - - /// read_weights() reads evaluation weights from the corresponding UCI parameters void read_evaluation_uci_options(Color us) {