comparison src/share/vm/gc_implementation/parallelScavenge/psScavenge.hpp @ 10370:47bdfb3d010f

8015486: PSScavenge::is_obj_in_young is unnecessarily slow with UseCompressedOops Summary: Compare compressed oops to a compressed young gen boundary instead of uncompressing the oops before doing the young gen boundary check. Reviewed-by: brutisso, jmasa
author stefank
date Thu, 30 May 2013 10:58:16 +0200
parents 22b8d3d181d9
children f2110083203d
comparison
equal deleted inserted replaced
10369:5534bd30c151 10370:47bdfb3d010f
60 static int _consecutive_skipped_scavenges; 60 static int _consecutive_skipped_scavenges;
61 61
62 62
63 protected: 63 protected:
64 // Flags/counters 64 // Flags/counters
65 static ReferenceProcessor* _ref_processor; // Reference processor for scavenging. 65 static ReferenceProcessor* _ref_processor; // Reference processor for scavenging.
66 static PSIsAliveClosure _is_alive_closure; // Closure used for reference processing 66 static PSIsAliveClosure _is_alive_closure; // Closure used for reference processing
67 static CardTableExtension* _card_table; // We cache the card table for fast access. 67 static CardTableExtension* _card_table; // We cache the card table for fast access.
68 static bool _survivor_overflow; // Overflow this collection 68 static bool _survivor_overflow; // Overflow this collection
69 static uint _tenuring_threshold; // tenuring threshold for next scavenge 69 static uint _tenuring_threshold; // tenuring threshold for next scavenge
70 static elapsedTimer _accumulated_time; // total time spent on scavenge 70 static elapsedTimer _accumulated_time; // total time spent on scavenge
71 static HeapWord* _young_generation_boundary; // The lowest address possible for the young_gen. 71 // The lowest address possible for the young_gen.
72 // This is used to decide if an oop should be scavenged, 72 // This is used to decide if an oop should be scavenged,
73 // cards should be marked, etc. 73 // cards should be marked, etc.
74 static HeapWord* _young_generation_boundary;
75 // Used to optimize compressed oops young gen boundary checking.
76 static uintptr_t _young_generation_boundary_compressed;
74 static Stack<markOop, mtGC> _preserved_mark_stack; // List of marks to be restored after failed promotion 77 static Stack<markOop, mtGC> _preserved_mark_stack; // List of marks to be restored after failed promotion
75 static Stack<oop, mtGC> _preserved_oop_stack; // List of oops that need their mark restored. 78 static Stack<oop, mtGC> _preserved_oop_stack; // List of oops that need their mark restored.
76 static CollectorCounters* _counters; // collector performance counters 79 static CollectorCounters* _counters; // collector performance counters
77 static bool _promotion_failed; 80 static bool _promotion_failed;
78 81
79 static void clean_up_failed_promotion(); 82 static void clean_up_failed_promotion();
80 83
81 static bool should_attempt_scavenge(); 84 static bool should_attempt_scavenge();
82 85
110 } 113 }
111 // Adaptive size policy support. When the young generation/old generation 114 // Adaptive size policy support. When the young generation/old generation
112 // boundary moves, _young_generation_boundary must be reset 115 // boundary moves, _young_generation_boundary must be reset
113 static void set_young_generation_boundary(HeapWord* v) { 116 static void set_young_generation_boundary(HeapWord* v) {
114 _young_generation_boundary = v; 117 _young_generation_boundary = v;
118 if (UseCompressedOops) {
119 _young_generation_boundary_compressed = (uintptr_t)oopDesc::encode_heap_oop((oop)v);
120 }
115 } 121 }
116 122
117 // Called by parallelScavengeHeap to init the tenuring threshold 123 // Called by parallelScavengeHeap to init the tenuring threshold
118 static void initialize(); 124 static void initialize();
119 125
138 inline static void copy_and_push_safe_barrier(PSPromotionManager* pm, T* p); 144 inline static void copy_and_push_safe_barrier(PSPromotionManager* pm, T* p);
139 145
140 static void copy_and_push_safe_barrier_from_klass(PSPromotionManager* pm, oop* p); 146 static void copy_and_push_safe_barrier_from_klass(PSPromotionManager* pm, oop* p);
141 147
142 // Is an object in the young generation 148 // Is an object in the young generation
143 // This assumes that the HeapWord argument is in the heap, 149 // This assumes that the 'o' is in the heap,
144 // so it only checks one side of the complete predicate. 150 // so it only checks one side of the complete predicate.
151
152 inline static bool is_obj_in_young(oop o) {
153 return (HeapWord*)o >= _young_generation_boundary;
154 }
155
156 inline static bool is_obj_in_young(narrowOop o) {
157 return (uintptr_t)o >= _young_generation_boundary_compressed;
158 }
159
145 inline static bool is_obj_in_young(HeapWord* o) { 160 inline static bool is_obj_in_young(HeapWord* o) {
146 const bool result = (o >= _young_generation_boundary); 161 return o >= _young_generation_boundary;
147 return result;
148 } 162 }
149 }; 163 };
150 164
151 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_HPP 165 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_HPP