Skip to content

Commit

Permalink
Implementation de urge_major_gc.
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@576 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
xavierleroy committed Dec 22, 1995
1 parent e02fc8e commit a0104a1
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions asmrun/signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit a0104a1

Please sign in to comment.