-#define SGEN_LOAD_VTABLE(addr) ((*(mword*)(addr)) & ~SGEN_VTABLE_BITS_MASK)
-
-static inline MONO_ALWAYS_INLINE void
-GRAY_OBJECT_ENQUEUE (SgenGrayQueue *queue, char* obj)
-{
-#if defined(SGEN_GRAY_OBJECT_ENQUEUE) || SGEN_MAX_DEBUG_LEVEL >= 9
- sgen_gray_object_enqueue (queue, obj);
-#else
- if (G_UNLIKELY (!queue->first || queue->cursor == GRAY_LAST_CURSOR_POSITION (queue->first))) {
- sgen_gray_object_enqueue (queue, obj);
- } else {
- HEAVY_STAT (gc_stats.gray_queue_enqueue_fast_path ++);
-
- *++queue->cursor = obj;
-#ifdef SGEN_HEAVY_BINARY_PROTOCOL
- binary_protocol_gray_enqueue (queue, queue->cursor, obj);
-#endif
- }
-
- PREFETCH (obj);
-#endif
-}
-
-static inline MONO_ALWAYS_INLINE void
-GRAY_OBJECT_DEQUEUE (SgenGrayQueue *queue, char** obj)
-{
-#if defined(SGEN_GRAY_OBJECT_ENQUEUE) || SGEN_MAX_DEBUG_LEVEL >= 9
- *obj = sgen_gray_object_enqueue (queue);
-#else
- if (!queue->first) {
- HEAVY_STAT (gc_stats.gray_queue_dequeue_fast_path ++);
-
- *obj = NULL;
-#ifdef SGEN_HEAVY_BINARY_PROTOCOL
- binary_protocol_gray_dequeue (queue, queue->cursor, *obj);
-#endif
- } else if (G_UNLIKELY (queue->cursor == GRAY_FIRST_CURSOR_POSITION (queue->first))) {
- *obj = sgen_gray_object_dequeue (queue);
- } else {
- HEAVY_STAT (gc_stats.gray_queue_dequeue_fast_path ++);
-
- *obj = *queue->cursor--;
-#ifdef SGEN_HEAVY_BINARY_PROTOCOL
- binary_protocol_gray_dequeue (queue, queue->cursor + 1, *obj);
-#endif
- }
-#endif
-}
-
-#define SGEN_MAX_PARTIAL_OFFSET 1500
-/*FIXME:This works only because SGEN_MAX_PARTIAL_OFFSET is even*/
-#define GRAY_OBJECT_IS_PARTIAL(obj) ((mword)(obj) & 1)
-
-#define GRAY_PARTIAL_OBJECT_ENQUEUE(queue,o) do{ \
- GRAY_OBJECT_ENQUEUE(queue,(o)); \
- if( SGEN_OBJECT_IS_VECTOR_V_REFS((o)) && sgen_get_major_collector()->is_parallel){ \
- mword i; \
- for(i=SGEN_MAX_PARTIAL_OFFSET; i< mono_array_length_fast ((MonoArray*)(o)); i+=SGEN_MAX_PARTIAL_OFFSET){ \
- if (G_UNLIKELY (queue->cursor == GRAY_SECOND_TO_LAST_CURSOR_POSITION(queue->first))){ \
- queue->first->size = SGEN_GRAY_QUEUE_SECTION_SIZE -1;\
- sgen_gray_object_alloc_queue_section (queue); \
- } \
- GRAY_OBJECT_ENQUEUE(queue, (char*)i); \
- GRAY_OBJECT_ENQUEUE(queue, (char*)((mword)o|1)); \
- } \
- } \
-} while(0)
-#define GRAY_PARTIAL_OBJECT_DEQUEUE(queue,o,offset) do{ \
- GRAY_OBJECT_DEQUEUE((queue),&(o)); \
- (offset) = NULL; \
- if(GRAY_OBJECT_IS_PARTIAL((o))){ \
- GRAY_OBJECT_DEQUEUE((queue),&(offset)); \
- o = (char*)((mword)(o) & (~1)); \
- } \
-} while(0)