1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

* Incorporated fixes to interrupt deferring/allowing from Niibe.

* Added SCM_DEBUG_INTERRUPTS as a debugging option.
This commit is contained in:
Dirk Herrmann 2001-04-17 09:15:39 +00:00
parent ac16426b15
commit 216eedfcae
7 changed files with 91 additions and 52 deletions

View file

@ -1,3 +1,53 @@
2001-04-17 Niibe Yutaka <gniibe@m17n.org>
* srcprop.c (scm_make_srcprops): Added SCM_ALLOW_INTS which
matches SCM_DEFER_INTS at the beginning of the function.
* mallocs.c (scm_malloc_obj): Remove un-matched SCM_ALLOW_INTS.
* gc.c (scm_igc): Unconditionally call
SCM_CRITICAL_SECTION_START/END.
* fluids.c (next_fluid_num): Unconditionally call
SCM_CRITICAL_SECTION_START/END.
(s_scm_make_fluid): Remove un-matched SCM_DEFER_INTS.
* coop-defs.h (SCM_THREAD_DEFER, SCM_THREAD_ALLOW,
SCM_THREAD_REDEFER, SCM_THREAD_REALLOW_1, SCM_THREAD_REALLOW_2):
Removed.
* __scm.h (SCM_CRITICAL_SECTION_START, SCM_CRITICAL_SECTION_END):
Defined as nothing for the case of !defined(USE_THREADS).
(SCM_THREAD_DEFER, SCM_THREAD_ALLOW, SCM_THREAD_REDEFER):
Removed.
(<stdio.h>): Include when (SCM_DEBUG_INTERRUPTS == 1).
(SCM_CHECK_NOT_DISABLED, SCM_CHECK_NOT_ENABLED): Print FILE and
LINE.
(SCM_DEFER_INTS, SCM_ALLOW_INTS_ONLY, SCM_ALLOW_INTS,
SCM_REDEFER_INTS, SCM_REALLOW_INTS): Don't use
SCM_THREAD_DEFER/SCM_THREAD_ALLOW. Instead, use
SCM_CRITICAL_SECTION_START/END.
(SCM_REALLOW_INTS: Bug fix. Don't call
SCM_THREAD_SWITCHING_CODE.
(SCM_TICK): Don't use SCM_DEFER_INTS/SCM_ALLOW_INTS. Instead, use
SCM_THREAD_SWITCHING_CODE directly.
(SCM_ENTER_A_SECTION): Unconditionally use
SCM_CRITICAL_SECTION_START/END. (was:
SCM_DEFER_INTS/SCM_ALLOW_INTS when SCM_POSIX_THREADS defined).
2001-04-17 Dirk Herrmann <D.Herrmann@tu-bs.de>
* __scm.h (SCM_CAREFUL_INTS, SCM_DEBUG_INTERRUPTS): Replaced the
macro SCM_CAREFUL_INTS by the macro SCM_DEBUG_INTERRUPTS and
allowed to explicitly set this macro via the CFLAGS variable
during make.
* fluids.c (next_fluid_num), gc.c (scm_igc), coop-defs.h
(SCM_THREAD_CRITICAL_SECTION_START,
SCM_THREAD_CRITICAL_SECTION_END): Renamed
SCM_THREAD_CRITICAL_SECTION_START/END to
SCM_CRITICAL_SECTION_START/END.
2001-04-11 Keisuke Nishida <kxn30@po.cwru.edu>
* debug-malloc.c (grow, scm_debug_malloc_prehistory): Use memset

View file

@ -100,7 +100,6 @@
*/
#undef ENGNOT
#undef SCM_CAREFUL_INTS
/* {Unsupported Options}
*
@ -171,6 +170,13 @@
#define SCM_DEBUG_DEPRECATED SCM_DEBUG
#endif
/* If SCM_DEBUG_INTERRUPTS is set to 1, with every deferring and allowing of
* interrupts a consistency check will be performed.
*/
#ifndef SCM_DEBUG_INTERRUPTS
#define SCM_DEBUG_INTERRUPTS SCM_DEBUG
#endif
/* If SCM_DEBUG_REST_ARGUMENT is set to 1, functions that take rest arguments
* will check whether the rest arguments are actually passed as a proper list.
* Otherwise, if SCM_DEBUG_REST_ARGUMENT is 0, functions that take rest
@ -319,9 +325,8 @@ typedef long SCM_STACKITEM;
#ifndef USE_THREADS
#define SCM_THREAD_DEFER
#define SCM_THREAD_ALLOW
#define SCM_THREAD_REDEFER
#define SCM_CRITICAL_SECTION_START
#define SCM_CRITICAL_SECTION_END
#define SCM_THREAD_SWITCHING_CODE
#endif
@ -343,14 +348,21 @@ do { \
} while (0)
#endif
#ifdef SCM_CAREFUL_INTS
#if (SCM_DEBUG_INTERRUPTS == 1)
#include <stdio.h>
#define SCM_CHECK_NOT_DISABLED \
if (scm_ints_disabled) \
fputs("ints already disabled\n", stderr); \
do { \
if (scm_ints_disabled) \
fprintf(stderr, "ints already disabled (at %s:%d)\n", \
__FILE__, __LINE__); \
} while (0)
#define SCM_CHECK_NOT_ENABLED \
if (!scm_ints_disabled) \
fputs("ints already enabled\n", stderr); \
do { \
if (!scm_ints_disabled) \
fprintf(stderr, "ints already enabled (at %s:%d)\n", \
__FILE__, __LINE__); \
} while (0)
#else
#define SCM_CHECK_NOT_DISABLED
@ -383,7 +395,7 @@ do { \
do { \
SCM_FENCE; \
SCM_CHECK_NOT_DISABLED; \
SCM_THREAD_DEFER; \
SCM_CRITICAL_SECTION_START; \
SCM_FENCE; \
scm_ints_disabled = 1; \
SCM_FENCE; \
@ -392,7 +404,7 @@ do { \
#define SCM_ALLOW_INTS_ONLY \
do { \
SCM_THREAD_ALLOW; \
SCM_CRITICAL_SECTION_END; \
scm_ints_disabled = 0; \
} while (0)
@ -401,11 +413,11 @@ do { \
do { \
SCM_FENCE; \
SCM_CHECK_NOT_ENABLED; \
SCM_THREAD_SWITCHING_CODE; \
SCM_CRITICAL_SECTION_END; \
SCM_FENCE; \
scm_ints_disabled = 0; \
SCM_FENCE; \
SCM_THREAD_ALLOW; \
SCM_THREAD_SWITCHING_CODE; \
SCM_FENCE; \
} while (0)
@ -413,7 +425,7 @@ do { \
#define SCM_REDEFER_INTS \
do { \
SCM_FENCE; \
SCM_THREAD_REDEFER; \
SCM_CRITICAL_SECTION_START; \
++scm_ints_disabled; \
SCM_FENCE; \
} while (0)
@ -422,7 +434,7 @@ do { \
#define SCM_REALLOW_INTS \
do { \
SCM_FENCE; \
SCM_THREAD_SWITCHING_CODE; \
SCM_CRITICAL_SECTION_END; \
SCM_FENCE; \
--scm_ints_disabled; \
SCM_FENCE; \
@ -431,9 +443,8 @@ do { \
#define SCM_TICK \
do { \
SCM_DEFER_INTS; \
SCM_ALLOW_INTS; \
SCM_ASYNC_TICK; \
SCM_THREAD_SWITCHING_CODE; \
} while (0)
@ -466,13 +477,8 @@ do { \
* at all times.
*/
#ifdef SCM_POSIX_THREADS
#define SCM_ENTER_A_SECTION
#define SCM_EXIT_A_SECTION
#else
#define SCM_ENTER_A_SECTION SCM_DEFER_INTS
#define SCM_EXIT_A_SECTION SCM_ALLOW_INTS
#endif
#define SCM_ENTER_A_SECTION SCM_CRITICAL_SECTION_START
#define SCM_EXIT_A_SECTION SCM_CRITICAL_SECTION_END

View file

@ -3,7 +3,7 @@
#ifndef COOP_DEFSH
#define COOP_DEFSH
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1996,1997,1998,1999,2000,2001 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
@ -235,8 +235,8 @@ extern coop_t *coop_wait_for_runnable_thread (void);
/* Cooperative threads don't need to have these defined */
#define SCM_THREAD_CRITICAL_SECTION_START
#define SCM_THREAD_CRITICAL_SECTION_END
#define SCM_CRITICAL_SECTION_START
#define SCM_CRITICAL_SECTION_END
@ -245,12 +245,6 @@ extern coop_t *coop_wait_for_runnable_thread (void);
#define SCM_THREAD_DEFER
#define SCM_THREAD_ALLOW
#define SCM_THREAD_REDEFER
#define SCM_THREAD_REALLOW_1
#define SCM_THREAD_REALLOW_2
#if 0
#define SCM_THREAD_SWITCHING_CODE \
do { \

View file

@ -107,13 +107,9 @@ static int
next_fluid_num ()
{
int n;
#ifdef USE_THREADS
SCM_THREAD_CRITICAL_SECTION_START;
#endif
SCM_CRITICAL_SECTION_START;
n = n_fluids++;
#ifdef USE_THREADS
SCM_THREAD_CRITICAL_SECTION_END;
#endif
SCM_CRITICAL_SECTION_END;
return n;
}
@ -130,7 +126,6 @@ SCM_DEFINE (scm_make_fluid, "make-fluid", 0, 0, 0,
{
int n;
SCM_DEFER_INTS;
n = next_fluid_num ();
SCM_RETURN_NEWSMOB (scm_tc16_fluid, n);
}

View file

@ -1001,10 +1001,8 @@ scm_igc (const char *what)
? "*"
: (SCM_NULLP (scm_freelist2) ? "o" : "m"));
#endif
#ifdef USE_THREADS
/* During the critical section, only the current thread may run. */
SCM_THREAD_CRITICAL_SECTION_START;
#endif
SCM_CRITICAL_SECTION_START;
/* fprintf (stderr, "gc: %s\n", what); */
@ -1102,9 +1100,7 @@ scm_igc (const char *what)
--scm_gc_heap_lock;
gc_end_stats ();
#ifdef USE_THREADS
SCM_THREAD_CRITICAL_SECTION_END;
#endif
SCM_CRITICAL_SECTION_END;
scm_c_hook_run (&scm_after_gc_c_hook, 0);
--scm_gc_running_p;
}

View file

@ -1,5 +1,5 @@
/* classes: src_files
* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
* Copyright (C) 1995,1997,1998,2000,2001 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
@ -64,10 +64,7 @@ scm_malloc_obj (scm_sizet n)
{
scm_bits_t mem = n ? (scm_bits_t) malloc (n) : 0;
if (n && !mem)
{
SCM_ALLOW_INTS;
return SCM_BOOL_F;
}
return SCM_BOOL_F;
SCM_RETURN_NEWSMOB (scm_tc16_malloc, mem);
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 Free Software Foundation
*
* 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
@ -148,6 +148,7 @@ scm_make_srcprops (int line, int col, SCM filename, SCM copy, SCM plist)
ptr->fname = filename;
ptr->copy = copy;
ptr->plist = plist;
SCM_ALLOW_INTS;
SCM_RETURN_NEWSMOB (scm_tc16_srcprops, ptr);
}