hotspot/src/share/vm/interpreter/oopMapCache.cpp
changeset 33593 60764a78fa5c
parent 33148 68fa8b6c4340
child 38259 b495d1cfe673
equal deleted inserted replaced
33579:01ade4446d96 33593:60764a78fa5c
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   424     memcpy((void*) _bit_mask[0], (void*) from->_bit_mask[0],
   424     memcpy((void*) _bit_mask[0], (void*) from->_bit_mask[0],
   425       mask_word_size() * BytesPerWord);
   425       mask_word_size() * BytesPerWord);
   426   }
   426   }
   427 }
   427 }
   428 
   428 
   429 inline unsigned int OopMapCache::hash_value_for(methodHandle method, int bci) const {
   429 inline unsigned int OopMapCache::hash_value_for(const methodHandle& method, int bci) const {
   430   // We use method->code_size() rather than method->identity_hash() below since
   430   // We use method->code_size() rather than method->identity_hash() below since
   431   // the mark may not be present if a pointer to the method is already reversed.
   431   // the mark may not be present if a pointer to the method is already reversed.
   432   return   ((unsigned int) bci)
   432   return   ((unsigned int) bci)
   433          ^ ((unsigned int) method->max_locals()         << 2)
   433          ^ ((unsigned int) method->max_locals()         << 2)
   434          ^ ((unsigned int) method->code_size()          << 4)
   434          ^ ((unsigned int) method->code_size()          << 4)
   475 
   475 
   476       _array[i].flush();
   476       _array[i].flush();
   477     }
   477     }
   478 }
   478 }
   479 
   479 
   480 void OopMapCache::lookup(methodHandle method,
   480 void OopMapCache::lookup(const methodHandle& method,
   481                          int bci,
   481                          int bci,
   482                          InterpreterOopMap* entry_for) const {
   482                          InterpreterOopMap* entry_for) const {
   483   MutexLocker x(&_mut);
   483   MutexLocker x(&_mut);
   484 
   484 
   485   OopMapCacheEntry* entry = NULL;
   485   OopMapCacheEntry* entry = NULL;
   556   assert(!entry_for->is_empty(), "A non-empty oop map should be returned");
   556   assert(!entry_for->is_empty(), "A non-empty oop map should be returned");
   557 
   557 
   558   return;
   558   return;
   559 }
   559 }
   560 
   560 
   561 void OopMapCache::compute_one_oop_map(methodHandle method, int bci, InterpreterOopMap* entry) {
   561 void OopMapCache::compute_one_oop_map(const methodHandle& method, int bci, InterpreterOopMap* entry) {
   562   // Due to the invariants above it's tricky to allocate a temporary OopMapCacheEntry on the stack
   562   // Due to the invariants above it's tricky to allocate a temporary OopMapCacheEntry on the stack
   563   OopMapCacheEntry* tmp = NEW_C_HEAP_ARRAY(OopMapCacheEntry, 1, mtClass);
   563   OopMapCacheEntry* tmp = NEW_C_HEAP_ARRAY(OopMapCacheEntry, 1, mtClass);
   564   tmp->initialize();
   564   tmp->initialize();
   565   tmp->fill(method, bci);
   565   tmp->fill(method, bci);
   566   entry->resource_copy(tmp);
   566   entry->resource_copy(tmp);