44 _prefetch_queue[i] = NULL; |
44 _prefetch_queue[i] = NULL; |
45 } |
45 } |
46 _prefetch_index = 0; |
46 _prefetch_index = 0; |
47 } |
47 } |
48 |
48 |
49 inline oop* push_and_pop(oop* p) { |
49 template <class T> inline void* push_and_pop(T* p) { |
50 Prefetch::write((*p)->mark_addr(), 0); |
50 oop o = oopDesc::load_decode_heap_oop_not_null(p); |
|
51 Prefetch::write(o->mark_addr(), 0); |
51 // This prefetch is intended to make sure the size field of array |
52 // This prefetch is intended to make sure the size field of array |
52 // oops is in cache. It assumes the the object layout is |
53 // oops is in cache. It assumes the the object layout is |
53 // mark -> klass -> size, and that mark and klass are heapword |
54 // mark -> klass -> size, and that mark and klass are heapword |
54 // sized. If this should change, this prefetch will need updating! |
55 // sized. If this should change, this prefetch will need updating! |
55 Prefetch::write((*p)->mark_addr() + (HeapWordSize*2), 0); |
56 Prefetch::write(o->mark_addr() + (HeapWordSize*2), 0); |
56 _prefetch_queue[_prefetch_index++] = p; |
57 _prefetch_queue[_prefetch_index++] = p; |
57 _prefetch_index &= (PREFETCH_QUEUE_SIZE-1); |
58 _prefetch_index &= (PREFETCH_QUEUE_SIZE-1); |
58 return _prefetch_queue[_prefetch_index]; |
59 return _prefetch_queue[_prefetch_index]; |
59 } |
60 } |
60 |
61 |
61 // Stores a NULL pointer in the pop'd location. |
62 // Stores a NULL pointer in the pop'd location. |
62 inline oop* pop() { |
63 inline void* pop() { |
63 _prefetch_queue[_prefetch_index++] = NULL; |
64 _prefetch_queue[_prefetch_index++] = NULL; |
64 _prefetch_index &= (PREFETCH_QUEUE_SIZE-1); |
65 _prefetch_index &= (PREFETCH_QUEUE_SIZE-1); |
65 return _prefetch_queue[_prefetch_index]; |
66 return _prefetch_queue[_prefetch_index]; |
66 } |
67 } |
67 }; |
68 }; |