mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 12:20:26 +02:00
* async.h: kill the scm_async_t struct. having a heap cell
pretending to be a C struct is not helthy, and is not needed here anyway, as asyncs happily fit in one heap cell. * async.c: reflect the fact that asyncs are now represented by single heap cell each.
This commit is contained in:
parent
873c35ee82
commit
843e4e9d17
3 changed files with 49 additions and 51 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2000-04-04 Michael Livshin <mlivshin@bigfoot.com>
|
||||||
|
|
||||||
|
* async.h: kill the scm_async_t struct. having a heap cell
|
||||||
|
pretending to be a C struct is not helthy, and is not needed here
|
||||||
|
anyway, as asyncs happily fit in one heap cell.
|
||||||
|
|
||||||
|
* async.c: reflect the fact that asyncs are now represented by
|
||||||
|
single heap cell each.
|
||||||
|
|
||||||
2000-04-04 Gary Houston <ghouston@arglist.com>
|
2000-04-04 Gary Houston <ghouston@arglist.com>
|
||||||
|
|
||||||
* error.c (scm_syserror): save errno before doing anything else,
|
* error.c (scm_syserror): save errno before doing anything else,
|
||||||
|
@ -66,7 +75,7 @@
|
||||||
separate loop after processing all the currently known live
|
separate loop after processing all the currently known live
|
||||||
guardians, so as to not introduce order dependencies (thanks to
|
guardians, so as to not introduce order dependencies (thanks to
|
||||||
Gary Houston). note that the order problems are still there if
|
Gary Houston). note that the order problems are still there if
|
||||||
some guardians are themselves zombies, but that's a sick case that
|
some guardians are themselves zombies, but that's a sick case that
|
||||||
I'm not going to worry about.
|
I'm not going to worry about.
|
||||||
also, make another outer loop to process zombified
|
also, make another outer loop to process zombified
|
||||||
guardians (which are uncovered while marking zombies).
|
guardians (which are uncovered while marking zombies).
|
||||||
|
@ -104,7 +113,7 @@
|
||||||
|
|
||||||
* feature.c (print_hook), gc.c (scm_object_address), hash.c
|
* feature.c (print_hook), gc.c (scm_object_address), hash.c
|
||||||
(scm_ihashq, scm_ihashv), print.c (scm_iprin1, scm_ipruk), smob.c
|
(scm_ihashq, scm_ihashv), print.c (scm_iprin1, scm_ipruk), smob.c
|
||||||
(freeprint), struct.c (scm_print_struct): Must unpack
|
(freeprint), struct.c (scm_print_struct): Must unpack
|
||||||
SCM values to access their raw contents.
|
SCM values to access their raw contents.
|
||||||
|
|
||||||
* fluids.c (apply_thunk, scm_with_fluids), hashtab.c (fold_proc,
|
* fluids.c (apply_thunk, scm_with_fluids), hashtab.c (fold_proc,
|
||||||
|
@ -298,7 +307,7 @@
|
||||||
(coop_aborthelp): Free thread structures when threads die.
|
(coop_aborthelp): Free thread structures when threads die.
|
||||||
Finished LinuxThreads compatibility support => COOP threads now
|
Finished LinuxThreads compatibility support => COOP threads now
|
||||||
mesh with LinuxThreads.
|
mesh with LinuxThreads.
|
||||||
|
|
||||||
* coop-threads.c (scm_call_with_new_thread, scm_spawn_thread):
|
* coop-threads.c (scm_call_with_new_thread, scm_spawn_thread):
|
||||||
Changed SETCDR --> SET_CELL_WORD_1.
|
Changed SETCDR --> SET_CELL_WORD_1.
|
||||||
|
|
||||||
|
@ -323,7 +332,7 @@
|
||||||
SCM_DFRAME): Use SCM_CONTREGS instead of SCM_CHARS to access
|
SCM_DFRAME): Use SCM_CONTREGS instead of SCM_CHARS to access
|
||||||
continuation data.
|
continuation data.
|
||||||
|
|
||||||
* continuations.c (scm_make_cont), init.c (start_stack),
|
* continuations.c (scm_make_cont), init.c (start_stack),
|
||||||
root.c (scm_internal_cwdr): Use SCM_SET_CONTREGS instead of
|
root.c (scm_internal_cwdr): Use SCM_SET_CONTREGS instead of
|
||||||
SCM_SETJMPBUF.
|
SCM_SETJMPBUF.
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
/* Copyright (C) 1995, 96, 97, 98, 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 96, 97, 98, 2000 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
* any later version.
|
* any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this software; see the file COPYING. If not, write to
|
* along with this software; see the file COPYING. If not, write to
|
||||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
*
|
*
|
||||||
* Setting the mark guarantees future execution of the thunk. More
|
* Setting the mark guarantees future execution of the thunk. More
|
||||||
* than one set may be satisfied by a single execution.
|
* than one set may be satisfied by a single execution.
|
||||||
*
|
*
|
||||||
* scm_tick_clock decremented once per SCM_ALLOW_INTS.
|
* scm_tick_clock decremented once per SCM_ALLOW_INTS.
|
||||||
* Async execution triggered by SCM_ALLOW_INTS when scm_tick_clock drops to 0.
|
* Async execution triggered by SCM_ALLOW_INTS when scm_tick_clock drops to 0.
|
||||||
* Async execution prevented by scm_mask_ints != 0.
|
* Async execution prevented by scm_mask_ints != 0.
|
||||||
|
@ -122,11 +122,8 @@ scm_asyncs_pending ()
|
||||||
pos = scm_asyncs;
|
pos = scm_asyncs;
|
||||||
while (pos != SCM_EOL)
|
while (pos != SCM_EOL)
|
||||||
{
|
{
|
||||||
SCM a;
|
SCM a = SCM_CAR (pos);
|
||||||
struct scm_async * it;
|
if (SCM_ASYNC_GOT_IT (a))
|
||||||
a = SCM_CAR (pos);
|
|
||||||
it = SCM_ASYNC (a);
|
|
||||||
if (it->got_it)
|
|
||||||
return 1;
|
return 1;
|
||||||
pos = SCM_CDR (pos);
|
pos = SCM_CDR (pos);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +183,7 @@ scm_async_click ()
|
||||||
scm_async_clock = 1;
|
scm_async_clock = 1;
|
||||||
return;;
|
return;;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!scm_tick_rate)
|
if (!scm_tick_rate)
|
||||||
{
|
{
|
||||||
unsigned int r;
|
unsigned int r;
|
||||||
|
@ -219,7 +216,7 @@ scm_async_click ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (owe_tick)
|
if (owe_tick)
|
||||||
scm_async_mark (system_signal_asyncs[SCM_SIG_ORD(SCM_TICK_SIGNAL)]);
|
scm_async_mark (system_signal_asyncs[SCM_SIG_ORD(SCM_TICK_SIGNAL)]);
|
||||||
*/
|
*/
|
||||||
|
@ -286,23 +283,21 @@ scm_async_click ()
|
||||||
static SCM
|
static SCM
|
||||||
mark_async (SCM obj)
|
mark_async (SCM obj)
|
||||||
{
|
{
|
||||||
struct scm_async * it;
|
return SCM_ASYNC_THUNK (obj);
|
||||||
it = SCM_ASYNC (obj);
|
|
||||||
return it->thunk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_async, "async", 1, 0, 0,
|
SCM_DEFINE (scm_async, "async", 1, 0, 0,
|
||||||
(SCM thunk),
|
(SCM thunk),
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_async
|
#define FUNC_NAME s_scm_async
|
||||||
{
|
{
|
||||||
SCM_RETURN_NEWSMOB2 (scm_tc16_async, 0, SCM_UNPACK (thunk));
|
SCM_RETURN_NEWSMOB (scm_tc16_async, SCM_UNPACK (thunk));
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
SCM_DEFINE (scm_system_async, "system-async", 1, 0, 0,
|
SCM_DEFINE (scm_system_async, "system-async", 1, 0, 0,
|
||||||
(SCM thunk),
|
(SCM thunk),
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_system_async
|
#define FUNC_NAME s_scm_system_async
|
||||||
|
@ -319,37 +314,35 @@ SCM_DEFINE (scm_system_async, "system-async", 1, 0, 0,
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
SCM_DEFINE (scm_async_mark, "async-mark", 1, 0, 0,
|
SCM_DEFINE (scm_async_mark, "async-mark", 1, 0, 0,
|
||||||
(SCM a),
|
(SCM a),
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_async_mark
|
#define FUNC_NAME s_scm_async_mark
|
||||||
{
|
{
|
||||||
struct scm_async * it;
|
SCM_VALIDATE_ASYNC (1,a);
|
||||||
SCM_VALIDATE_ASYNC_COPY (1,a,it);
|
|
||||||
#ifdef GUILE_OLD_ASYNC_CLICK
|
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||||
it->got_it = 1;
|
SCM_SET_ASYNC_GOT_IT (a, 1);
|
||||||
#else
|
#else
|
||||||
scm_asyncs_pending_p = it->got_it = 1;
|
SCM_SET_ASYNC_GOT_IT (a, scm_asyncs_pending_p = 1);
|
||||||
#endif
|
#endif
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_system_async_mark, "system-async-mark", 1, 0, 0,
|
SCM_DEFINE (scm_system_async_mark, "system-async-mark", 1, 0, 0,
|
||||||
(SCM a),
|
(SCM a),
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_system_async_mark
|
#define FUNC_NAME s_scm_system_async_mark
|
||||||
{
|
{
|
||||||
struct scm_async *it;
|
SCM_VALIDATE_ASYNC (1, a);
|
||||||
SCM_VALIDATE_ASYNC_COPY (1, a, it);
|
|
||||||
SCM_REDEFER_INTS;
|
SCM_REDEFER_INTS;
|
||||||
#ifdef GUILE_OLD_ASYNC_CLICK
|
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||||
it->got_it = 1;
|
SCM_SET_ASYNC_GOT_IT (a, 1);
|
||||||
scm_async_rate = 1 + scm_async_rate - scm_async_clock;
|
scm_async_rate = 1 + scm_async_rate - scm_async_clock;
|
||||||
scm_async_clock = 1;
|
scm_async_clock = 1;
|
||||||
#else
|
#else
|
||||||
scm_asyncs_pending_p = it->got_it = 1;
|
SCM_SET_ASYNC_GOT_IT (a, scm_asyncs_pending_p = 1);
|
||||||
#endif
|
#endif
|
||||||
SCM_REALLOW_INTS;
|
SCM_REALLOW_INTS;
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
|
@ -357,7 +350,7 @@ SCM_DEFINE (scm_system_async_mark, "system-async-mark", 1, 0, 0,
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_run_asyncs, "run-asyncs", 1, 0, 0,
|
SCM_DEFINE (scm_run_asyncs, "run-asyncs", 1, 0, 0,
|
||||||
(SCM list_of_a),
|
(SCM list_of_a),
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_run_asyncs
|
#define FUNC_NAME s_scm_run_asyncs
|
||||||
|
@ -371,15 +364,14 @@ SCM_DEFINE (scm_run_asyncs, "run-asyncs", 1, 0, 0,
|
||||||
while (! SCM_NULLP (list_of_a))
|
while (! SCM_NULLP (list_of_a))
|
||||||
{
|
{
|
||||||
SCM a;
|
SCM a;
|
||||||
struct scm_async * it;
|
|
||||||
SCM_VALIDATE_CONS (1, list_of_a);
|
SCM_VALIDATE_CONS (1, list_of_a);
|
||||||
a = SCM_CAR (list_of_a);
|
a = SCM_CAR (list_of_a);
|
||||||
SCM_VALIDATE_ASYNC_COPY (SCM_ARG1,a,it);
|
SCM_VALIDATE_ASYNC (SCM_ARG1,a);
|
||||||
scm_mask_ints = 1;
|
scm_mask_ints = 1;
|
||||||
if (it->got_it)
|
if (SCM_ASYNC_GOT_IT (a))
|
||||||
{
|
{
|
||||||
it->got_it = 0;
|
SCM_SET_ASYNC_GOT_IT (a, 0);
|
||||||
scm_apply (it->thunk, SCM_EOL, SCM_EOL);
|
scm_apply (SCM_ASYNC_THUNK (a), SCM_EOL, SCM_EOL);
|
||||||
}
|
}
|
||||||
scm_mask_ints = 0;
|
scm_mask_ints = 0;
|
||||||
list_of_a = SCM_CDR (list_of_a);
|
list_of_a = SCM_CDR (list_of_a);
|
||||||
|
@ -391,7 +383,7 @@ SCM_DEFINE (scm_run_asyncs, "run-asyncs", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_noop, "noop", 0, 0, 1,
|
SCM_DEFINE (scm_noop, "noop", 0, 0, 1,
|
||||||
(SCM args),
|
(SCM args),
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_noop
|
#define FUNC_NAME s_scm_noop
|
||||||
|
@ -405,7 +397,7 @@ SCM_DEFINE (scm_noop, "noop", 0, 0, 1,
|
||||||
|
|
||||||
#ifdef GUILE_OLD_ASYNC_CLICK
|
#ifdef GUILE_OLD_ASYNC_CLICK
|
||||||
|
|
||||||
SCM_DEFINE (scm_set_tick_rate, "set-tick-rate", 1, 0, 0,
|
SCM_DEFINE (scm_set_tick_rate, "set-tick-rate", 1, 0, 0,
|
||||||
(SCM n),
|
(SCM n),
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_set_tick_rate
|
#define FUNC_NAME s_scm_set_tick_rate
|
||||||
|
@ -422,7 +414,7 @@ SCM_DEFINE (scm_set_tick_rate, "set-tick-rate", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_set_switch_rate, "set-switch-rate", 1, 0, 0,
|
SCM_DEFINE (scm_set_switch_rate, "set-switch-rate", 1, 0, 0,
|
||||||
(SCM n),
|
(SCM n),
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_set_switch_rate
|
#define FUNC_NAME s_scm_set_switch_rate
|
||||||
|
@ -462,7 +454,7 @@ scm_sys_gc_async_thunk (void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_unmask_signals, "unmask-signals", 0, 0, 0,
|
SCM_DEFINE (scm_unmask_signals, "unmask-signals", 0, 0, 0,
|
||||||
(),
|
(),
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_unmask_signals
|
#define FUNC_NAME s_scm_unmask_signals
|
||||||
|
@ -473,7 +465,7 @@ SCM_DEFINE (scm_unmask_signals, "unmask-signals", 0, 0, 0,
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
||||||
SCM_DEFINE (scm_mask_signals, "mask-signals", 0, 0, 0,
|
SCM_DEFINE (scm_mask_signals, "mask-signals", 0, 0, 0,
|
||||||
(),
|
(),
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_mask_signals
|
#define FUNC_NAME s_scm_mask_signals
|
||||||
|
|
|
@ -3,17 +3,17 @@
|
||||||
#ifndef ASYNCH
|
#ifndef ASYNCH
|
||||||
#define ASYNCH
|
#define ASYNCH
|
||||||
/* Copyright (C) 1995, 96, 97, 98, 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 96, 97, 98, 2000 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
* any later version.
|
* any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this software; see the file COPYING. If not, write to
|
* along with this software; see the file COPYING. If not, write to
|
||||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||||
|
@ -52,13 +52,10 @@
|
||||||
|
|
||||||
|
|
||||||
#define SCM_ASYNCP(X) (SCM_NIMP(X) && (scm_tc16_async == SCM_GCTYP16 (X)))
|
#define SCM_ASYNCP(X) (SCM_NIMP(X) && (scm_tc16_async == SCM_GCTYP16 (X)))
|
||||||
#define SCM_ASYNC(X) ((struct scm_async *) &SCM_CDR (X))
|
|
||||||
|
|
||||||
struct scm_async
|
#define SCM_ASYNC_GOT_IT(X) (SCM_CELL_WORD_0 (X) >> 16)
|
||||||
{
|
#define SCM_SET_ASYNC_GOT_IT(X, V) (SCM_SET_CELL_WORD_0 (X, (SCM_CELL_WORD_0 (X) & ((1 << 16) - 1)) | ((V) << 16)))
|
||||||
scm_bits_t got_it; /* needs to be delivered? */
|
#define SCM_ASYNC_THUNK(X) SCM_CELL_OBJECT_1 (X)
|
||||||
SCM thunk; /* the handler. */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue