Implementation de urge_major_gc.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@576 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 1995-12-22 16:48:37 +00:00
parent e02fc8e7d8
commit a0104a1a13
1 changed files with 17 additions and 4 deletions

View File

@ -23,6 +23,7 @@
static Volatile int async_signal_mode = 0;
Volatile int pending_signal = 0;
Volatile int force_major_slice = 0;
value signal_handlers = 0;
char * young_limit;
extern char * caml_last_return_address;
@ -43,7 +44,7 @@ void garbage_collection()
{
int sig;
if (young_ptr < young_start) minor_collection();
if (young_ptr < young_start || force_major_slice) minor_collection();
/* If a signal arrives between the following two instructions,
it will be lost. */
sig = pending_signal;
@ -52,6 +53,18 @@ void garbage_collection()
young_limit = young_start;
}
/* Trigger a garbage collection as soon as possible */
void urge_major_slice ()
{
force_major_slice = 1;
young_limit = young_end;
/* This is only moderately effective on ports that cache young_limit
in a register, since modify() is called directly, not through
caml_c_call, so it may take a while before the register is reloaded
from young_limit. */
}
void enter_blocking_section()
{
int sig;
@ -110,9 +123,9 @@ void handle_signal(sig)
context->sc_regs[14] = (long) young_limit;
#endif
#ifdef TARGET_mips
/* Cached in register $23 */
if (caml_last_return_address == NULL)
context->sc_regs[23] = (int) young_limit;
/* Cached in register $23 */
if (caml_last_return_address == NULL)
context->sc_regs[23] = (int) young_limit;
#endif
}
}