summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Djurfeldt <djurfeldt@nada.kth.se>2000-03-14 06:43:57 +0000
committerMikael Djurfeldt <djurfeldt@nada.kth.se>2000-03-14 06:43:57 +0000
commit16d35552c42ddf2aab05256c0721ebf5a2512ca7 (patch)
tree6b3ddc8c5a08bdb99586de9e2ac8b7be098bb00b
parent950cc72b8f2e9636de633d01975cb1c41e4ab1af (diff)
downloadguile-16d35552c42ddf2aab05256c0721ebf5a2512ca7.tar.gz
*** empty log message ***
-rw-r--r--libguile/ChangeLog97
-rw-r--r--libguile/__scm.h2
-rw-r--r--libguile/gc.h9
-rw-r--r--libguile/gh.h6
-rw-r--r--libguile/gh_data.c16
-rw-r--r--libguile/init.c10
-rw-r--r--libguile/smob.c16
7 files changed, 118 insertions, 38 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index edb998e55..daabab503 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,100 @@
+2000-03-14 Mikael Djurfeldt <mdj@thalamus.nada.kth.se>
+
+ * Makefile.am (libguile_la_LDFLAGS): Bumped library version
+ number.
+
+ * __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
+ numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
+ rewrite of handling of real and complex numbers.
+ (SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
+ removed along with the support for floats. (Float vectors are
+ still supported.)
+
+ * tags.h (scm_tcs_bignums): Removed.
+ (scm_tc16_bigpos, scm_tc16_bigneg): Replaced by scm_tc16_big.
+ Use SCM_BIGSIGN(x) to test for sign!
+ (scm_tc16_big): The new bignum type.
+ (SCM_REAL_PART, SCM_IMAG_PART): Removed.
+
+ * numbers.h (SCM_BIGSIGN): Sign moved to bit 16.
+ (scm_makdbl): Deprecated.
+ (SCM_NEWREAL, SCM_NEWCOMPLEX): New macros.
+ (SCM_SINGP): Deprecated.
+ (SCM_FLO): Removed.
+ (SCM_INEXP, SCM_CPLXP): Deprecated.
+ (SCM_INEXACTP, SCM_COMPLEXP): New macros.
+ (SCM_COMPLEX_REAL, SCM_COMPLEX_IMAG): Renamed from
+ SCM_REAL, SCM_IMAG (and now only valid for complex numbers).
+ (SCM_REAL, SCM_IMAG): New, *deprecated*, selectors which work both
+ for doubles and complex numbers.
+ (SCM_REAL_VALUE): New selector for doubles.
+ (scm_double_t, scm_complex_t): New types.
+ (scm_dbl): Removed.
+
+ * numbers.c (scm_floprint, scm_floequal): Removed.
+ (scm_print_real, scm_print_complex, scm_real_equalp,
+ scm_complex_equalp): New functions.
+
+ * unif.c (scm_makflo): Removed.
+
+ * smob.h (SCM_SMOB_PREDICATE): New macro.
+ (SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2, SCM_NEWSMOB3,
+ SCM_RETURN_NEWSMOB3): New macros.
+
+1999-11-21 Michael Livshin <mlivshin@bigfoot.com>
+
+ The following changes implement primitive support for double cells
+ (i.e. four-word cells) and change the representation of some
+ things to multi-cells instead of cons+malloc. (Applied and
+ modified by mdj.)
+
+ * pairs.h (SCM_NEWCELL2): double-cell variants of SCM_NEWCELL.
+ (SCM_CELL_WORD, SCM_CELL_WORDLOC, SCM_SET_CELL_WORD): primitive
+ multi-cell access macros (used by the ones below).
+ (SCM_CELL_WORD[0-3], SCM_SET_CELL_WORD[0-3]): multi-cell access
+ macros.
+
+ * gc.c (scm_freelist2): multi-cell freelists.
+ (inner_map_free_list): map_free_list, parameterized on ncells.
+ "nn cells in segment mm" was misleading for ncells > 1; changed to
+ "objects". still print cells too, though.
+ (scm_map_free_list): rewritten using inner_map_free_list.
+ (scm_check_freelist): get freelist as parameter, since now we have
+ more than one.
+ (scm_debug_newcell2): multi-cell variants of
+ scm_debug_newcell.
+ (scm_gc_for_newcell): take ncells and freelist pointer as
+ parameters.
+ (scm_gc_mark): add case for tc7_pws (procedures with setters are
+ now double cells).
+ (scm_gc_sweep): don't free the float data, since it's not malloced
+ anymore.
+ (init_heap_seg): didn't understand what n_new_objects stood for,
+ so changed to n_new_cells.
+ (make_initial_segment): new function, makes an initial segment
+ according to given ncells.
+ (scm_init_storage): call make_initial_segment, for ncells={1,2,3}.
+
+ * numbers.c (scm_makdbl): no malloc'ing needed, so the
+ {DEFER,ALLOW}_INTS thing removed.
+
+ * numbers.h (struct scm_dbl): changed to represent a double cell,
+ with the number in the second half.
+ (struct scm_cplx): new, represents a complex number as a triple
+ cell.
+
+ * dynwind.c: changed the wind-guards representation to double
+ cell.
+
+ * procs.c, procs.h: changed the procedure-with-setter representation
+ to double cell.
+
+ * async.c, async.h: made async representation a double cell.
+
+ * guardians.c: made guardian representation a triple cell.
+
+ * dynl.c: made dynamic_obj representation a double cell.
+
2000-03-13 Gary Houston <ghouston@arglist.com>
* ports.c (flush_void_port): renamed to flush_port_default.
diff --git a/libguile/__scm.h b/libguile/__scm.h
index aab659c25..1a1b6702d 100644
--- a/libguile/__scm.h
+++ b/libguile/__scm.h
@@ -48,7 +48,7 @@
* These may be defined or undefined.
*/
-#define GUILE_DEBUG_FREELIST
+/* #define GUILE_DEBUG_FREELIST */
/* If the compile FLAG `SCM_CAUTIOUS' is #defined then the number of
* arguments is always checked for application of closures. If the
diff --git a/libguile/gc.h b/libguile/gc.h
index 797fe487f..084d27f55 100644
--- a/libguile/gc.h
+++ b/libguile/gc.h
@@ -2,7 +2,7 @@
#ifndef GCH
#define GCH
-/* Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 96, 98, 99, 2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -71,6 +71,7 @@ extern int scm_gc_heap_lock;
extern unsigned long scm_heap_size;
extern SCM_CELLPTR scm_heap_org;
extern SCM scm_freelist;
+extern SCM scm_freelist2;
extern unsigned long scm_gc_cells_collected;
extern unsigned long scm_gc_malloc_collected;
extern unsigned long scm_gc_ports_collected;
@@ -81,6 +82,7 @@ extern unsigned long scm_mtrigger;
#ifdef GUILE_DEBUG_FREELIST
extern SCM scm_map_free_list (void);
extern SCM scm_debug_newcell (void);
+extern SCM scm_debug_newcell2 (void);
extern SCM scm_gc_set_debug_check_freelist_x (SCM flag);
#endif
@@ -93,7 +95,7 @@ extern void scm_gc_start (const char *what);
extern void scm_gc_end (void);
extern SCM scm_gc (void);
extern void scm_gc_for_alloc (int ncells, SCM * freelistp);
-extern SCM scm_gc_for_newcell (void);
+extern SCM scm_gc_for_newcell (int ncells, SCM * freelistp);
extern void scm_igc (const char *what);
extern void scm_gc_mark (SCM p);
extern void scm_mark_locations (SCM_STACKITEM x[], scm_sizet n);
@@ -111,6 +113,7 @@ extern int scm_return_first_int (int x, ...);
extern SCM scm_permanent_object (SCM obj);
extern SCM scm_protect_object (SCM obj);
extern SCM scm_unprotect_object (SCM obj);
-extern int scm_init_storage (scm_sizet init_heap_size);
+extern int scm_init_storage (scm_sizet init_heap_size,
+ scm_sizet init_heap2_size);
extern void scm_init_gc (void);
#endif /* GCH */
diff --git a/libguile/gh.h b/libguile/gh.h
index 1d7e249aa..32e1d27d0 100644
--- a/libguile/gh.h
+++ b/libguile/gh.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998, 2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -114,13 +114,9 @@ SCM gh_chars2byvect(char *d, int n);
SCM gh_shorts2svect(short *d, int n);
SCM gh_longs2ivect(long *d, int n);
SCM gh_ulongs2uvect(unsigned long *d, int n);
-#ifdef SCM_FLOATS
-#ifdef SCM_SINGLES
SCM gh_floats2fvect(float *d, int n);
-#endif
SCM gh_doubles2dvect(double *d, int n);
#endif
-#endif
SCM gh_doubles2scm(double *d, int n);
diff --git a/libguile/gh_data.c b/libguile/gh_data.c
index 986bd55e3..39d467c63 100644
--- a/libguile/gh_data.c
+++ b/libguile/gh_data.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998, 1999, 2000 Free Software Foundation, Inc.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
@@ -203,8 +203,6 @@ gh_ulongs2uvect (unsigned long *d, int n)
return makvect (m, n, scm_tc7_uvect);
}
-#ifdef SCM_FLOATS
-#ifdef SCM_SINGLES
SCM
gh_floats2fvect (float *d, int n)
{
@@ -212,7 +210,6 @@ gh_floats2fvect (float *d, int n)
memcpy (m, d, n * sizeof (float));
return makvect (m, n, scm_tc7_fvect);
}
-#endif
SCM
gh_doubles2dvect (double *d, int n)
@@ -222,7 +219,6 @@ gh_doubles2dvect (double *d, int n)
return makvect (m, n, scm_tc7_dvect);
}
#endif
-#endif
/* data conversion scheme->C */
int
@@ -430,15 +426,13 @@ gh_scm2floats (SCM obj, float *m)
}
break;
#ifdef HAVE_ARRAYS
-#ifdef SCM_FLOATS
-#ifdef SCM_SINGLES
case scm_tc7_fvect:
n = SCM_LENGTH (obj);
if (m == 0)
m = (float *) malloc (n * sizeof (float));
memcpy (m, (float *) SCM_VELTS (obj), n * sizeof (float));
break;
-#endif
+
case scm_tc7_dvect:
n = SCM_LENGTH (obj);
if (m == 0)
@@ -447,7 +441,6 @@ gh_scm2floats (SCM obj, float *m)
m[i] = ((double *) SCM_VELTS (obj))[i];
break;
#endif
-#endif
default:
scm_wrong_type_arg (0, 0, obj);
}
@@ -489,8 +482,6 @@ gh_scm2doubles (SCM obj, double *m)
}
break;
#ifdef HAVE_ARRAYS
-#ifdef SCM_FLOATS
-#ifdef SCM_SINGLES
case scm_tc7_fvect:
n = SCM_LENGTH (obj);
if (m == 0)
@@ -498,7 +489,7 @@ gh_scm2doubles (SCM obj, double *m)
for (i = 0; i < n; ++i)
m[i] = ((float *) SCM_VELTS (obj))[i];
break;
-#endif
+
case scm_tc7_dvect:
n = SCM_LENGTH (obj);
if (m == 0)
@@ -506,7 +497,6 @@ gh_scm2doubles (SCM obj, double *m)
memcpy (m, SCM_VELTS (obj), n * sizeof (double));
break;
#endif
-#endif
default:
scm_wrong_type_arg (0, 0, obj);
}
diff --git a/libguile/init.c b/libguile/init.c
index 91391ab2a..ef97770e4 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999, 2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -219,12 +219,6 @@ check_config (void)
if (HEAP_SEG_SIZE != j)
fixconfig ("reduce", "size of HEAP_SEG_SIZE", 0);
-#ifdef SCM_SINGLES
- if (sizeof (float) != sizeof (long))
- fixconfig (remsg, "SCM_SINGLES", 0);
-#endif /* def SCM_SINGLES */
-
-
#ifdef SCM_BIGDIG
if (2 * SCM_BITSPERDIG / SCM_CHAR_BIT > sizeof (long))
fixconfig (remsg, "SCM_BIGDIG", 0);
@@ -465,7 +459,7 @@ scm_boot_guile_1 (SCM_STACKITEM *base, struct main_func_closure *closure)
scm_ports_prehistory ();
scm_smob_prehistory ();
scm_tables_prehistory ();
- scm_init_storage (0);
+ scm_init_storage (0, 0);
scm_init_subr_table ();
scm_init_root ();
#ifdef USE_THREADS
diff --git a/libguile/smob.c b/libguile/smob.c
index 0e0eeb138..f4947a032 100644
--- a/libguile/smob.c
+++ b/libguile/smob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -266,14 +266,14 @@ scm_smob_prehistory ()
scm_make_smob_type_mfpe ("free", 0,
NULL, NULL, freeprint, NULL);
- scm_make_smob_type_mfpe ("flo", 0, /* freed in gc */
- NULL, NULL, scm_floprint, scm_floequal);
-
- scm_make_smob_type_mfpe ("bigpos", 0, /* freed in gc */
+ scm_make_smob_type_mfpe ("big", 0, /* freed in gc */
NULL, NULL, scm_bigprint, scm_bigequal);
- scm_make_smob_type_mfpe ("bigneg", 0,
- NULL, NULL, scm_bigprint, scm_bigequal);
+ scm_make_smob_type_mfpe ("real", 0, /* freed in gc */
+ NULL, NULL, scm_print_real, scm_real_equalp);
+
+ scm_make_smob_type_mfpe ("complex", 0, /* freed in gc */
+ NULL, NULL, scm_print_complex, scm_complex_equalp);
- scm_make_smob_type("allocated", 0);
+ scm_make_smob_type ("allocated", 0);
}