bignum support fixes

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1531 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2006-02-01 13:28:57 +00:00
parent 5f56e91375
commit 9e697d5bee
13 changed files with 45 additions and 16 deletions

View File

@ -10,8 +10,11 @@
* * * *
* File: absmi.c * * File: absmi.c *
* comments: Portable abstract machine interpreter * * comments: Portable abstract machine interpreter *
* Last rev: $Date: 2006-01-26 19:13:24 $,$Author: vsc $ * * Last rev: $Date: 2006-02-01 13:28:56 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.194 2006/01/26 19:13:24 vsc
* avoid compilation issues with lack of gmp (Remko Troncon)
*
* Revision 1.193 2006/01/18 15:34:53 vsc * Revision 1.193 2006/01/18 15:34:53 vsc
* avoid sideffects from MkBigInt * avoid sideffects from MkBigInt
* *
@ -9835,9 +9838,7 @@ Yap_absmi(int inp)
{ {
Int d1 = PREG->u.xxc.c; Int d1 = PREG->u.xxc.c;
if (IsIntTerm(d0)) { if (IsIntTerm(d0)) {
fprintf(stderr,"%d<<%d\n",IntOfTerm(d0), d1);
d0 = do_sll(IntOfTerm(d0), (Int)d1); d0 = do_sll(IntOfTerm(d0), (Int)d1);
fprintf(stderr,"%d\n",IntegerOfTerm(d0));
} }
else { else {
saveregs(); saveregs();

View File

@ -38,8 +38,8 @@ Yap_MkBigIntTerm(MP_INT *big)
CELL *ret = H; CELL *ret = H;
if (mpz_fits_slong_p(big)) { if (mpz_fits_slong_p(big)) {
int out = mpz_get_si(big); long int out = mpz_get_si(big);
return MkIntegerTerm(out); return MkIntegerTerm((Int)out);
} }
nlimbs = (big->_mp_alloc)*(sizeof(mp_limb_t)/CellSize); nlimbs = (big->_mp_alloc)*(sizeof(mp_limb_t)/CellSize);
if (nlimbs > (ASP-ret)-1024) { if (nlimbs > (ASP-ret)-1024) {

View File

@ -11,8 +11,11 @@
* File: cdmgr.c * * File: cdmgr.c *
* comments: Code manager * * comments: Code manager *
* * * *
* Last rev: $Date: 2006-01-08 03:12:00 $,$Author: vsc $ * * Last rev: $Date: 2006-02-01 13:28:56 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.175 2006/01/08 03:12:00 vsc
* fix small bug in attvar handling.
*
* Revision 1.174 2005/12/23 00:20:13 vsc * Revision 1.174 2005/12/23 00:20:13 vsc
* updates to gprof * updates to gprof
* support for __POWER__ * support for __POWER__
@ -5283,7 +5286,7 @@ p_predicate_erased_statistics(void)
Yap_unify(ARG5,MkIntegerTerm(isz)); Yap_unify(ARG5,MkIntegerTerm(isz));
} }
static int static Int
p_program_continuation(void) p_program_continuation(void)
{ {
PredEntry *pe = EnvPreg(((CELL *)ENV[E_E])[E_CP]); PredEntry *pe = EnvPreg(((CELL *)ENV[E_E])[E_CP]);

View File

@ -263,7 +263,8 @@ do_execute_n(Term t, Term mod, unsigned int n)
Atom Name; Atom Name;
register CELL *pt; register CELL *pt;
PredEntry *pen; PredEntry *pen;
unsigned int i, arity, j = -n; unsigned int i, arity;
int j = -n;
restart_exec: restart_exec:
if (IsVarTerm(t)) { if (IsVarTerm(t)) {

View File

@ -11,8 +11,13 @@
* File: gprof.c * * File: gprof.c *
* comments: Interrupt Driven Profiler * * comments: Interrupt Driven Profiler *
* * * *
* Last rev: $Date: 2006-01-17 14:10:40 $,$Author: vsc $ * * Last rev: $Date: 2006-02-01 13:28:56 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.3 2006/01/17 14:10:40 vsc
* YENV may be an HW register (breaks some tabling code)
* All YAAM instructions are now brackedted, so Op introduced an { and EndOp introduces an }. This is because Ricardo assumes that.
* Fix attvars when COROUTING is undefined.
*
* Revision 1.2 2005/12/23 00:20:13 vsc * Revision 1.2 2005/12/23 00:20:13 vsc
* updates to gprof * updates to gprof
* support for __POWER__ * support for __POWER__
@ -905,7 +910,7 @@ prof_alrm(int signo, siginfo_t *si, void *scv)
ProfCalls++; ProfCalls++;
if (Yap_PrologMode & TestMode) { if (Yap_PrologMode & TestMode) {
if (Yap_OffLineProfiler) { if (Yap_OffLineProfiler) {
fprintf(FProf,"%p %p\n", (void *) (Yap_PrologMode & TestMode), P); fprintf(FProf,"%p %p\n", (void *) ((CELL)Yap_PrologMode & TestMode), P);
ProfOn = FALSE; ProfOn = FALSE;
return; return;
} }

View File

@ -4142,7 +4142,7 @@ format(volatile Term otail, volatile Term oargs, int sno)
if (IsIntegerTerm(t)) { if (IsIntegerTerm(t)) {
Int il = IntegerOfTerm(t); Int il = IntegerOfTerm(t);
#if HAVE_SNPRINTF #if HAVE_SNPRINTF
snprintf(tmp1, 256, "%d", il); snprintf(tmp1, 256, "%ld", il);
#else #else
sprintf(tmp1, "%ld", (long int)il); sprintf(tmp1, "%ld", (long int)il);
#endif #endif

View File

@ -1812,7 +1812,7 @@ static int subsumes_complex(register CELL *pt0, register CELL *pt0_end, register
pt0_end = to_visit[1]; pt0_end = to_visit[1];
pt1 = to_visit[2]; pt1 = to_visit[2];
*pt0 = (CELL)to_visit[3]; *pt0 = (CELL)to_visit[3];
write_mode = (int)to_visit[4]; write_mode = (Int)to_visit[ 4];
to_visit += 5; to_visit += 5;
#else #else
pt0 = to_visit[0]; pt0 = to_visit[0];

View File

@ -10,7 +10,7 @@
* File: Regs.h * * File: Regs.h *
* mods: * * mods: *
* comments: YAP abstract machine registers * * comments: YAP abstract machine registers *
* version: $Id: Regs.h,v 1.34 2006-01-17 22:50:10 tiagosoares Exp $ * * version: $Id: Regs.h,v 1.35 2006-02-01 13:28:56 vsc Exp $ *
*************************************************************************/ *************************************************************************/
@ -30,6 +30,11 @@
#undef PUSH_X #undef PUSH_X
#endif #endif
#ifdef __x86_64__
#undef PUSH_REGS
#undef PUSH_X
#endif
#if defined(sparc) || defined(__sparc) #if defined(sparc) || defined(__sparc)
#undef PUSH_REGS #undef PUSH_REGS
#undef PUSH_X #undef PUSH_X

View File

@ -84,6 +84,14 @@ register struct yami* P1REG asm ("bp"); /* can't use yamop before Yap.h */
#endif /* BP_FREE */ #endif /* BP_FREE */
#endif /* i386 */ #endif /* i386 */
#ifdef __x86_64__
#define SHADOW_P 1
#define SHADOW_REGS 1
#define SHADOW_S 1
#define Y_IN_MEM 1
#define TR_IN_MEM 1
#endif /* __x86_64__ */
#else /* other compilers */ #else /* other compilers */
#define S_IN_MEM 1 #define S_IN_MEM 1

View File

@ -1,4 +1,4 @@
/* $Id: jpl.c,v 1.8 2005-05-25 18:18:00 vsc Exp $ /* $Id: jpl.c,v 1.9 2006-02-01 13:28:56 vsc Exp $
Part of JPL -- SWI-Prolog/Java interface Part of JPL -- SWI-Prolog/Java interface
@ -1908,7 +1908,7 @@ jni_create_jvm_c(
// opt[optn].optionString = "abort"; // I don't understand this yet... // opt[optn].optionString = "abort"; // I don't understand this yet...
// opt[optn++].extraInfo = jvm_abort; // opt[optn++].extraInfo = jvm_abort;
// opt[optn++].optionString = "-Xcheck:jni"; // extra checking of JNI calls // opt[optn++].optionString = "-Xcheck:jni"; // extra checking of JNI calls
opt[optn++].optionString = "-Xmx1024m"; // give java enough space opt[optn++].optionString = "-Xmx1512m"; // give java enough space
// opt[optn++].optionString = "-Xnoclassgc"; // so method/field IDs remain valid (?) // opt[optn++].optionString = "-Xnoclassgc"; // so method/field IDs remain valid (?)
// opt[optn].optionString = "vfprintf"; // opt[optn].optionString = "vfprintf";
// opt[optn++].extraInfo = fprintf; // no O/P, then SEGV // opt[optn++].extraInfo = fprintf; // no O/P, then SEGV

View File

@ -16,6 +16,9 @@
<h2>Yap-5.1.0:</h2> <h2>Yap-5.1.0:</h2>
<ul> <ul>
<li> FIXED: bignum was using int where should be long int (Roberto Bagnara).</li>
<li> NEW: x86_64 should have registers, right? First cut at using them.</li>
<li> FIXED: call_n would break under 64 bits, an int problem.</li>
<li> FIXED: more compilation problems if GMP not there (Remko Troncon).</li> <li> FIXED: more compilation problems if GMP not there (Remko Troncon).</li>
<li> FIXED: make syntax error report the line where the bug was (Jude Shavlik).</li> <li> FIXED: make syntax error report the line where the bug was (Jude Shavlik).</li>
<li> FIXED: ok, MkBigInt shouldn't free the bigint.</li> <li> FIXED: ok, MkBigInt shouldn't free the bigint.</li>

View File

@ -25,6 +25,9 @@
:- multifile :- multifile
prolog:message/3. prolog:message/3.
:- dynamic
prolog:message/3.
:- multifile :- multifile
user:file_search_path/2. user:file_search_path/2.

View File

@ -1260,7 +1260,7 @@ PL_create_engine(const PL_thread_attr_t *attr)
X_API int X_API int
PL_destroy_engine(PL_engine_t e) PL_destroy_engine(PL_engine_t e)
{ {
return YAP_ThreadDestroyEngine((int)e); return YAP_ThreadDestroyEngine((YAP_Int)e);
} }
X_API int X_API int