178 if (mask_size() > small_mask_limit) { |
178 if (mask_size() > small_mask_limit) { |
179 FREE_RESOURCE_ARRAY(uintptr_t, _bit_mask[0], mask_word_size()); |
179 FREE_RESOURCE_ARRAY(uintptr_t, _bit_mask[0], mask_word_size()); |
180 } |
180 } |
181 } |
181 } |
182 |
182 |
183 bool InterpreterOopMap::is_empty() { |
183 bool InterpreterOopMap::is_empty() const { |
184 bool result = _method == NULL; |
184 bool result = _method == NULL; |
185 assert(_method != NULL || (_bci == 0 && |
185 assert(_method != NULL || (_bci == 0 && |
186 (_mask_size == 0 || _mask_size == USHRT_MAX) && |
186 (_mask_size == 0 || _mask_size == USHRT_MAX) && |
187 _bit_mask[0] == 0), "Should be completely empty"); |
187 _bit_mask[0] == 0), "Should be completely empty"); |
188 return result; |
188 return result; |
194 _bci = 0; |
194 _bci = 0; |
195 _expression_stack_size = 0; |
195 _expression_stack_size = 0; |
196 for (int i = 0; i < N; i++) _bit_mask[i] = 0; |
196 for (int i = 0; i < N; i++) _bit_mask[i] = 0; |
197 } |
197 } |
198 |
198 |
199 void InterpreterOopMap::iterate_oop(OffsetClosure* oop_closure) { |
199 void InterpreterOopMap::iterate_oop(OffsetClosure* oop_closure) const { |
200 int n = number_of_entries(); |
200 int n = number_of_entries(); |
201 int word_index = 0; |
201 int word_index = 0; |
202 uintptr_t value = 0; |
202 uintptr_t value = 0; |
203 uintptr_t mask = 0; |
203 uintptr_t mask = 0; |
204 // iterate over entries |
204 // iterate over entries |
236 } |
236 } |
237 |
237 |
238 #endif |
238 #endif |
239 |
239 |
240 |
240 |
241 void InterpreterOopMap::print() { |
241 void InterpreterOopMap::print() const { |
242 int n = number_of_entries(); |
242 int n = number_of_entries(); |
243 tty->print("oop map for "); |
243 tty->print("oop map for "); |
244 method()->print_value(); |
244 method()->print_value(); |
245 tty->print(" @ %d = [%d] { ", bci(), n); |
245 tty->print(" @ %d = [%d] { ", bci(), n); |
246 for (int i = 0; i < n; i++) { |
246 for (int i = 0; i < n; i++) { |
467 memcpy((void*) _bit_mask[0], (void*) from->_bit_mask[0], |
467 memcpy((void*) _bit_mask[0], (void*) from->_bit_mask[0], |
468 mask_word_size() * BytesPerWord); |
468 mask_word_size() * BytesPerWord); |
469 } |
469 } |
470 } |
470 } |
471 |
471 |
472 inline unsigned int OopMapCache::hash_value_for(methodHandle method, int bci) { |
472 inline unsigned int OopMapCache::hash_value_for(methodHandle method, int bci) const { |
473 // We use method->code_size() rather than method->identity_hash() below since |
473 // We use method->code_size() rather than method->identity_hash() below since |
474 // the mark may not be present if a pointer to the method is already reversed. |
474 // the mark may not be present if a pointer to the method is already reversed. |
475 return ((unsigned int) bci) |
475 return ((unsigned int) bci) |
476 ^ ((unsigned int) method->max_locals() << 2) |
476 ^ ((unsigned int) method->max_locals() << 2) |
477 ^ ((unsigned int) method->code_size() << 4) |
477 ^ ((unsigned int) method->code_size() << 4) |
520 } |
520 } |
521 } |
521 } |
522 |
522 |
523 void OopMapCache::lookup(methodHandle method, |
523 void OopMapCache::lookup(methodHandle method, |
524 int bci, |
524 int bci, |
525 InterpreterOopMap* entry_for) { |
525 InterpreterOopMap* entry_for) const { |
526 MutexLocker x(&_mut); |
526 MutexLocker x(&_mut); |
527 |
527 |
528 OopMapCacheEntry* entry = NULL; |
528 OopMapCacheEntry* entry = NULL; |
529 int probe = hash_value_for(method, bci); |
529 int probe = hash_value_for(method, bci); |
530 |
530 |