00001 /* File: heap_defs_xsb.h 00002 ** Author(s): Kostis Sagonas 00003 ** Contact: xsb-contact@cs.sunysb.edu 00004 ** 00005 ** Copyright (C) The Research Foundation of SUNY, 1999. 00006 ** 00007 ** XSB is free software; you can redistribute it and/or modify it under the 00008 ** terms of the GNU Library General Public License as published by the Free 00009 ** Software Foundation; either version 2 of the License, or (at your option) 00010 ** any later version. 00011 ** 00012 ** XSB is distributed in the hope that it will be useful, but WITHOUT ANY 00013 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00014 ** FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for 00015 ** more details. 00016 ** 00017 ** You should have received a copy of the GNU Library General Public License 00018 ** along with XSB; if not, write to the Free Software Foundation, 00019 ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 ** 00021 ** $Id: heap_defs_xsb.h,v 1.4 2005/12/12 18:44:52 dwarren Exp $ 00022 ** 00023 */ 00024 00025 00026 /*--- The following is for the type of garbage collection to be used ---*/ 00027 00028 #define NO_GC 0 00029 #define SLIDING_GC 1 00030 #define COPYING_GC 2 00031 #define INDIRECTION_SLIDE_GC 3 00032 00033 #define GC_GC_HEAP 1 00034 #define GC_GC_STRINGS 2 00035 #define GC_GC_CLAUSES 4 00036 #define GC_GC_TABLED_PREDS 8 00037 00038 /*--- The following are used for string-space collection ---------------*/ 00039 00040 #define mark_string_safe(tstr,msg) \ 00041 do {char *str = (tstr); \ 00042 Integer *pptr = ((Integer *)(str))-1; \ 00043 if (!( *(pptr) & 7)) *(pptr) |= 1; \ 00044 } while(0) 00045 00046 #define mark_string(tstr,msg) \ 00047 do {char *str = (tstr); \ 00048 if (str && string_find_safe(str) == str) { \ 00049 Integer *pptr = ((Integer *)(str))-1; \ 00050 if (!( *(pptr) & 7)) *(pptr) |= 1; \ 00051 } else if (str) \ 00052 printf("Not interned: %s: '%s',%p\n",msg,str,str); \ 00053 } while(0) 00054 00055 #define mark_if_string(tcell,msg) \ 00056 do {Cell acell = (tcell); \ 00057 if (isstring(acell)) \ 00058 mark_string(string_val(acell),msg); \ 00059 } while(0) 00060 /*----------------------------------------------------------------------*/