Skip to content

Commit

Permalink
Add GC API write_barrier function
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/branches/generational_gc@49307 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
bacek committed Feb 10, 2011
1 parent c6fa8b7 commit 84fb245
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
8 changes: 8 additions & 0 deletions include/parrot/gc_api.h
Expand Up @@ -362,6 +362,11 @@ PARROT_EXPORT
int Parrot_gc_total_sized_buffers(PARROT_INTERP)
__attribute__nonnull__(1);

PARROT_EXPORT
void Parrot_gc_write_barrier(PARROT_INTERP, ARGIN(PMC *pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

PARROT_EXPORT
unsigned int Parrot_is_blocked_GC_mark(PARROT_INTERP)
__attribute__nonnull__(1);
Expand Down Expand Up @@ -503,6 +508,9 @@ void Parrot_unblock_GC_sweep(PARROT_INTERP)
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_gc_total_sized_buffers __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_gc_write_barrier __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
#define ASSERT_ARGS_Parrot_is_blocked_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_is_blocked_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
Expand Down
29 changes: 19 additions & 10 deletions src/gc/api.c
Expand Up @@ -95,16 +95,6 @@ implementation, and malloc wrappers for various purposes. These are unused.

/* HEADERIZER HFILE: include/parrot/gc_api.h */

/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */

/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */

#if ! DISABLE_GC_DEBUG

#endif

/*
=item C<void Parrot_gc_mark_PObj_alive(PARROT_INTERP, PObj *obj)>
Expand Down Expand Up @@ -1009,6 +999,24 @@ Parrot_gc_completely_unblock(PARROT_INTERP)

/*
=item C<void Parrot_gc_write_barrier(PARROT_INTERP, PMC *pmc)>
Write barrier for PMC.
=cut
*/

PARROT_EXPORT
void
Parrot_gc_write_barrier(PARROT_INTERP, ARGIN(PMC *pmc))
{
ASSERT_ARGS(Parrot_gc_write_barrier)
interp->gc_sys->write_barrier(interp, pmc);
}

/*
=item C<void Parrot_gc_pmc_needs_early_collection(PARROT_INTERP, PMC *pmc)>
Mark a PMC as needing timely destruction
Expand Down Expand Up @@ -1061,6 +1069,7 @@ Parrot_gc_sys_name(PARROT_INTERP)
return name;
}


/*
=back
Expand Down
7 changes: 3 additions & 4 deletions src/gc/gc_private.h
Expand Up @@ -189,13 +189,12 @@ typedef struct GC_Subsystem {
/* Iterate over _live_ strings. Used for string pool compacting */
void (*iterate_live_strings)(PARROT_INTERP, string_iterator_callback callback, void *data);

/* Write barrier */
void (*write_barrier)(PARROT_INTERP, PMC *);

/* Statistic for GC */
struct GC_Statistics stats;

/*Function hooks that GC systems can CHOOSE to provide if they need them
*These will be called via the GC API functions Parrot_gc_func_name
*e.g. read barrier && write barrier hooks can go here later ...*/

/* Holds system-specific data structures */
void * gc_private;
} GC_Subsystem;
Expand Down

0 comments on commit 84fb245

Please sign in to comment.