Index: src/common/gc_block.h =================================================================== --- src/common/gc_block.h (revision 608796) +++ src/common/gc_block.h (working copy) @@ -202,6 +202,7 @@ if( obj_is_marked_in_vt(cur_obj)) return cur_obj; cur_obj = obj_end(cur_obj); + PREFETCH( ((POINTER_SIZE_INT) cur_obj) + 64); } return NULL; Index: src/common/gc_common.cpp =================================================================== --- src/common/gc_common.cpp (revision 608796) +++ src/common/gc_common.cpp (working copy) @@ -61,8 +61,8 @@ extern Boolean USE_CONCURRENT_GC; #if defined(ALLOC_ZEROING) && defined(ALLOC_PREFETCH) -POINTER_SIZE_INT PREFETCH_DISTANCE = 1024; -POINTER_SIZE_INT ZEROING_SIZE = 256; +POINTER_SIZE_INT PREFETCH_DISTANCE = 960; +POINTER_SIZE_INT ZEROING_SIZE = 384; POINTER_SIZE_INT PREFETCH_STRIDE = 64; Boolean PREFETCH_ENABLED = FALSE; #endif @@ -343,9 +343,6 @@ if(is_property_set("gc.zeroing_size",VM_PROPERTIES)==1) { ZEROING_SIZE = get_size_property("gc.zeroing_size"); - if(!PREFETCH_ENABLED) { - WARN2("gc.zeroing_size","Warning: Zeroing size set with Prefetch disabled!"); - } } #endif Index: src/common/gc_platform.h =================================================================== --- src/common/gc_platform.h (revision 608796) +++ src/common/gc_platform.h (working copy) @@ -53,14 +53,35 @@ #endif //_DEBUG +#ifndef _IPF_ +#define PREFETCH_SUPPORTED +#endif + #ifdef _WINDOWS_ #define FORCE_INLINE __forceinline + +#ifdef PREFETCH_SUPPORTED +#include +#define prefetchnta(pref_addr) _mm_prefetch((char*)(pref_addr), _MM_HINT_NTA ) +#endif /*ALLOC_PREFETCH*/ + #elif defined (__linux__) #define FORCE_INLINE inline __attribute__((always_inline)) + +#ifdef PREFETCH_SUPPORTED +#define prefetchnta(pref_addr) __asm__ ("prefetchnta (%0)"::"r"(pref_addr)) +#endif /*PREFETCH_SUPPORTED*/ + #else #define FORCE_INLINE inline #endif /* _WINDOWS_ */ +#ifdef PREFETCH_SUPPORTED +#define PREFETCH prefetchnta +#else +#define PREFETCH(x) +#endif + #define ABS_DIFF(x, y) (((x)>(y))?((x)-(y)):((y)-(x))) #define USEC_PER_SEC INT64_C(1000000) Index: src/thread/gc_thread.h =================================================================== --- src/thread/gc_thread.h (revision 608796) +++ src/thread/gc_thread.h (working copy) @@ -27,20 +27,12 @@ #define ALLOC_ZEROING -#ifndef _IPF_ +#ifdef PREFETCH_SUPPORTED #define ALLOC_PREFETCH #endif #ifdef ALLOC_ZEROING /* ----------------- */ #ifdef ALLOC_PREFETCH /* vvvvvvvvvvvvvvvv */ - -#ifdef _WINDOWS_ -#include -#define prefetchnta(pref_addr) _mm_prefetch((char*)(pref_addr), _MM_HINT_NTA ) -#else /* _WINDOWS_ */ -#define prefetchnta(pref_addr) __asm__ ("prefetchnta (%0)"::"r"(pref_addr)) -#endif /* !_WINDOWS_ */ - extern POINTER_SIZE_INT PREFETCH_DISTANCE; extern POINTER_SIZE_INT ZEROING_SIZE; extern POINTER_SIZE_INT PREFETCH_STRIDE; Index: src/trace_forward/fspace_nongen_forward_pool.cpp =================================================================== --- src/trace_forward/fspace_nongen_forward_pool.cpp (revision 608796) +++ src/trace_forward/fspace_nongen_forward_pool.cpp (working copy) @@ -175,13 +175,25 @@ return; } +static POINTER_SIZE_INT inline vector_stack_read(Vector_Block* st, int idx) +{ + return st->head[idx]; +} + static void trace_object(Collector *collector, REF *p_ref) { forward_object(collector, p_ref); Vector_Block* trace_stack = (Vector_Block*)collector->trace_stack; + while( !vector_stack_is_empty(trace_stack)){ p_ref = (REF *)vector_stack_pop(trace_stack); + + /* DO PREFETCH */ + if(!vector_stack_is_empty(trace_stack)) { + REF *pref = (REF*)vector_stack_read(trace_stack, 0); + PREFETCH( read_slot(pref) ); + } forward_object(collector, p_ref); trace_stack = (Vector_Block*)collector->trace_stack; } @@ -245,6 +257,12 @@ while(!vector_block_iterator_end(trace_task,iter)){ REF *p_ref = (REF *)*iter; iter = vector_block_iterator_advance(trace_task, iter); + + /* DO PREFETCH */ + if(!vector_block_iterator_end(trace_task, iter)) { + REF *pref= (REF*) *iter; + PREFETCH( read_slot(pref)); + } trace_object(collector, p_ref); if(collector->result == FALSE) break; /* force return */