comparison src/share/vm/gc_implementation/parallelScavenge/prefetchQueue.hpp @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents a61af66fc99e
children d1605aabd0a1
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
31 31
32 const int PREFETCH_QUEUE_SIZE = 8; 32 const int PREFETCH_QUEUE_SIZE = 8;
33 33
34 class PrefetchQueue : public CHeapObj { 34 class PrefetchQueue : public CHeapObj {
35 private: 35 private:
36 oop* _prefetch_queue[PREFETCH_QUEUE_SIZE]; 36 void* _prefetch_queue[PREFETCH_QUEUE_SIZE];
37 unsigned int _prefetch_index; 37 uint _prefetch_index;
38 38
39 public: 39 public:
40 int length() { return PREFETCH_QUEUE_SIZE; } 40 int length() { return PREFETCH_QUEUE_SIZE; }
41 41
42 inline void clear() { 42 inline void clear() {
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 };