< prev index next >

src/hotspot/share/compiler/oopMap.cpp

Print this page
@@ -113,10 +113,22 @@
    _locs_used   = NEW_RESOURCE_ARRAY(OopMapValue::oop_types, _locs_length);
    for(int i = 0; i < _locs_length; i++) _locs_used[i] = OopMapValue::unused_value;
  #endif
  }
  
+ OopMap::OopMap(int data_size) {
+   // OopMaps are usually quite so small, so pick a small initial size
+   set_write_stream(new CompressedWriteStream(data_size));
+   set_omv_count(0);
+   _num_oops = 0;
+   _has_derived_oops = false;
+   _index = -1;
+ #ifdef ASSERT
+   _locs_length = 0;
+   _locs_used   = nullptr;
+ #endif
+ }
  
  OopMap::OopMap(OopMap::DeepCopyToken, OopMap* source) {
    // This constructor does a deep copy
    // of the source OopMap.
    set_write_stream(new CompressedWriteStream(source->omv_count() * 2));

@@ -363,10 +375,12 @@
  
  // OopMapSet
  
  OopMapSet::OopMapSet() : _list(MinOopMapAllocation) {}
  
+ OopMapSet::OopMapSet(int size) : _list(size) {}
+ 
  int OopMapSet::add_gc_map(int pc_offset, OopMap *map ) {
    map->set_offset(pc_offset);
  
  #ifdef ASSERT
    if(_list.length() > 0) {
< prev index next >