From: David S. W. <dw...@us...> - 2006-10-18 17:12:39
|
Update of /cvsroot/xsb/XSB/emu In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21464 Modified Files: std_pred_xsb_i.h thread_defs_xsb.h Log Message: Remove unnecessary ATOM_BUFF mutex, and fix memory allocation for atom_to_list. Index: std_pred_xsb_i.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/std_pred_xsb_i.h,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- std_pred_xsb_i.h 20 Aug 2006 18:58:08 -0000 1.35 +++ std_pred_xsb_i.h 18 Oct 2006 17:12:37 -0000 1.36 @@ -295,8 +295,8 @@ int i, len; long c; char *atomname, *atomnamelast; - static char *atomnameaddr = NULL; - static int atomnamelen; + char *atomnameaddr = NULL; + int atomnamelen; char tmpstr[2], *tmpstr_interned; Cell heap_addr, term, term2; Cell list, new_list; @@ -304,8 +304,6 @@ char *call_name = (call_type == ATOM_CODES ? "atom_codes" : "atom_chars"); char *elt_type = (call_type == ATOM_CODES ? "ASCII code" : "character atom"); - SYS_MUTEX_LOCK(MUTEX_ATOM_BUF); - term = ptoc_tag(CTXTc 1); list = ptoc_tag(CTXTc 2); if (!isnonvar(term)) { /* use is: CODES/CHARS --> ATOM */ @@ -329,7 +327,7 @@ xsb_type_error(CTXTc elt_type,list,call_name,2,2); } else err(INSTANTIATION, 2, call_name, 2); - SYS_MUTEX_UNLOCK(MUTEX_ATOM_BUF); + mem_dealloc(atomnameaddr,atomnamelen,LEAK_SPACE); return FALSE; /* fail */ } if (isinteger(heap_addr)) @@ -339,7 +337,7 @@ if (c < 0 || c > 255) { err_handle(CTXTc RANGE, 2, call_name, 2, "ASCII code", heap_addr); - SYS_MUTEX_UNLOCK(MUTEX_ATOM_BUF); + mem_dealloc(atomnameaddr,atomnamelen,LEAK_SPACE); return FALSE; /* fail */ } if (atomname >= atomnamelast) { @@ -354,13 +352,12 @@ } else { if (isref(term2)) err(INSTANTIATION, 2, call_name, 2); else xsb_type_error(CTXTc "list",term2,call_name,2,2); /* atom_chars(X,[1]) */ - SYS_MUTEX_UNLOCK(MUTEX_ATOM_BUF); + mem_dealloc(atomnameaddr,atomnamelen,LEAK_SPACE); return FALSE; /* fail */ } } while (1); bind_string((CPtr)(term), (char *)string_find((char *)atomnameaddr, 1)); mem_dealloc(atomnameaddr,atomnamelen,LEAK_SPACE); - SYS_MUTEX_UNLOCK(MUTEX_ATOM_BUF); return TRUE; } else { /* use is: ATOM --> CODES/CHARS */ if (isstring(term)) { @@ -369,11 +366,9 @@ if (len == 0) { if (!isnonvar(list)) { bind_nil((CPtr)(list)); - SYS_MUTEX_UNLOCK(MUTEX_ATOM_BUF); return TRUE; } - else - { SYS_MUTEX_UNLOCK(MUTEX_ATOM_BUF); + else { return isnil(list); } } else { @@ -396,12 +391,10 @@ follow(top) = makelist(hreg); } follow(top) = makenil; - SYS_MUTEX_UNLOCK(MUTEX_ATOM_BUF); return unify(CTXTc list, new_list); } } else xsb_type_error(CTXTc "atom",term,call_name,2,1); /* atom_codes(1,F) */ } - SYS_MUTEX_UNLOCK(MUTEX_ATOM_BUF); return TRUE; } Index: thread_defs_xsb.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/thread_defs_xsb.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- thread_defs_xsb.h 11 Aug 2006 20:30:33 -0000 1.20 +++ thread_defs_xsb.h 18 Oct 2006 17:12:37 -0000 1.21 @@ -106,7 +106,6 @@ /* Non-recursive */ #define MUTEX_STRING 15 -#define MUTEX_ATOM_BUF 16 #define MUTEX_SM 17 #define MUTEX_STACKS 18 #define MUTEX_SOCKETS 19 |