From: Terrance S. <ts...@us...> - 2006-04-30 18:27:21
|
Update of /cvsroot/xsb/XSB/emu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26848 Modified Files: biassert.c context.h init_xsb.c token_xsb.c Log Message: -- Put parentheses around retract-gc definitions to ensure correctness. The engine had been delaying space reclamation and garbage collecting far too often, and this seems to fix that problem. -- A little more thread-safety for token_xsb.c -- Fixed bug with file_clone/3 that I introduced many moons ago. The problem was that I hadn't been giving names to console type files, and file_clone used the file name in a string_find. Now console files have file names and things seem to work fine. Index: biassert.c =================================================================== RCS file: /cvsroot/xsb/XSB/emu/biassert.c,v retrieving revision 1.116 retrieving revision 1.117 diff -u -r1.116 -r1.117 --- biassert.c 29 Apr 2006 14:32:40 -0000 1.116 +++ biassert.c 30 Apr 2006 18:27:12 -0000 1.117 @@ -2113,13 +2113,13 @@ #endif #define mark_clref(pClRef) \ - ClRef_Buflen(pClRef -1) = ClRef_Buflen(pClRef - 1) | HIGHBIT + (ClRef_Buflen(pClRef -1) = ClRef_Buflen(pClRef - 1) | HIGHBIT) #define unmark_clref(pClRef) \ - ClRef_Buflen(pClRef -1) = ClRef_Buflen(pClRef - 1 ) & (~HIGHBIT) + (ClRef_Buflen(pClRef -1) = ClRef_Buflen(pClRef - 1 ) & (~HIGHBIT)) #define clref_is_marked(pClRef) \ - ClRef_Buflen(pClRef -1 ) & HIGHBIT + (ClRef_Buflen(pClRef -1 ) & HIGHBIT) ClRef clref_from_try_addr(ClRef code_addr) { while (cell_opcode((CPtr)code_addr - 2) == noop) { @@ -3548,10 +3548,10 @@ mark_for_deletion(CTXTc Clause); - if ((flags[NUM_THREADS] == 1 || !get_shared(psc)) - && !dyntabled_incomplete(CTXTc psc)) { + if ((flags[NUM_THREADS] == 1 || !get_shared(psc)) + && !dyntabled_incomplete(CTXTc psc)) { - if (!clref_is_marked(Clause) && + if(!(clref_is_marked(Clause)) && determine_if_safe_to_delete(Clause)) { really_delete_clause(Clause); really_deleted = 1; Index: context.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/context.h,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- context.h 27 Apr 2006 21:08:47 -0000 1.44 +++ context.h 30 Apr 2006 18:27:13 -0000 1.45 @@ -297,6 +297,7 @@ int _strbuff_len; // = InitStrLen; /* first allocation size, doubled on subsequent overflows */ double _double_v; long _rad_int; +int _token_too_long_warning; struct sort_par_spec _par_spec; /* spec for par_sort */ @@ -502,6 +503,7 @@ #define strbuff_len (th->_strbuff_len) #define double_v (th->_double_v) #define rad_int (th->_rad_int) +#define token_too_long_warning (th->_token_too_long_warning) #define par_spec (th->_par_spec) Index: init_xsb.c =================================================================== RCS file: /cvsroot/xsb/XSB/emu/init_xsb.c,v retrieving revision 1.93 retrieving revision 1.94 diff -u -r1.93 -r1.94 --- init_xsb.c 27 Apr 2006 21:08:47 -0000 1.93 +++ init_xsb.c 30 Apr 2006 18:27:13 -0000 1.94 @@ -142,9 +142,9 @@ /* Used to create detached thread -- process global. */ pthread_attr_t detached_attr_gl; -extern void reset_stat_total(void); #endif +extern void reset_stat_total(void); extern void perproc_reset_stat(void); extern double realtime_count_gl; @@ -225,6 +225,14 @@ /* In MT engine, now providing a separate mutex (default type) for each io stream. */ +char standard_input_glc[] = "stdin"; +char standard_output_glc[] = "stdout"; +char standard_error_glc[] = "stderr"; +char standard_warning_glc[] = "stdwarn"; +char standard_message_glc[] = "stdmsg"; +char standard_debug_glc[] = "stddbg"; +char standard_feedback_glc[] = "stdfdbk"; + static void init_open_files(void) { int i, msg_fd, dbg_fd, warn_fd, fdbk_fd; @@ -237,14 +245,17 @@ open_files[0].file_ptr = stdin; open_files[0].io_mode = 'r'; open_files[0].stream_type = CONSOLE_STREAM; + open_files[2].file_name = standard_input_glc; open_files[1].file_ptr = stdout; open_files[1].io_mode = 'w'; open_files[1].stream_type = CONSOLE_STREAM; + open_files[2].file_name = standard_output_glc; open_files[2].file_ptr = stderr; open_files[2].io_mode = 'w'; open_files[2].stream_type = CONSOLE_STREAM; + open_files[2].file_name = standard_error_glc; /* stream for xsb warning msgs */ if ((warn_fd = dup(fileno(stderr))) < 0) @@ -253,6 +264,7 @@ open_files[3].file_ptr = stdwarn; open_files[3].io_mode = 'w'; open_files[3].stream_type = CONSOLE_STREAM; + open_files[2].file_name = standard_warning_glc; /* stream for xsb normal msgs */ if ((msg_fd = dup(fileno(stderr))) < 0) @@ -261,6 +273,7 @@ open_files[4].file_ptr = stdmsg; open_files[4].io_mode = 'w'; open_files[4].stream_type = CONSOLE_STREAM; + open_files[2].file_name = standard_message_glc; /* stream for xsb debugging msgs */ if ((dbg_fd = dup(fileno(stderr))) < 0) @@ -269,6 +282,7 @@ open_files[5].file_ptr = stddbg; open_files[5].io_mode = 'w'; open_files[5].stream_type = CONSOLE_STREAM; + open_files[2].file_name = standard_debug_glc; /* stream for xsb feedback msgs */ if ((fdbk_fd = dup(fileno(stdout))) < 0) @@ -277,6 +291,7 @@ open_files[6].file_ptr = stdfdbk; open_files[6].io_mode = 'w'; open_files[6].stream_type = CONSOLE_STREAM; + open_files[2].file_name = standard_feedback_glc; /* NT doesn't seem to think that dup should preserve the buffering mode of the original file. So we make all new descriptors unbuffered -- dunno if @@ -910,6 +925,8 @@ total_time_gc = 0; total_collected = 0; + token_too_long_warning = 1; + /***************/ /* This is here just for the first thread - others initialize its xsb tid Index: token_xsb.c =================================================================== RCS file: /cvsroot/xsb/XSB/emu/token_xsb.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- token_xsb.c 14 Jan 2006 16:25:32 -0000 1.24 +++ token_xsb.c 30 Apr 2006 18:27:14 -0000 1.25 @@ -497,8 +497,10 @@ if (c < 0) return 1; else return 0; } - + +#ifndef MULTI_THREAD int token_too_long_warning = 1; +#endif void realloc_strbuff(CTXTdeclc char **pstrbuff, char **ps, int *pn) /* Expand token buffer when needed. |