core: Support x86_64.

* src/lib.c: Support x86_64.
* src/math.c: Likewise.
* src/mes.c: Likewise.
* src/reader.c: Likewise.
* src/vector.c Likewise.
This commit is contained in:
Jan Nieuwenhuizen 2018-10-04 21:43:45 +02:00
parent a2502ac96c
commit 133013a3d2
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
6 changed files with 26 additions and 25 deletions

View File

@ -157,4 +157,5 @@ bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/malloc
##sh ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/tiny-mes
# bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/mini-mes
bash ${srcdest}build-aux/cc-x86_64-mes.sh src/mes
cp src/mes.x86_64-mes-out src/mes
# not yet, broken
# cp src/mes.x86_64-mes-out src/mes

View File

@ -37,7 +37,7 @@ display_helper (SCM x, int cont, char* sep, int fd, int write_p)
else
{
fdputs ("#\\", fd);
int v = VALUE (x);
long v = VALUE (x);
if (v == '\0') fdputs ("nul", fd);
else if (v == '\a') fdputs ("alarm", fd);
else if (v == '\b') fdputs ("backspace", fd);
@ -139,7 +139,7 @@ display_helper (SCM x, int cont, char* sep, int fd, int write_p)
SCM t = CAR (x);
while (t && t != cell_nil)
{
int v = write_p ? VALUE (CAR (t)) : -1;
long v = write_p ? VALUE (CAR (t)) : -1;
if (v == '\0') fdputs ("\\0", fd);
else if (v == '\a') fdputs ("\\a", fd);
else if (v == '\b') fdputs ("\\b", fd);
@ -170,7 +170,7 @@ display_helper (SCM x, int cont, char* sep, int fd, int write_p)
{
fdputs ("#(", fd);
SCM t = CAR (x);
for (int i = 0; i < LENGTH (x); i++)
for (long i = 0; i < LENGTH (x); i++)
{
if (i)
fdputc (' ', fd);
@ -302,7 +302,7 @@ equal2_p (SCM a, SCM b)
{
if (LENGTH (a) != LENGTH (b))
return cell_f;
for (int i=0; i < LENGTH (a); i++)
for (long i=0; i < LENGTH (a); i++)
{
SCM ai = VECTOR (a) + i;
SCM bi = VECTOR (b) + i;

View File

@ -36,7 +36,7 @@ greater_p (SCM x) ///((name . ">") (arity . n))
if (x == cell_nil)
return cell_t;
assert_number ("greater_p", CAR (x));
int n = VALUE (CAR (x));
long n = VALUE (CAR (x));
x = CDR (x);
while (x != cell_nil)
{
@ -55,7 +55,7 @@ less_p (SCM x) ///((name . "<") (arity . n))
if (x == cell_nil)
return cell_t;
assert_number ("less_p", CAR (x));
int n = VALUE (CAR (x));
long n = VALUE (CAR (x));
x = CDR (x);
while (x != cell_nil)
{
@ -74,7 +74,7 @@ is_p (SCM x) ///((name . "=") (arity . n))
if (x == cell_nil)
return cell_t;
assert_number ("is_p", CAR (x));
int n = VALUE (CAR (x));
long n = VALUE (CAR (x));
x = cdr (x);
while (x != cell_nil)
{
@ -89,7 +89,7 @@ SCM
minus (SCM x) ///((name . "-") (arity . n))
{
assert_number ("minus", CAR (x));
int n = VALUE (CAR (x));
long n = VALUE (CAR (x));
x = cdr (x);
if (x == cell_nil)
n = -n;
@ -105,7 +105,7 @@ minus (SCM x) ///((name . "-") (arity . n))
SCM
plus (SCM x) ///((name . "+") (arity . n))
{
int n = 0;
long n = 0;
while (x != cell_nil)
{
assert_number ("plus", CAR (x));
@ -118,7 +118,7 @@ plus (SCM x) ///((name . "+") (arity . n))
SCM
divide (SCM x) ///((name . "/") (arity . n))
{
int n = 1;
long n = 1;
if (x != cell_nil)
{
assert_number ("divide", CAR (x));
@ -139,7 +139,7 @@ modulo (SCM a, SCM b)
{
assert_number ("modulo", a);
assert_number ("modulo", b);
int x = VALUE (a);
long x = VALUE (a);
while (x < 0) x += VALUE (b);
return MAKE_NUMBER (x % VALUE (b));
}
@ -147,7 +147,7 @@ modulo (SCM a, SCM b)
SCM
multiply (SCM x) ///((name . "*") (arity . n))
{
int n = 1;
long n = 1;
while (x != cell_nil)
{
assert_number ("multiply", CAR (x));
@ -160,7 +160,7 @@ multiply (SCM x) ///((name . "*") (arity . n))
SCM
logand (SCM x) ///((arity . n))
{
int n = 0;
long n = 0;
while (x != cell_nil)
{
assert_number ("multiply", CAR (x));
@ -173,7 +173,7 @@ logand (SCM x) ///((arity . n))
SCM
logior (SCM x) ///((arity . n))
{
int n = 0;
long n = 0;
while (x != cell_nil)
{
assert_number ("logior", CAR (x));
@ -187,14 +187,14 @@ SCM
lognot (SCM x)
{
assert_number ("lognot", x);
int n = ~VALUE (x);
long n = ~VALUE (x);
return MAKE_NUMBER (n);
}
SCM
logxor (SCM x) ///((arity . n))
{
int n = 0;
long n = 0;
while (x != cell_nil)
{
assert_number ("logxor", CAR (x));
@ -209,7 +209,7 @@ ash (SCM n, SCM count)
{
assert_number ("ash", n);
assert_number ("ash", count);
int cn = VALUE (n);
int ccount = VALUE (count);
long cn = VALUE (n);
long ccount = VALUE (count);
return MAKE_NUMBER ((ccount < 0) ? cn >> -ccount : cn << ccount);
}

View File

@ -39,7 +39,7 @@ char *g_arena = 0;
typedef long SCM;
int g_debug = 0;
int g_free = 0;
long g_free = 0;
SCM g_continuations = 0;
SCM g_symbols = 0;
@ -1029,7 +1029,7 @@ eval_apply ()
int global_p;
int macro_p;
int t;
int c;
long c;
eval_apply:
if (r3 == cell_vm_evlis) goto evlis;

View File

@ -507,7 +507,7 @@ dump ()
eputs ("\n");
}
int i;
long i;
for (i=0; i<g_free * sizeof (struct scm); i = i + 1)
{
putchar (p[0]);

View File

@ -19,11 +19,11 @@
*/
SCM
make_vector__ (int k)
make_vector__ (long k)
{
SCM v = alloc (k);
SCM x = make_cell__ (TVECTOR, k, v);
for (int i=0; i<k; i++)
for (long i=0; i<k; i++)
g_cells[v+i] = g_cells[vector_entry (cell_unspecified)];
return x;
}
@ -91,7 +91,7 @@ SCM
vector_to_list (SCM v)
{
SCM x = cell_nil;
for (int i = LENGTH (v); i; i--)
for (long i = LENGTH (v); i; i--)
{
SCM e = VECTOR (v)+i-1;
if (TYPE (e) == TREF)