more ezo stuff
This commit is contained in:
parent
ec5f7ebb28
commit
459ab89d7d
@ -159,7 +159,7 @@ Yap_AllocCodeSpace(size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline char *
|
static inline char *
|
||||||
call_realloc(char *p, unsigned long int size)
|
call_realloc(char *p, size_t size)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
char *out;
|
char *out;
|
||||||
|
4
C/exo.c
4
C/exo.c
@ -186,13 +186,13 @@ HASH_FVN_1A(UInt arity, CELL *cl, UInt bnds[], UInt sz);
|
|||||||
spread over j quadrants.
|
spread over j quadrants.
|
||||||
*/
|
*/
|
||||||
extern inline BITS32
|
extern inline BITS32
|
||||||
HASH_FVN_1A(UInt arity, CELL *cl, UInt bnds[], UInt sz)
|
HASH_FVN_1A(UInt ar, CELL *cl, UInt bnds[], UInt sz)
|
||||||
{
|
{
|
||||||
UInt hash;
|
UInt hash;
|
||||||
UInt j=0;
|
UInt j=0;
|
||||||
|
|
||||||
hash = FNV32_OFFSET;
|
hash = FNV32_OFFSET;
|
||||||
while (j < arity) {
|
while (j < ar) {
|
||||||
if (bnds[j]) {
|
if (bnds[j]) {
|
||||||
unsigned char *i=(unsigned char*)(cl+j);
|
unsigned char *i=(unsigned char*)(cl+j);
|
||||||
unsigned char *m=(unsigned char*)(cl+(j+1));
|
unsigned char *m=(unsigned char*)(cl+(j+1));
|
||||||
|
14
C/exo_udi.c
14
C/exo_udi.c
@ -137,7 +137,7 @@ IntervalUDIRefitIndex(struct index_t **ip, UInt b[] USES_REGS)
|
|||||||
/* it is bound, use hash */
|
/* it is bound, use hash */
|
||||||
if (it->bmap & b[i]) return;
|
if (it->bmap & b[i]) return;
|
||||||
/* no constraints, nothing to gain */
|
/* no constraints, nothing to gain */
|
||||||
if (!IsAttVar(VarOfTerm(XREGS[i+1]))) return;
|
//if (!IsAttVar(VarOfTerm(Deref(XREGS[i+1])))) return;
|
||||||
LOCAL_exo_it = it;
|
LOCAL_exo_it = it;
|
||||||
LOCAL_exo_base = it->bcls;
|
LOCAL_exo_base = it->bcls;
|
||||||
LOCAL_exo_arity = it->arity;
|
LOCAL_exo_arity = it->arity;
|
||||||
@ -161,9 +161,9 @@ IntervalUDIRefitIndex(struct index_t **ip, UInt b[] USES_REGS)
|
|||||||
|
|
||||||
/* be conservative */
|
/* be conservative */
|
||||||
if (it->udi_free_args)
|
if (it->udi_free_args)
|
||||||
sz = sizeof(BITS32)*(3*it->ntrys+2*it->nentries);
|
sz = sizeof(BITS32)*(3*it->ntrys+3*it->nentries);
|
||||||
else
|
else
|
||||||
sz = sizeof(BITS32)*(2*it->ntrys+it->nentries);
|
sz = sizeof(BITS32)*(2*it->ntrys+2*it->nentries);
|
||||||
/* allocate space */
|
/* allocate space */
|
||||||
if (!(it->udi_data = (BITS32*)Yap_AllocCodeSpace(sz)))
|
if (!(it->udi_data = (BITS32*)Yap_AllocCodeSpace(sz)))
|
||||||
return;
|
return;
|
||||||
@ -364,6 +364,9 @@ Interval(struct index_t *it, Term min, Term max, Term op, BITS32 off USES_REGS)
|
|||||||
} else if (at == AtomMin) {
|
} else if (at == AtomMin) {
|
||||||
Int x0, xe, x;
|
Int x0, xe, x;
|
||||||
|
|
||||||
|
if (!(it->udi_free_args)) {
|
||||||
|
S = EXO_OFFSET_TO_ADDRESS(it, pt[0]);
|
||||||
|
} else {
|
||||||
x0 = pt-pt0;
|
x0 = pt-pt0;
|
||||||
xe = end-pt0;
|
xe = end-pt0;
|
||||||
S = EXO_OFFSET_TO_ADDRESS(it, pt[0]);
|
S = EXO_OFFSET_TO_ADDRESS(it, pt[0]);
|
||||||
@ -377,10 +380,14 @@ Interval(struct index_t *it, Term min, Term max, Term op, BITS32 off USES_REGS)
|
|||||||
YENV -= 5;
|
YENV -= 5;
|
||||||
return it->code;
|
return it->code;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NEXTOP(NEXTOP(it->code,lp),lp);
|
return NEXTOP(NEXTOP(it->code,lp),lp);
|
||||||
} else if (at == AtomMax) {
|
} else if (at == AtomMax) {
|
||||||
Int x0, xe, x, y;
|
Int x0, xe, x, y;
|
||||||
|
|
||||||
|
if (!(it->udi_free_args)) {
|
||||||
|
S = EXO_OFFSET_TO_ADDRESS(it, end[0]);
|
||||||
|
} else {
|
||||||
x0 = pt-pt0;
|
x0 = pt-pt0;
|
||||||
xe = end-pt0;
|
xe = end-pt0;
|
||||||
y = BIGGEST_EL( x0, end0, xe );
|
y = BIGGEST_EL( x0, end0, xe );
|
||||||
@ -395,6 +402,7 @@ Interval(struct index_t *it, Term min, Term max, Term op, BITS32 off USES_REGS)
|
|||||||
YENV -= 5;
|
YENV -= 5;
|
||||||
return it->code;
|
return it->code;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NEXTOP(NEXTOP(it->code,lp),lp);
|
return NEXTOP(NEXTOP(it->code,lp),lp);
|
||||||
}
|
}
|
||||||
return NEXTOP(NEXTOP(it->code,lp),lp);
|
return NEXTOP(NEXTOP(it->code,lp),lp);
|
||||||
|
@ -9,13 +9,12 @@
|
|||||||
:- module(exo_interval,
|
:- module(exo_interval,
|
||||||
[max/2,
|
[max/2,
|
||||||
min/2,
|
min/2,
|
||||||
|
any/2,
|
||||||
max/1,
|
max/1,
|
||||||
min/1,
|
min/1,
|
||||||
any/2,
|
maximum/1,
|
||||||
|
minimum/1,
|
||||||
any/1,
|
any/1,
|
||||||
max/3,
|
|
||||||
min/3,
|
|
||||||
any/3,
|
|
||||||
(#<)/2,
|
(#<)/2,
|
||||||
(#>)/2,
|
(#>)/2,
|
||||||
(#=<)/2,
|
(#=<)/2,
|
||||||
@ -27,31 +26,33 @@
|
|||||||
op(700, xfx, (#=<)),
|
op(700, xfx, (#=<)),
|
||||||
op(700, xfx, (#=))]).
|
op(700, xfx, (#=))]).
|
||||||
|
|
||||||
:- meta_predicate max(?,0,?), min(?,0,?), any(?,0,?).
|
:- meta_predicate max(?,0), min(?,0), any(?,0).
|
||||||
|
|
||||||
max(X, G, X) :-
|
max(X, G) :-
|
||||||
insert_atts(X, i(_,_,max)),
|
insert_atts(X, i(_,_,max)),
|
||||||
call(G).
|
call(G).
|
||||||
|
|
||||||
min(X, G, X) :-
|
min(X, G) :-
|
||||||
insert_atts(X, i(_,_,min)),
|
insert_atts(X, i(_,_,min)),
|
||||||
call(G).
|
call(G).
|
||||||
|
|
||||||
max(X, X) :-
|
|
||||||
insert_atts(X, i(_,_,max)).
|
|
||||||
|
|
||||||
min(X, X) :-
|
|
||||||
insert_atts(X, i(_,_,min)).
|
|
||||||
|
|
||||||
max(X) :-
|
max(X) :-
|
||||||
insert_atts(X, i(_,_,max)).
|
insert_atts(X, i(_,_,max)).
|
||||||
|
|
||||||
|
maximum(X) :-
|
||||||
|
insert_atts(X, i(_,_,maximum)).
|
||||||
|
|
||||||
any(X) :-
|
any(X) :-
|
||||||
insert_atts(X, i(_,_,any)).
|
insert_atts(X, i(_,_,any)).
|
||||||
|
|
||||||
min(X) :-
|
min(X) :-
|
||||||
insert_atts(X, i(_,_,min)).
|
insert_atts(X, i(_,_,min)).
|
||||||
|
|
||||||
|
minimum(X) :-
|
||||||
|
insert_atts(X, i(_,_,minimum)).
|
||||||
|
|
||||||
|
least(X) :-
|
||||||
|
insert_atts(X, i(_,_,least)).
|
||||||
|
|
||||||
X #> Y :-
|
X #> Y :-
|
||||||
( var(X) -> insert_atts(X, i(Y,_,_))
|
( var(X) -> insert_atts(X, i(Y,_,_))
|
||||||
|
Reference in New Issue
Block a user