add new eval compiler
fix garbage collector for new big allocation scheme.
This commit is contained in:
parent
8bcafd417a
commit
2e8d898e86
@ -50,13 +50,13 @@ static char SccsId[] = "%W% %G%";
|
|||||||
static UInt
|
static UInt
|
||||||
big2arena_sz(CELL *arena_base)
|
big2arena_sz(CELL *arena_base)
|
||||||
{
|
{
|
||||||
return ((MP_INT*)(arena_base+1))->_mp_alloc + (sizeof(MP_INT) + sizeof(Functor)+sizeof(CELL))/sizeof(CELL);
|
return ((MP_INT*)(arena_base+2))->_mp_alloc + (sizeof(MP_INT) + sizeof(Functor)+2*sizeof(CELL))/sizeof(CELL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static UInt
|
static UInt
|
||||||
arena2big_sz(UInt sz)
|
arena2big_sz(UInt sz)
|
||||||
{
|
{
|
||||||
return sz - (sizeof(MP_INT) + sizeof(Functor) + sizeof(CELL))/sizeof(CELL);
|
return sz - (sizeof(MP_INT) + sizeof(Functor) + 2*sizeof(CELL))/sizeof(CELL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1346,7 +1346,7 @@ mark_variable(CELL_PTR current)
|
|||||||
POP_CONTINUATION();
|
POP_CONTINUATION();
|
||||||
case (CELL)FunctorBigInt:
|
case (CELL)FunctorBigInt:
|
||||||
{
|
{
|
||||||
UInt sz = (sizeof(MP_INT)+1+
|
UInt sz = (sizeof(MP_INT)+CellSize+
|
||||||
((MP_INT *)(next+2))->_mp_alloc*sizeof(mp_limb_t))/CellSize;
|
((MP_INT *)(next+2))->_mp_alloc*sizeof(mp_limb_t))/CellSize;
|
||||||
MARK(next);
|
MARK(next);
|
||||||
/* size is given by functor + friends */
|
/* size is given by functor + friends */
|
||||||
|
11
pl/eval.yap
11
pl/eval.yap
@ -1,13 +1,11 @@
|
|||||||
:- style_check(all).
|
|
||||||
:- yap_flag(unknown,error).
|
|
||||||
:- source.
|
|
||||||
|
|
||||||
:- module('$eval',
|
:- module('eval',
|
||||||
[compile_arithmetic/2]).
|
['$compile_arithmetic'/2]).
|
||||||
|
|
||||||
'$compile_arithmetic'((Head :- Body), (Head :- NBody)) :-
|
'$compile_arithmetic'((Head :- Body), (Head :- NBody)) :-
|
||||||
term_variables(Head, LVs),
|
term_variables(Head, LVs),
|
||||||
process_body(Body, LVs, NBody).
|
process_body(Body, LVs, NBody).
|
||||||
|
'$compile_arithmetic'(G, G).
|
||||||
|
|
||||||
process_body((G,Body), InputVs, NewBody) :-
|
process_body((G,Body), InputVs, NewBody) :-
|
||||||
arithmetic_exp(G), !,
|
arithmetic_exp(G), !,
|
||||||
@ -507,7 +505,7 @@ compile_op(fdiv(x(A),F,x(B)), fdiv_c1(A,B,F)) :- float(F), !.
|
|||||||
compile_op(fdiv(x(A),I,x(B)), fdiv_c1(A,B,F)) :- integer(I), !, F is truncate(I).
|
compile_op(fdiv(x(A),I,x(B)), fdiv_c1(A,B,F)) :- integer(I), !, F is truncate(I).
|
||||||
compile_op(fdiv(x(A),x(B),F), fdiv_c2(A,B,F)) :- float(F), !.
|
compile_op(fdiv(x(A),x(B),F), fdiv_c2(A,B,F)) :- float(F), !.
|
||||||
compile_op(fdiv(x(A),x(B),I), fdiv_c2(A,B,F)) :- integer(I), !, F is truncate(I).
|
compile_op(fdiv(x(A),x(B),I), fdiv_c2(A,B,F)) :- integer(I), !, F is truncate(I).
|
||||||
`compile_op(fdiv(x(A),x(B),x(C)), fdiv(A,B,C)).
|
compile_op(fdiv(x(A),x(B),x(C)), fdiv(A,B,C)).
|
||||||
compile_op(idiv(x(A),I,x(B)), idiv_c1(A,B,I)) :- integer(I), !.
|
compile_op(idiv(x(A),I,x(B)), idiv_c1(A,B,I)) :- integer(I), !.
|
||||||
compile_op(idiv(x(A),x(B),I), idiv_c2(A,B,I)) :- integer(I), !.
|
compile_op(idiv(x(A),x(B),I), idiv_c2(A,B,I)) :- integer(I), !.
|
||||||
compile_op(idiv(x(A),x(B),x(C)), idiv(A,B,C)).
|
compile_op(idiv(x(A),x(B),x(C)), idiv(A,B,C)).
|
||||||
@ -580,3 +578,4 @@ compile_op(msb(x(A),x(B)), msb(A,B)).
|
|||||||
compile_op(random(x(A),x(B)), random(A,B)).
|
compile_op(random(x(A),x(B)), random(A,B)).
|
||||||
compile_op(lgamma(x(A),x(B)), lgamma(A,B)).
|
compile_op(lgamma(x(A),x(B)), lgamma(A,B)).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ otherwise.
|
|||||||
|
|
||||||
:- compile_expressions.
|
:- compile_expressions.
|
||||||
|
|
||||||
:- [ 'eval.yap',
|
:- [
|
||||||
'yio.yap',
|
'yio.yap',
|
||||||
'debug.yap',
|
'debug.yap',
|
||||||
'checker.yap',
|
'checker.yap',
|
||||||
@ -60,6 +60,8 @@ otherwise.
|
|||||||
% modules must be after preds, otherwise we will have trouble
|
% modules must be after preds, otherwise we will have trouble
|
||||||
% with meta-predicate expansion being invoked
|
% with meta-predicate expansion being invoked
|
||||||
'modules.yap',
|
'modules.yap',
|
||||||
|
% must follow grammar
|
||||||
|
'eval.yap',
|
||||||
'signals.yap',
|
'signals.yap',
|
||||||
'profile.yap',
|
'profile.yap',
|
||||||
'callcount.yap',
|
'callcount.yap',
|
||||||
|
Reference in New Issue
Block a user