I also make lots of other small changes, but I do not think that they are important for other people. For instance, all paths, such as these:Dann Corbit wrote:For Windows, to get proper 64 bit allocation:Dann Corbit wrote:I have allocated large hash tables in Windows (larger than 2 GB) so I guess it is something POSIX specific.
EPD Kit revision date: 1996.04.21
unable to open book file [./book.bin].
book is disabled
unable to open book file [./books.bin].
Initializing multiple threads.
System is SMP, not NUMA.
Crafty v23.1 (1 cpus)
White(1): hash 4096M
hash table memory = 4096M bytes.
White(1):
Make this change to utility.c:
And this change to chess.hCode: Select all
/* ******************************************************************************* * * * AlignedMalloc() is used to allocate memory on a precise boundary, * * primarily to optimize cache performance by forcing the start of the * * memory region being allocated to match up so that a structure will lie * * on a single cache line rather than being split across two, assuming the * * structure is 64 bytes or less of course. * * * ******************************************************************************* */ void AlignedMalloc(void **pointer, int alignment, size_t size) { segments[nsegments][0] = malloc(size + alignment - 1); segments[nsegments][1] = (void *) (((size_t) segments[nsegments][0] + alignment - 1) & ~(alignment - 1)); *pointer = segments[nsegments][1]; nsegments++; } /* ******************************************************************************* * * * AlignedRemalloc() is used to change the size of a memory block that has * * previously been allocated using AlignedMalloc(). * * * ******************************************************************************* */ void AlignedRemalloc(void **pointer, int alignment, size_t size) { int i; for (i = 0; i < nsegments; i++) if (segments[i][1] == *pointer) break; if (i == nsegments) { Print(4095, "ERROR AlignedRemalloc() given an invalid pointer\n"); exit(1); } free(segments[i][0]); segments[i][0] = malloc(size + alignment - 1); segments[i][1] = (void *) (((size_t) segments[i][0] + alignment - 1) & ~(alignment - 1)); *pointer = segments[i][1]; }
Code: Select all
void AlignedMalloc(void **, int, size_t); void AlignedRemalloc(void **, int, size_t);
extern char book_path[128];
extern char log_path[128];
extern char tb_path[128];
extern char rc_path[128];
Get changed to have FILENAME_MAX as their dimension.
and a few other things like that. To do the other changes, I run this macro against all files:
[top][bl]
c\analysis_move[64]\analysis_move[512]\*
[top][bl]
c\annotate_score[100]\annotate_score[512]\*
[top][bl]
c\book_path[128]\book_path[FILENAME_MAX]\*
[top][bl]
c\buffer[100]\buffer[512]\*
[top][bl]
c\buffer[128]\buffer[512]\*
[top][bl]
c\filename[64]\filename[FILENAME_MAX]\*
[top][bl]
c\fname[64]\fname[FILENAME_MAX]\*
[top][bl]
c\history_filename[64]\history_filename[FILENAME_MAX]\*
[top][bl]
c\input[128]\input[512]\*
[top][bl]
c\input_file[100]\input_file[FILENAME_MAX]\*
[top][bl]
c\log_filename[64]\log_filename[FILENAME_MAX]\*
[top][bl]
c\log_path[128]\log_path[FILENAME_MAX]\*
[top][bl]
c\movetext[128]\movetext[512]\*
[top][bl]
c\next[100]\next[512]\*
[top][bl]
c\pname[128]\pname[FILENAME_MAX]\*
[top][bl]
c\prefix[128]\prefix[512]\*
[top][bl]
c\rc_path[128]\rc_path[FILENAME_MAX]\*
[top][bl]
c\tb_path[128]\tb_path[FILENAME_MAX]\*
[top][bl]
c\temp[100]\temp[512]\*
[top][bl]
c\temp[64]\temp[512]\*
[top][bl]
c\text[128]\text[512]\*
[top][bl]
c\title[64]\title[512]\*
[top][bl]
c\value[128]\value[512]\*
[top][bl]
c\data_read[100]\data_read[512]\*
[top][bl]