mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
disable fileno unification by default
This commit is contained in:
parent
8fcd4d1f88
commit
4d22949f71
3 changed files with 23 additions and 5 deletions
|
@ -64,6 +64,15 @@
|
|||
/* if you suspect a bug in the native GC. */
|
||||
/* #define SEXP_USE_BOEHM 1 */
|
||||
|
||||
/* uncomment this to enable automatic file descriptor unification */
|
||||
/* File descriptors as returned by C functions are raw integers, */
|
||||
/* which are convereted to GC'ed first-class objects on the Scheme */
|
||||
/* side. By default we assume that each fd is new, however if this */
|
||||
/* option is enabled and an fd is returned which matches an existing */
|
||||
/* open fd, they are assumed to refer to the same descriptor and */
|
||||
/* unified. */
|
||||
/* #define SEXP_USE_UNIFY_FILENOS_BY_NUMBER 1 */
|
||||
|
||||
/* uncomment this to disable weak references */
|
||||
/* #define SEXP_USE_WEAK_REFERENCES 0 */
|
||||
|
||||
|
@ -464,9 +473,17 @@
|
|||
#define SEXP_USE_BOEHM 0
|
||||
#endif
|
||||
|
||||
#ifdef SEXP_USE_UNIFY_FILENOS_BY_NUMBER
|
||||
#define SEXP_USE_UNIFY_FILENOS_BY_NUMBER 0
|
||||
#endif
|
||||
|
||||
#ifndef SEXP_USE_WEAK_REFERENCES
|
||||
#if SEXP_USE_UNIFY_FILENOS_BY_NUMBER
|
||||
#define SEXP_USE_WEAK_REFERENCES 1
|
||||
#else
|
||||
#define SEXP_USE_WEAK_REFERENCES ! SEXP_USE_NO_FEATURES
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SEXP_USE_FIXED_CHUNK_SIZE_HEAPS
|
||||
#define SEXP_USE_FIXED_CHUNK_SIZE_HEAPS 0
|
||||
|
|
10
sexp.c
10
sexp.c
|
@ -1806,7 +1806,7 @@ sexp sexp_open_output_file_descriptor (sexp ctx, sexp self, sexp_sint_t n, sexp
|
|||
return res;
|
||||
}
|
||||
|
||||
#if SEXP_USE_WEAK_REFERENCES
|
||||
#if SEXP_USE_UNIFY_FILENOS_BY_NUMBER
|
||||
sexp sexp_make_ephemeron_op(sexp ctx, sexp self, sexp_sint_t n, sexp key, sexp value) {
|
||||
sexp res = sexp_alloc_type(ctx, pair, SEXP_EPHEMERON);
|
||||
if (!sexp_exceptionp(res)) {
|
||||
|
@ -1878,13 +1878,13 @@ static void sexp_insert_fileno(sexp ctx, sexp fileno) {
|
|||
n++;
|
||||
sexp_global(ctx, SEXP_G_NUM_FILE_DESCRIPTORS) = sexp_make_fixnum(n);
|
||||
}
|
||||
#endif
|
||||
#endif /* SEXP_USE_UNIFY_FILENOS_BY_NUMBER */
|
||||
|
||||
sexp sexp_make_fileno_op (sexp ctx, sexp self, sexp_sint_t n, sexp fd, sexp no_closep) {
|
||||
sexp_gc_var1(res);
|
||||
sexp_assert_type(ctx, sexp_fixnump, SEXP_FIXNUM, fd);
|
||||
if (sexp_unbox_fixnum(fd) < 0) return SEXP_FALSE;
|
||||
#if SEXP_USE_WEAK_REFERENCES
|
||||
#if SEXP_USE_UNIFY_FILENOS_BY_NUMBER
|
||||
res = sexp_lookup_fileno(ctx, sexp_unbox_fixnum(fd));
|
||||
if (sexp_filenop(res)) {
|
||||
sexp_fileno_no_closep(res) = sexp_truep(no_closep);
|
||||
|
@ -1898,7 +1898,7 @@ sexp sexp_make_fileno_op (sexp ctx, sexp self, sexp_sint_t n, sexp fd, sexp no_c
|
|||
sexp_fileno_fd(res) = sexp_unbox_fixnum(fd);
|
||||
sexp_fileno_openp(res) = 1;
|
||||
sexp_fileno_no_closep(res) = sexp_truep(no_closep);
|
||||
#if SEXP_USE_WEAK_REFERENCES
|
||||
#if SEXP_USE_UNIFY_FILENOS_BY_NUMBER
|
||||
sexp_insert_fileno(ctx, res);
|
||||
#endif
|
||||
}
|
||||
|
@ -1925,7 +1925,7 @@ sexp sexp_make_input_port (sexp ctx, FILE* in, sexp name) {
|
|||
#if SEXP_USE_FOLD_CASE_SYMS
|
||||
sexp_port_fold_casep(p) = sexp_truep(sexp_global(ctx, SEXP_G_FOLD_CASE_P));
|
||||
#endif
|
||||
#if SEXP_USE_WEAK_REFERENCES
|
||||
#if SEXP_USE_UNIFY_FILENOS_BY_NUMBER
|
||||
/* if the fd was previously opened by a non-stream port, preserve it */
|
||||
/* here to avoid gc timing issues */
|
||||
if (in && fileno(in) >= 0) {
|
||||
|
|
|
@ -25,6 +25,7 @@ CPPFLAGS=-DSEXP_USE_2010_EPOCH=0
|
|||
CPPFLAGS=-DSEXP_USE_CHECK_STACK=0
|
||||
CPPFLAGS=-DSEXP_USE_EXTENDED_FCALL=0
|
||||
CPPFLAGS=-DSEXP_USE_WEAK_REFERENCES=0
|
||||
CPPFLAGS=-DSEXP_USE_UNIFY_FILENOS_BY_NUMBER=1
|
||||
CPPFLAGS=-DSEXP_USE_OBJECT_BRACE_LITERALS=0
|
||||
CPPFLAGS=-DSEXP_USE_TAIL_JUMPS=0
|
||||
CPPFLAGS=-DSEXP_USE_RESERVE_OPCODE=0
|
||||
|
|
Loading…
Add table
Reference in a new issue