get rid of IntArrays and FloatArray code.
include holes when calculating memory usage. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1640 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
ba3ea30e8e
commit
eea9f2a58e
4
C/agc.c
4
C/agc.c
@ -252,10 +252,6 @@ mark_global_cell(CELL *pt)
|
|||||||
#else
|
#else
|
||||||
return pt + 3;
|
return pt + 3;
|
||||||
#endif
|
#endif
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
return pt + (4+pt[1]);
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
return pt + (4+((SIZEOF_DOUBLE -SIZEOF_LONG_INT) + pt[1]*SIZEOF_DOUBLE)/SIZEOF_LONG_INT);
|
|
||||||
#if USE_GMP
|
#if USE_GMP
|
||||||
case (CELL)FunctorBigInt:
|
case (CELL)FunctorBigInt:
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* Last rev: *
|
* Last rev: *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: allocating space *
|
* comments: allocating space *
|
||||||
* version:$Id: alloc.c,v 1.85 2006-05-18 16:33:04 vsc Exp $ *
|
* version:$Id: alloc.c,v 1.86 2006-05-19 14:31:31 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#ifdef SCCS
|
#ifdef SCCS
|
||||||
static char SccsId[] = "%W% %G%";
|
static char SccsId[] = "%W% %G%";
|
||||||
@ -61,6 +61,11 @@ static char SccsId[] = "%W% %G%";
|
|||||||
#define malloc Yap_dlmalloc
|
#define malloc Yap_dlmalloc
|
||||||
#define free Yap_dlfree
|
#define free Yap_dlfree
|
||||||
#define realloc Yap_dlrealloc
|
#define realloc Yap_dlrealloc
|
||||||
|
#else
|
||||||
|
void Yap_add_memory_hole(ADDR Start, ADDR End)
|
||||||
|
{
|
||||||
|
Yap_HoleSize += Start-End;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_SYSTEM_MALLOC||USE_DL_MALLOC
|
#if USE_SYSTEM_MALLOC||USE_DL_MALLOC
|
||||||
@ -1322,6 +1327,7 @@ InitHeap(void *heap_addr)
|
|||||||
/* reserve space for specially allocated functors and atoms so that
|
/* reserve space for specially allocated functors and atoms so that
|
||||||
their values can be known statically */
|
their values can be known statically */
|
||||||
HeapTop = Yap_HeapBase + AdjustSize(sizeof(all_heap_codes));
|
HeapTop = Yap_HeapBase + AdjustSize(sizeof(all_heap_codes));
|
||||||
|
Yap_HoleSize = 0;
|
||||||
#if USE_DL_MALLOC
|
#if USE_DL_MALLOC
|
||||||
Yap_initdlmalloc();
|
Yap_initdlmalloc();
|
||||||
#else
|
#else
|
||||||
|
54
C/cmppreds.c
54
C/cmppreds.c
@ -377,57 +377,6 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case int_array_e:
|
|
||||||
{
|
|
||||||
Functor f2;
|
|
||||||
|
|
||||||
if (!IsApplTerm(t2))
|
|
||||||
return 1;
|
|
||||||
f2 = FunctorOfTerm(t2);
|
|
||||||
if (f2 == FunctorDoubleArray) {
|
|
||||||
UInt dim, i;
|
|
||||||
Int *ar1, *ar2;
|
|
||||||
|
|
||||||
if ((dim = Yap_SizeOfIntArray(t1)) != Yap_SizeOfIntArray(t2)) {
|
|
||||||
return dim-Yap_SizeOfIntArray(t2);
|
|
||||||
}
|
|
||||||
ar1 = Yap_IntArrayOfTerm(t1);
|
|
||||||
ar2 = Yap_IntArrayOfTerm(t2);
|
|
||||||
for (i=0;i<dim;i++) {
|
|
||||||
if (ar1[i]-ar2[i])
|
|
||||||
return ar1[i]-ar2[i] > 0;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
} else if (f2 == FunctorIntArray) {
|
|
||||||
return -1;
|
|
||||||
} else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
case double_array_e:
|
|
||||||
{
|
|
||||||
Functor f2;
|
|
||||||
|
|
||||||
if (!IsApplTerm(t2))
|
|
||||||
return 1;
|
|
||||||
f2 = FunctorOfTerm(t2);
|
|
||||||
if (f2 == FunctorDoubleArray) {
|
|
||||||
UInt dim, i;
|
|
||||||
Float *ar1, *ar2;
|
|
||||||
|
|
||||||
if ((dim = Yap_SizeOfFloatArray(t1)) != Yap_SizeOfFloatArray(t2)) {
|
|
||||||
return dim-Yap_SizeOfFloatArray(t2);
|
|
||||||
}
|
|
||||||
ar1 = Yap_FloatArrayOfTerm(t1);
|
|
||||||
ar2 = Yap_FloatArrayOfTerm(t2);
|
|
||||||
for (i=0;i<dim;i++) {
|
|
||||||
if (ar1[i]-ar2[i])
|
|
||||||
return ar1[i]-ar2[i];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case db_ref_e:
|
case db_ref_e:
|
||||||
if (IsRefTerm(t2))
|
if (IsRefTerm(t2))
|
||||||
return Unsigned(RefOfTerm(t2)) -
|
return Unsigned(RefOfTerm(t2)) -
|
||||||
@ -450,9 +399,6 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
|
|||||||
Int r;
|
Int r;
|
||||||
|
|
||||||
if (IsExtensionFunctor(fun2)) {
|
if (IsExtensionFunctor(fun2)) {
|
||||||
if (fun2 == FunctorDoubleArray ||
|
|
||||||
fun2 == FunctorIntArray)
|
|
||||||
return -1;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
r = ArityOfFunctor(fun1) - ArityOfFunctor(fun2);
|
r = ArityOfFunctor(fun1) - ArityOfFunctor(fun2);
|
||||||
|
12
C/compiler.c
12
C/compiler.c
@ -11,8 +11,11 @@
|
|||||||
* File: compiler.c *
|
* File: compiler.c *
|
||||||
* comments: Clause compiler *
|
* comments: Clause compiler *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2006-05-19 13:48:11 $,$Author: vsc $ *
|
* Last rev: $Date: 2006-05-19 14:31:31 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.76 2006/05/19 13:48:11 vsc
|
||||||
|
* help to make Yap work with dynamic libs
|
||||||
|
*
|
||||||
* Revision 1.75 2006/05/16 18:37:30 vsc
|
* Revision 1.75 2006/05/16 18:37:30 vsc
|
||||||
* WIN32 fixes
|
* WIN32 fixes
|
||||||
* compiler bug fixes
|
* compiler bug fixes
|
||||||
@ -546,13 +549,6 @@ c_arg(Int argno, Term t, unsigned int arity, unsigned int level, compiler_struct
|
|||||||
Yap_emit((cglobs->onhead ? (argno == (Int)arity ? unify_last_atom_op
|
Yap_emit((cglobs->onhead ? (argno == (Int)arity ? unify_last_atom_op
|
||||||
: unify_atom_op) :
|
: unify_atom_op) :
|
||||||
write_atom_op), (CELL) t, Zero, &cglobs->cint);
|
write_atom_op), (CELL) t, Zero, &cglobs->cint);
|
||||||
} else if (Yap_IsIntArrayTerm(t) || Yap_IsFloatArrayTerm(t)) {
|
|
||||||
Yap_Error_TYPE = TYPE_ERROR_NUMBER;
|
|
||||||
Yap_Error_Term = t;
|
|
||||||
Yap_ErrorMessage = Yap_ErrorSay;
|
|
||||||
sprintf(Yap_ErrorMessage, "compiling array term");
|
|
||||||
save_machine_regs();
|
|
||||||
longjmp(cglobs->cint.CompilerBotch,1);
|
|
||||||
} else if (IsIntegerTerm(t) || IsFloatTerm(t) || IsBigIntTerm(t)) {
|
} else if (IsIntegerTerm(t) || IsFloatTerm(t) || IsBigIntTerm(t)) {
|
||||||
if (!IsIntTerm(t)) {
|
if (!IsIntTerm(t)) {
|
||||||
/* we are taking a blob, that is a binary that is supposed to be
|
/* we are taking a blob, that is a binary that is supposed to be
|
||||||
|
@ -198,8 +198,6 @@ static int can_unify_complex(register CELL *pt0,
|
|||||||
if (IsExtensionFunctor(f)) {
|
if (IsExtensionFunctor(f)) {
|
||||||
switch((CELL)f) {
|
switch((CELL)f) {
|
||||||
case (CELL)FunctorDBRef:
|
case (CELL)FunctorDBRef:
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
if (d0 == d1) continue;
|
if (d0 == d1) continue;
|
||||||
goto comparison_failed;
|
goto comparison_failed;
|
||||||
case (CELL)FunctorLongInt:
|
case (CELL)FunctorLongInt:
|
||||||
@ -339,8 +337,6 @@ can_unify(Term t1, Term t2, Term *Vars)
|
|||||||
if (IsExtensionFunctor(f)) {
|
if (IsExtensionFunctor(f)) {
|
||||||
switch((CELL)f) {
|
switch((CELL)f) {
|
||||||
case (CELL)FunctorDBRef:
|
case (CELL)FunctorDBRef:
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
if (t1 == t2) return FALSE;
|
if (t1 == t2) return FALSE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
case (CELL)FunctorLongInt:
|
case (CELL)FunctorLongInt:
|
||||||
|
26
C/dbase.c
26
C/dbase.c
@ -796,26 +796,6 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
|||||||
CodeMax = copy_long_int(CodeMax, ap2);
|
CodeMax = copy_long_int(CodeMax, ap2);
|
||||||
++pt0;
|
++pt0;
|
||||||
continue;
|
continue;
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
CheckDBOverflow(4+Yap_SizeOfIntArray(d0));
|
|
||||||
#ifdef IDB_USE_MBIT
|
|
||||||
*StoPoint++ = AbsAppl(CodeMax)|MBIT;
|
|
||||||
#else
|
|
||||||
*StoPoint++ = AbsAppl(CodeMax);
|
|
||||||
#endif
|
|
||||||
CodeMax = copy_int_array(CodeMax, ap2);
|
|
||||||
++pt0;
|
|
||||||
continue;
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
CheckDBOverflow(4+Yap_SizeOfFloatArray(d0));
|
|
||||||
#ifdef IDB_USE_MBIT
|
|
||||||
*StoPoint++ = AbsAppl(CodeMax)|MBIT;
|
|
||||||
#else
|
|
||||||
*StoPoint++ = AbsAppl(CodeMax);
|
|
||||||
#endif
|
|
||||||
CodeMax = copy_double_array(CodeMax, ap2);
|
|
||||||
++pt0;
|
|
||||||
continue;
|
|
||||||
#ifdef USE_GMP
|
#ifdef USE_GMP
|
||||||
case (CELL)FunctorBigInt:
|
case (CELL)FunctorBigInt:
|
||||||
CheckDBOverflow(2+Yap_SizeOfBigInt(d0));
|
CheckDBOverflow(2+Yap_SizeOfBigInt(d0));
|
||||||
@ -1559,12 +1539,6 @@ CreateDBStruct(Term Tm, DBProp p, int InFlag, int *pstat, UInt extra_size, struc
|
|||||||
fun = FunctorOfTerm(Tm);
|
fun = FunctorOfTerm(Tm);
|
||||||
if (IsExtensionFunctor(fun)) {
|
if (IsExtensionFunctor(fun)) {
|
||||||
switch((CELL)fun) {
|
switch((CELL)fun) {
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
ntp = copy_int_array(ntp0, RepAppl(Tm));
|
|
||||||
break;
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
ntp = copy_double_array(ntp0, RepAppl(Tm));
|
|
||||||
break;
|
|
||||||
case (CELL)FunctorDouble:
|
case (CELL)FunctorDouble:
|
||||||
ntp = copy_double(ntp0, RepAppl(Tm));
|
ntp = copy_double(ntp0, RepAppl(Tm));
|
||||||
break;
|
break;
|
||||||
|
@ -185,6 +185,7 @@ Yap_add_memory_hole(ADDR start, ADDR end)
|
|||||||
}
|
}
|
||||||
Yap_MemoryHoles[Yap_NOfMemoryHoles].start = start;
|
Yap_MemoryHoles[Yap_NOfMemoryHoles].start = start;
|
||||||
Yap_MemoryHoles[Yap_NOfMemoryHoles].end = end;
|
Yap_MemoryHoles[Yap_NOfMemoryHoles].end = end;
|
||||||
|
Yap_HoleSize += start-end;
|
||||||
Yap_NOfMemoryHoles++;
|
Yap_NOfMemoryHoles++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
C/grow.c
12
C/grow.c
@ -485,18 +485,6 @@ AdjustGlobal(void)
|
|||||||
pt += 2;
|
pt += 2;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
{
|
|
||||||
Int sz = 3+(SIZEOF_DOUBLE-SIZEOF_LONG_INT)/SIZEOF_LONG_INT+pt[0];
|
|
||||||
pt += sz;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
{
|
|
||||||
Int sz = 3+pt[0];
|
|
||||||
pt += sz;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#if USE_GMP
|
#if USE_GMP
|
||||||
case (CELL)FunctorBigInt:
|
case (CELL)FunctorBigInt:
|
||||||
{
|
{
|
||||||
|
37
C/heapgc.c
37
C/heapgc.c
@ -1277,43 +1277,6 @@ mark_variable(CELL_PTR current)
|
|||||||
MARK(next+2);
|
MARK(next+2);
|
||||||
#endif
|
#endif
|
||||||
POP_CONTINUATION();
|
POP_CONTINUATION();
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
MARK(next);
|
|
||||||
/* size is given by functor + friends */
|
|
||||||
if (next < HGEN) {
|
|
||||||
total_oldies+=4+next[1];
|
|
||||||
}
|
|
||||||
total_marked += 4+next[1];
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i <= 4+next[1]; i++) {
|
|
||||||
PUSH_POINTER(next+i);
|
|
||||||
}
|
|
||||||
#if GC_NO_TAGS
|
|
||||||
MARK(next+(3+next[1]));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
POP_CONTINUATION();
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
MARK(next);
|
|
||||||
{
|
|
||||||
UInt sz = 4+next[1]+(SIZEOF_DOUBLE-SIZEOF_LONG_INT);
|
|
||||||
/* size is given by functor + friends */
|
|
||||||
if (next < HGEN) {
|
|
||||||
total_oldies+=sz;
|
|
||||||
}
|
|
||||||
total_marked += sz;
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i <= sz; i++) {
|
|
||||||
PUSH_POINTER(next+i);
|
|
||||||
}
|
|
||||||
#if GC_NO_TAGS
|
|
||||||
MARK(next+(sz-1));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
POP_CONTINUATION();
|
|
||||||
#ifdef USE_GMP
|
#ifdef USE_GMP
|
||||||
case (CELL)FunctorBigInt:
|
case (CELL)FunctorBigInt:
|
||||||
MARK(next);
|
MARK(next);
|
||||||
|
@ -319,9 +319,6 @@ p_eq(void)
|
|||||||
return (d0 == d1);
|
return (d0 == d1);
|
||||||
case (CELL)FunctorLongInt:
|
case (CELL)FunctorLongInt:
|
||||||
return(LongIntOfTerm(d0) == LongIntOfTerm(d1));
|
return(LongIntOfTerm(d0) == LongIntOfTerm(d1));
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
return !Yap_compare_terms(d0,d1);
|
|
||||||
#ifdef USE_GMP
|
#ifdef USE_GMP
|
||||||
case (CELL)FunctorBigInt:
|
case (CELL)FunctorBigInt:
|
||||||
return (mpz_cmp(Yap_BigIntOfTerm(d0), Yap_BigIntOfTerm(d1)) == 0);
|
return (mpz_cmp(Yap_BigIntOfTerm(d0), Yap_BigIntOfTerm(d1)) == 0);
|
||||||
|
6
C/save.c
6
C/save.c
@ -545,6 +545,12 @@ do_save(int mode) {
|
|||||||
NewFileInfo('YAPS', 'MYap');
|
NewFileInfo('YAPS', 'MYap');
|
||||||
#endif
|
#endif
|
||||||
Term t1 = Deref(ARG1);
|
Term t1 = Deref(ARG1);
|
||||||
|
|
||||||
|
if (Yap_HoleSize) {
|
||||||
|
Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(Yap_FileNameBuf)),
|
||||||
|
"restore/1: address space has holes, cannot save");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
if (!Yap_GetName(Yap_FileNameBuf, YAP_FILENAME_MAX, t1)) {
|
if (!Yap_GetName(Yap_FileNameBuf, YAP_FILENAME_MAX, t1)) {
|
||||||
Yap_Error(TYPE_ERROR_LIST,t1,"save/1");
|
Yap_Error(TYPE_ERROR_LIST,t1,"save/1");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
13
C/stdpreds.c
13
C/stdpreds.c
@ -11,8 +11,11 @@
|
|||||||
* File: stdpreds.c *
|
* File: stdpreds.c *
|
||||||
* comments: General-purpose C implemented system predicates *
|
* comments: General-purpose C implemented system predicates *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2006-05-18 16:33:05 $,$Author: vsc $ *
|
* Last rev: $Date: 2006-05-19 14:31:32 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.103 2006/05/18 16:33:05 vsc
|
||||||
|
* fix info reported by memory manager under DL_MALLOC and SYSTEM_MALLOC
|
||||||
|
*
|
||||||
* Revision 1.102 2006/04/28 17:53:44 vsc
|
* Revision 1.102 2006/04/28 17:53:44 vsc
|
||||||
* fix the expand_consult patch
|
* fix the expand_consult patch
|
||||||
*
|
*
|
||||||
@ -2294,10 +2297,10 @@ Yap_show_statistics(void)
|
|||||||
#if USE_SYSTEM_MALLOC && HAVE_MALLINFO
|
#if USE_SYSTEM_MALLOC && HAVE_MALLINFO
|
||||||
struct mallinfo mi = mallinfo();
|
struct mallinfo mi = mallinfo();
|
||||||
|
|
||||||
heap_space_taken = mi.arena+mi.hblkhd;
|
heap_space_taken = (mi.arena+mi.hblkhd)-Yap_HoleSize;
|
||||||
#else
|
#else
|
||||||
heap_space_taken =
|
heap_space_taken =
|
||||||
(unsigned long int)(Unsigned(HeapTop)-Unsigned(Yap_HeapBase));
|
(unsigned long int)(Unsigned(HeapTop)-Unsigned(Yap_HeapBase))-Yap_HoleSize;
|
||||||
#endif
|
#endif
|
||||||
frag = (100.0*(heap_space_taken-HeapUsed))/heap_space_taken;
|
frag = (100.0*(heap_space_taken-HeapUsed))/heap_space_taken;
|
||||||
|
|
||||||
@ -2464,9 +2467,9 @@ p_statistics_heap_info(void)
|
|||||||
#if USE_SYSTEM_MALLOC && HAVE_MALLINFO
|
#if USE_SYSTEM_MALLOC && HAVE_MALLINFO
|
||||||
struct mallinfo mi = mallinfo();
|
struct mallinfo mi = mallinfo();
|
||||||
|
|
||||||
Term tmax = MkIntegerTerm(mi.arena+mi.hblkhd);
|
Term tmax = MkIntegerTerm((mi.arena+mi.hblkhd)-Yap_HoleSize);
|
||||||
#else
|
#else
|
||||||
Term tmax = MkIntegerTerm(Unsigned(H0) - Unsigned(Yap_HeapBase));
|
Term tmax = MkIntegerTerm((Unsigned(H0) - Unsigned(Yap_HeapBase))-Yap_HoleSize);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(Yap_unify(tmax, ARG1) && Yap_unify(tusage,ARG2));
|
return(Yap_unify(tmax, ARG1) && Yap_unify(tusage,ARG2));
|
||||||
|
@ -227,8 +227,6 @@ OCUnify_complex(register CELL *pt0, register CELL *pt0_end,
|
|||||||
if (IsExtensionFunctor(f)) {
|
if (IsExtensionFunctor(f)) {
|
||||||
switch((CELL)f) {
|
switch((CELL)f) {
|
||||||
case (CELL)FunctorDBRef:
|
case (CELL)FunctorDBRef:
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
if (d0 == d1) continue;
|
if (d0 == d1) continue;
|
||||||
goto cufail;
|
goto cufail;
|
||||||
case (CELL)FunctorLongInt:
|
case (CELL)FunctorLongInt:
|
||||||
@ -387,8 +385,6 @@ oc_unify_nvar_nvar:
|
|||||||
if (IsExtensionFunctor((Functor)d0)) {
|
if (IsExtensionFunctor((Functor)d0)) {
|
||||||
switch(d0) {
|
switch(d0) {
|
||||||
case (CELL)FunctorDBRef:
|
case (CELL)FunctorDBRef:
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
return(pt0 == pt1);
|
return(pt0 == pt1);
|
||||||
case (CELL)FunctorLongInt:
|
case (CELL)FunctorLongInt:
|
||||||
return(pt0[1] == pt1[1]);
|
return(pt0[1] == pt1[1]);
|
||||||
@ -530,8 +526,6 @@ unify_nvar_nvar:
|
|||||||
if (IsExtensionFunctor((Functor)d0)) {
|
if (IsExtensionFunctor((Functor)d0)) {
|
||||||
switch(d0) {
|
switch(d0) {
|
||||||
case (CELL)FunctorDBRef:
|
case (CELL)FunctorDBRef:
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
return(pt0 == pt1);
|
return(pt0 == pt1);
|
||||||
case (CELL)FunctorLongInt:
|
case (CELL)FunctorLongInt:
|
||||||
return(pt0[1] == pt1[1]);
|
return(pt0[1] == pt1[1]);
|
||||||
|
@ -442,8 +442,6 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb)
|
|||||||
case (CELL)FunctorDouble:
|
case (CELL)FunctorDouble:
|
||||||
wrputf(FloatOfTerm(t),wglb->writech);
|
wrputf(FloatOfTerm(t),wglb->writech);
|
||||||
return;
|
return;
|
||||||
case (CELL)FunctorIntArray:
|
|
||||||
case (CELL)FunctorDoubleArray:
|
|
||||||
case (CELL)FunctorDBRef:
|
case (CELL)FunctorDBRef:
|
||||||
wrputref(RefOfTerm(t), wglb->Quote_illegal, wglb->writech);
|
wrputref(RefOfTerm(t), wglb->Quote_illegal, wglb->writech);
|
||||||
return;
|
return;
|
||||||
|
4
H/Heap.h
4
H/Heap.h
@ -10,7 +10,7 @@
|
|||||||
* File: Heap.h *
|
* File: Heap.h *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: Heap Init Structure *
|
* comments: Heap Init Structure *
|
||||||
* version: $Id: Heap.h,v 1.100 2006-05-18 16:33:05 vsc Exp $ *
|
* version: $Id: Heap.h,v 1.101 2006-05-19 14:31:32 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/* information that can be stored in Code Space */
|
/* information that can be stored in Code Space */
|
||||||
@ -190,6 +190,7 @@ typedef int (*Agc_hook)(Atom);
|
|||||||
|
|
||||||
typedef struct various_codes {
|
typedef struct various_codes {
|
||||||
special_functors funcs;
|
special_functors funcs;
|
||||||
|
UInt hole_size;
|
||||||
struct malloc_state *av_;
|
struct malloc_state *av_;
|
||||||
#if USE_DL_MALLOC
|
#if USE_DL_MALLOC
|
||||||
struct memory_hole memory_holes[MAX_DLMALLOC_HOLES];
|
struct memory_hole memory_holes[MAX_DLMALLOC_HOLES];
|
||||||
@ -540,6 +541,7 @@ struct various_codes *Yap_heap_regs;
|
|||||||
#define Yap_heap_regs ((all_heap_codes *)HEAP_INIT_BASE)
|
#define Yap_heap_regs ((all_heap_codes *)HEAP_INIT_BASE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define Yap_HoleSize Yap_heap_regs->hole_size
|
||||||
#define Yap_av Yap_heap_regs->av_
|
#define Yap_av Yap_heap_regs->av_
|
||||||
#define Yap_MemoryHoles Yap_heap_regs->memory_holes
|
#define Yap_MemoryHoles Yap_heap_regs->memory_holes
|
||||||
#define Yap_NOfMemoryHoles Yap_heap_regs->nof_memory_holes
|
#define Yap_NOfMemoryHoles Yap_heap_regs->nof_memory_holes
|
||||||
|
79
H/TermExt.h
79
H/TermExt.h
@ -10,7 +10,7 @@
|
|||||||
* File: TermExt.h *
|
* File: TermExt.h *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: Extensions to standard terms for YAP *
|
* comments: Extensions to standard terms for YAP *
|
||||||
* version: $Id: TermExt.h,v 1.8 2006-05-19 13:48:11 vsc Exp $ *
|
* version: $Id: TermExt.h,v 1.9 2006-05-19 14:31:32 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#ifdef USE_SYSTEM_MALLOC
|
#ifdef USE_SYSTEM_MALLOC
|
||||||
@ -45,33 +45,27 @@ typedef enum
|
|||||||
{
|
{
|
||||||
#if defined(IN_SECOND_QUADRANT) && !GC_NO_TAGS
|
#if defined(IN_SECOND_QUADRANT) && !GC_NO_TAGS
|
||||||
db_ref_e = sizeof (Functor *) | RBIT,
|
db_ref_e = sizeof (Functor *) | RBIT,
|
||||||
int_array_e = 2 * sizeof (Functor *) | RBIT,
|
long_int_e = 2 * sizeof (Functor *) | RBIT,
|
||||||
double_array_e = 3 * sizeof (Functor *) | RBIT,
|
|
||||||
long_int_e = 4 * sizeof (Functor *) | RBIT,
|
|
||||||
#ifdef USE_GMP
|
#ifdef USE_GMP
|
||||||
big_int_e = 5 * sizeof (Functor *) | RBIT,
|
big_int_e = 3 * sizeof (Functor *) | RBIT,
|
||||||
double_e = 6 * sizeof (Functor *) | RBIT
|
double_e = 4 * sizeof (Functor *) | RBIT
|
||||||
#else
|
#else
|
||||||
double_e = 5 * sizeof (Functor *) | RBIT
|
double_e = 3 * sizeof (Functor *) | RBIT
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
db_ref_e = sizeof (Functor *),
|
db_ref_e = sizeof (Functor *),
|
||||||
int_array_e = 2 * sizeof (Functor *),
|
long_int_e = 2 * sizeof (Functor *),
|
||||||
double_array_e = 3 * sizeof (Functor *),
|
|
||||||
long_int_e = 4 * sizeof (Functor *),
|
|
||||||
#ifdef USE_GMP
|
#ifdef USE_GMP
|
||||||
big_int_e = 5 * sizeof (Functor *),
|
big_int_e = 3 * sizeof (Functor *),
|
||||||
double_e = 6 * sizeof (Functor *)
|
double_e = 4 * sizeof (Functor *)
|
||||||
#else
|
#else
|
||||||
double_e = 5 * sizeof (Functor *)
|
double_e = 3 * sizeof (Functor *)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
blob_type;
|
blob_type;
|
||||||
|
|
||||||
#define FunctorDBRef ((Functor)(db_ref_e))
|
#define FunctorDBRef ((Functor)(db_ref_e))
|
||||||
#define FunctorIntArray ((Functor)(int_array_e))
|
|
||||||
#define FunctorDoubleArray ((Functor)(double_array_e))
|
|
||||||
#define FunctorLongInt ((Functor)(long_int_e))
|
#define FunctorLongInt ((Functor)(long_int_e))
|
||||||
#ifdef USE_GMP
|
#ifdef USE_GMP
|
||||||
#define FunctorBigInt ((Functor)(big_int_e))
|
#define FunctorBigInt ((Functor)(big_int_e))
|
||||||
@ -326,59 +320,6 @@ IsLongIntTerm (Term t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Term Yap_MkIntArrayTerm (UInt, Int *);
|
|
||||||
|
|
||||||
inline EXTERN Int *Yap_IntArrayOfTerm (Term t);
|
|
||||||
|
|
||||||
inline EXTERN Int *
|
|
||||||
Yap_IntArrayOfTerm (Term t)
|
|
||||||
{
|
|
||||||
return (Int *) (RepAppl(t)+2);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline EXTERN UInt Yap_SizeOfIntArray (Term t);
|
|
||||||
|
|
||||||
inline EXTERN UInt
|
|
||||||
Yap_SizeOfIntArray (Term t)
|
|
||||||
{
|
|
||||||
return (UInt) (RepAppl(t)[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline EXTERN int Yap_IsIntArrayTerm (Term);
|
|
||||||
|
|
||||||
inline EXTERN int
|
|
||||||
Yap_IsIntArrayTerm (Term t)
|
|
||||||
{
|
|
||||||
return (int) (IsApplTerm (t) && FunctorOfTerm (t) == FunctorIntArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Term Yap_MkFloatArrayTerm (UInt, Float *);
|
|
||||||
|
|
||||||
inline EXTERN Float *Yap_FloatArrayOfTerm (Term t);
|
|
||||||
|
|
||||||
inline EXTERN Float *
|
|
||||||
Yap_FloatArrayOfTerm (Term t)
|
|
||||||
{
|
|
||||||
return (Float *) (RepAppl(t)+2);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline EXTERN UInt Yap_SizeOfFloatArray (Term t);
|
|
||||||
|
|
||||||
inline EXTERN UInt
|
|
||||||
Yap_SizeOfFloatArray (Term t)
|
|
||||||
{
|
|
||||||
return (UInt) (RepAppl(t)[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline EXTERN int Yap_IsFloatArrayTerm (Term);
|
|
||||||
|
|
||||||
inline EXTERN int
|
|
||||||
Yap_IsFloatArrayTerm (Term t)
|
|
||||||
{
|
|
||||||
return (int) (IsApplTerm (t) && FunctorOfTerm (t) == FunctorDoubleArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_GMP
|
#ifdef USE_GMP
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -607,8 +548,6 @@ unify_extension (Functor f, CELL d0, CELL * pt0, CELL d1)
|
|||||||
switch (BlobOfFunctor (f))
|
switch (BlobOfFunctor (f))
|
||||||
{
|
{
|
||||||
case db_ref_e:
|
case db_ref_e:
|
||||||
case int_array_e:
|
|
||||||
case double_array_e:
|
|
||||||
return (d0 == d1);
|
return (d0 == d1);
|
||||||
case long_int_e:
|
case long_int_e:
|
||||||
return (pt0[1] == RepAppl (d1)[1]);
|
return (pt0[1] == RepAppl (d1)[1]);
|
||||||
|
@ -131,11 +131,7 @@ MALLOC_T calloc(size_t,size_t);
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_DL_MALLOC
|
|
||||||
void Yap_add_memory_hole(ADDR, ADDR);
|
void Yap_add_memory_hole(ADDR, ADDR);
|
||||||
#else
|
|
||||||
#define Yap_add_memory_hole(Start, End)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SCRATCH_START_SIZE (64*1024L)
|
#define SCRATCH_START_SIZE (64*1024L)
|
||||||
#define SCRATCH_INC_SIZE (64*1024L)
|
#define SCRATCH_INC_SIZE (64*1024L)
|
||||||
|
Reference in New Issue
Block a user