mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
Define gc_collector_mark_gray as static
This is a commonly used function that the C compiler may be able to better optimize, such as inline, now that it is guaranteed to only be used within the gc.c module.
This commit is contained in:
parent
1fa07c1e0f
commit
facaf608ae
2 changed files with 16 additions and 17 deletions
32
gc.c
32
gc.c
|
@ -1103,6 +1103,22 @@ void gc_collector_trace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gc_collector_mark_gray(object parent, object obj)
|
||||||
|
{
|
||||||
|
// "Color" objects gray by adding them to the mark stack for further processing.
|
||||||
|
//
|
||||||
|
// Note that stack objects are always colored red during creation, so
|
||||||
|
// they should never be added to the mark stack. Which would be bad because it
|
||||||
|
// could lead to stack corruption.
|
||||||
|
if (is_object_type(obj) && mark(obj) == gc_color_clear) {
|
||||||
|
mark_stack = vpbuffer_add(mark_stack, &mark_stack_len, mark_stack_i++, obj);
|
||||||
|
#if GC_DEBUG_VERBOSE
|
||||||
|
fprintf(stderr, "mark gray parent = %p (%d) obj = %p\n", parent,
|
||||||
|
type_of(parent), obj);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: seriously consider changing the mark() macro to color(),
|
// TODO: seriously consider changing the mark() macro to color(),
|
||||||
// and sync up the header variable. that would make all of this code
|
// and sync up the header variable. that would make all of this code
|
||||||
// bit clearer...
|
// bit clearer...
|
||||||
|
@ -1165,22 +1181,6 @@ void gc_mark_black(object obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gc_collector_mark_gray(object parent, object obj)
|
|
||||||
{
|
|
||||||
// "Color" objects gray by adding them to the mark stack for further processing.
|
|
||||||
//
|
|
||||||
// Note that stack objects are always colored red during creation, so
|
|
||||||
// they should never be added to the mark stack. Which would be bad because it
|
|
||||||
// could lead to stack corruption.
|
|
||||||
if (is_object_type(obj) && mark(obj) == gc_color_clear) {
|
|
||||||
mark_stack = vpbuffer_add(mark_stack, &mark_stack_len, mark_stack_i++, obj);
|
|
||||||
#if GC_DEBUG_VERBOSE
|
|
||||||
fprintf(stderr, "mark gray parent = %p (%d) obj = %p\n", parent,
|
|
||||||
type_of(parent), obj);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void gc_empty_collector_stack()
|
void gc_empty_collector_stack()
|
||||||
{
|
{
|
||||||
// Mark stack is only used by the collector thread, so no sync needed
|
// Mark stack is only used by the collector thread, so no sync needed
|
||||||
|
|
|
@ -628,7 +628,6 @@ void gc_mark_gray(gc_thread_data * thd, object obj);
|
||||||
void gc_mark_gray2(gc_thread_data * thd, object obj);
|
void gc_mark_gray2(gc_thread_data * thd, object obj);
|
||||||
void gc_collector_trace();
|
void gc_collector_trace();
|
||||||
void gc_mark_black(object obj);
|
void gc_mark_black(object obj);
|
||||||
void gc_collector_mark_gray(object parent, object obj);
|
|
||||||
void gc_empty_collector_stack();
|
void gc_empty_collector_stack();
|
||||||
void gc_handshake(gc_status_type s);
|
void gc_handshake(gc_status_type s);
|
||||||
void gc_post_handshake(gc_status_type s);
|
void gc_post_handshake(gc_status_type s);
|
||||||
|
|
Loading…
Add table
Reference in a new issue