From cfa2a8f75f59033e663d203b2753ca07c080efc8 Mon Sep 17 00:00:00 2001 From: vsc Date: Wed, 30 Jan 2008 10:35:43 +0000 Subject: [PATCH] fix indexing in 64 bits (it would split ints from atoms :( ). git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2072 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/index.c | 28 ++++++++++++++++------------ H/Tags_24bits.h | 3 ++- H/Tags_32LowTag.h | 3 ++- H/Tags_32Ops.h | 3 ++- H/Tags_64bits.h | 3 ++- changes-5.1.html | 2 ++ 6 files changed, 26 insertions(+), 16 deletions(-) diff --git a/C/index.c b/C/index.c index 68dd1d4fe..8959510a0 100644 --- a/C/index.c +++ b/C/index.c @@ -11,8 +11,11 @@ * File: index.c * * comments: Indexing a Prolog predicate * * * -* Last rev: $Date: 2008-01-24 10:20:42 $,$Author: vsc $ * +* Last rev: $Date: 2008-01-30 10:35:43 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.195 2008/01/24 10:20:42 vsc +* clause should not try to discover who is fail. +* * Revision 1.194 2008/01/24 00:11:59 vsc * garbage collector was not asking for space. * avoid 0 sized calls to mmap. @@ -598,7 +601,7 @@ recover_from_failed_susp_on_cls(struct intermediates *cint, UInt sz) static inline int smaller(Term t1, Term t2) { - CELL tg1 = TagOf(t1), tg2 = TagOf(t2); + CELL tg1 = LowTagOf(t1), tg2 = LowTagOf(t2); if (tg1 == tg2) { return t1 < t2; } else @@ -608,7 +611,7 @@ smaller(Term t1, Term t2) static inline int smaller_or_eq(Term t1, Term t2) { - CELL tg1 = TagOf(t1), tg2 = TagOf(t2); + CELL tg1 = LowTagOf(t1), tg2 = LowTagOf(t2); if (tg1 == tg2) { return t1 <= t2; } else @@ -3621,13 +3624,13 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_ } static AtomSwiEntry * -emit_cswitch(int n, yamop *fail_l, struct intermediates *cint) +emit_cswitch(COUNT n, yamop *fail_l, struct intermediates *cint) { compiler_vm_op op; AtomSwiEntry *target; if (n > MIN_HASH_ENTRIES) { - int cases = MIN_HASH_ENTRIES, i; + COUNT cases = MIN_HASH_ENTRIES, i; n += 1+n/4; while (cases < n) cases *= 2; n = cases; @@ -3688,7 +3691,7 @@ fetch_centry(AtomSwiEntry *cebase, Term wt, int i, int n) } static FuncSwiEntry * -emit_fswitch(int n, yamop *fail_l, struct intermediates *cint) +emit_fswitch(COUNT n, yamop *fail_l, struct intermediates *cint) { compiler_vm_op op; FuncSwiEntry *target; @@ -4017,9 +4020,9 @@ do_var_entries(GroupDef *grp, Term t, struct intermediates *cint, UInt argno, in static UInt do_consts(GroupDef *grp, Term t, struct intermediates *cint, int compound_term, CELL *sreg, UInt arity, int last_arg, UInt argno, int first, UInt nxtlbl, int clleft, CELL *top) { - UInt n; + COUNT n; ClauseDef *min = grp->FirstClause; - UInt i; + COUNT i; UInt lbl; /* generate a switch */ AtomSwiEntry *cs; @@ -4072,9 +4075,9 @@ do_consts(GroupDef *grp, Term t, struct intermediates *cint, int compound_term, static void do_blobs(GroupDef *grp, Term t, struct intermediates *cint, UInt argno, int first, UInt nxtlbl, int clleft, CELL *top) { - UInt n; + COUNT n; ClauseDef *min = grp->FirstClause; - UInt i; + COUNT i; /* generate a switch */ AtomSwiEntry *cs; PredEntry *ap = cint->CurrentPred; @@ -4106,9 +4109,9 @@ do_blobs(GroupDef *grp, Term t, struct intermediates *cint, UInt argno, int firs static UInt do_funcs(GroupDef *grp, Term t, struct intermediates *cint, UInt argno, int first, int last_arg, UInt nxtlbl, int clleft, CELL *top) { - UInt n = count_funcs(grp); + COUNT n = count_funcs(grp); ClauseDef *min = grp->FirstClause; - UInt i; + COUNT i; FuncSwiEntry *fs; UInt lbl; @@ -4135,6 +4138,7 @@ do_funcs(GroupDef *grp, Term t, struct intermediates *cint, UInt argno, int firs ifs->u.Label = suspend_indexing(min, max, ap, cint); } else */ + if (IsExtensionFunctor(f)) { if (f == FunctorDBRef) ifs->u.Label = do_dbref_index(min, max, t, cint, argno, nxtlbl, first, clleft, top); diff --git a/H/Tags_24bits.h b/H/Tags_24bits.h index 7ac44f16c..00412db3c 100644 --- a/H/Tags_24bits.h +++ b/H/Tags_24bits.h @@ -18,7 +18,7 @@ * Last rev: December 90 * * mods: * * comments: Tag Scheme for machines with 24 bits adresses (m68000) * -* version: $Id: Tags_24bits.h,v 1.1 2005-05-27 22:27:06 rslopes Exp $ * +* version: $Id: Tags_24bits.h,v 1.2 2008-01-30 10:35:43 vsc Exp $ * *************************************************************************/ /* Version for 24 bit addresses (68000) @@ -54,6 +54,7 @@ #define MAX_ABS_INT /* 0xfe00000LL */ ((((UInt)(1<<7))-1) << SHIFT_HIGH_TAG) #define TagOf(X) (Unsigned(X) & TagBits) +#define LowTagOf(X) (Unsigned(X) & TagBits) #define NonTagPart(X) (Signed(X) & MaskAdr) #define TAGGEDA(TAG,V) (TAG | Unsigned(V)) #define TAGGED(TAG,V) (TAG | NonTagPart(Unsigned(V))) diff --git a/H/Tags_32LowTag.h b/H/Tags_32LowTag.h index 5654ff6cf..b5ca8c28d 100644 --- a/H/Tags_32LowTag.h +++ b/H/Tags_32LowTag.h @@ -11,7 +11,7 @@ * Last rev: December 90 * * mods: * * comments: Original Tag Scheme for machines with 32 bits adresses * -* version: $Id: Tags_32LowTag.h,v 1.3 2005-05-31 08:21:43 ricroc Exp $ * +* version: $Id: Tags_32LowTag.h,v 1.4 2008-01-30 10:35:43 vsc Exp $ * *************************************************************************/ #define TAG_LOW_BITS_32 1 @@ -66,6 +66,7 @@ #define NumberMask /* 0x0000000bL */ MKTAG(0x2,3) #define TagOf(V) (Unsigned(V) & LowTagBits) +#define LowTagOf(V) (Unsigned(V) & LowTagBits) #define NonTagPart(V) ((Unsigned(V)>>1) & ~LowTagBits) #define TAGGED(TAG,V) (((Unsigned(V)<<(SHIFT_HIGH_TAG+SHIFT_LOW_TAG+1))>>1)|(TAG)) #define NONTAGGED(TAG,V) ((Unsigned(V)<<(SHIFT_HIGH_TAG+SHIFT_LOW_TAG+1))>>1) diff --git a/H/Tags_32Ops.h b/H/Tags_32Ops.h index 11da484ae..b879c1e89 100644 --- a/H/Tags_32Ops.h +++ b/H/Tags_32Ops.h @@ -18,7 +18,7 @@ * Last rev: December 90 * * mods: * * comments: Original Tag Scheme for machines with 32 bits adresses * -* version: $Id: Tags_32Ops.h,v 1.2 2005-12-23 00:20:14 vsc Exp $ * +* version: $Id: Tags_32Ops.h,v 1.3 2008-01-30 10:35:43 vsc Exp $ * *************************************************************************/ /* @@ -91,6 +91,7 @@ are now 1 in compound terms and structures. #endif #define TagOf(t) (Unsigned(t)&TagBits) +#define LowTagOf(t) (Unsigned(t)&TagBits) #define NonTagPart(X) (Signed(X) & MaskPrim) #define TAGGEDA(TAG,V) (TAG | Unsigned(V)) #define TAGGED(TAG,V) (TAG | NonTagPart(Unsigned(V)<<2)) diff --git a/H/Tags_64bits.h b/H/Tags_64bits.h index e909c8872..b5a8d6544 100644 --- a/H/Tags_64bits.h +++ b/H/Tags_64bits.h @@ -18,7 +18,7 @@ * Last rev: December 90 * * mods: * * comments: Original Tag Scheme for machines with 32 bits adresses * -* version: $Id: Tags_64bits.h,v 1.1 2005-05-27 22:27:06 rslopes Exp $ * +* version: $Id: Tags_64bits.h,v 1.2 2008-01-30 10:35:43 vsc Exp $ * *************************************************************************/ #define TAG_64BITS 1 @@ -65,6 +65,7 @@ property list #define NumberMask /* 0x20000007L */ MKTAG(0x2,7) #define TagOf(t) (Unsigned(t)&TagBits) +#define LowTagOf(t) (Unsigned(t)&LowTagBits) #define NonTagPart(X) (Signed(X) & MaskPrim) #define TAGGEDA(TAG,V) (TAG | Unsigned(V)) #define TAGGED(TAG,V) (TAG | NonTagPart(Unsigned(V)<<3)) /* SQRT(8) */ diff --git a/changes-5.1.html b/changes-5.1.html index 5d5653e6a..61ef91499 100644 --- a/changes-5.1.html +++ b/changes-5.1.html @@ -17,6 +17,8 @@

Yap-5.1.3: