< prev index next >

src/share/vm/compiler/oopMap.cpp

Print this page




 595   address addr = data_addr();
 596   oopmap->copy_data_to(addr);
 597 }
 598 
 599 #ifdef ASSERT
 600 int ImmutableOopMap::nr_of_bytes() const {
 601   OopMapStream oms(this);
 602 
 603   while (!oms.is_done()) {
 604     oms.next();
 605   }
 606   return sizeof(ImmutableOopMap) + oms.stream_position();
 607 }
 608 #endif
 609 
 610 ImmutableOopMapBuilder::ImmutableOopMapBuilder(const OopMapSet* set) : _set(set), _new_set(NULL), _empty(NULL), _last(NULL), _empty_offset(-1), _last_offset(-1), _offset(0), _required(-1) {
 611   _mapping = NEW_RESOURCE_ARRAY(Mapping, _set->size());
 612 }
 613 
 614 int ImmutableOopMapBuilder::size_for(const OopMap* map) const {
 615   return align_size_up((int)sizeof(ImmutableOopMap) + map->data_size(), 8);
 616 }
 617 
 618 int ImmutableOopMapBuilder::heap_size() {
 619   int base = sizeof(ImmutableOopMapSet);
 620   base = align_size_up(base, 8);
 621 
 622   // all of ours pc / offset pairs
 623   int pairs = _set->size() * sizeof(ImmutableOopMapPair);
 624   pairs = align_size_up(pairs, 8);
 625 
 626   for (int i = 0; i < _set->size(); ++i) {
 627     int size = 0;
 628     OopMap* map = _set->at(i);
 629 
 630     if (is_empty(map)) {
 631       /* only keep a single empty map in the set */
 632       if (has_empty()) {
 633         _mapping[i].set(Mapping::OOPMAP_EMPTY, _empty_offset, 0, map, _empty);
 634       } else {
 635         _empty_offset = _offset;
 636         _empty = map;
 637         size = size_for(map);
 638         _mapping[i].set(Mapping::OOPMAP_NEW, _offset, size, map);
 639       }
 640     } else if (is_last_duplicate(map)) {
 641       /* if this entry is identical to the previous one, just point it there */
 642       _mapping[i].set(Mapping::OOPMAP_DUPLICATE, _last_offset, 0, map, _last);
 643     } else {
 644       /* not empty, not an identical copy of the previous entry */




 595   address addr = data_addr();
 596   oopmap->copy_data_to(addr);
 597 }
 598 
 599 #ifdef ASSERT
 600 int ImmutableOopMap::nr_of_bytes() const {
 601   OopMapStream oms(this);
 602 
 603   while (!oms.is_done()) {
 604     oms.next();
 605   }
 606   return sizeof(ImmutableOopMap) + oms.stream_position();
 607 }
 608 #endif
 609 
 610 ImmutableOopMapBuilder::ImmutableOopMapBuilder(const OopMapSet* set) : _set(set), _new_set(NULL), _empty(NULL), _last(NULL), _empty_offset(-1), _last_offset(-1), _offset(0), _required(-1) {
 611   _mapping = NEW_RESOURCE_ARRAY(Mapping, _set->size());
 612 }
 613 
 614 int ImmutableOopMapBuilder::size_for(const OopMap* map) const {
 615   return align_up((int)sizeof(ImmutableOopMap) + map->data_size(), 8);
 616 }
 617 
 618 int ImmutableOopMapBuilder::heap_size() {
 619   int base = sizeof(ImmutableOopMapSet);
 620   base = align_up(base, 8);
 621 
 622   // all of ours pc / offset pairs
 623   int pairs = _set->size() * sizeof(ImmutableOopMapPair);
 624   pairs = align_up(pairs, 8);
 625 
 626   for (int i = 0; i < _set->size(); ++i) {
 627     int size = 0;
 628     OopMap* map = _set->at(i);
 629 
 630     if (is_empty(map)) {
 631       /* only keep a single empty map in the set */
 632       if (has_empty()) {
 633         _mapping[i].set(Mapping::OOPMAP_EMPTY, _empty_offset, 0, map, _empty);
 634       } else {
 635         _empty_offset = _offset;
 636         _empty = map;
 637         size = size_for(map);
 638         _mapping[i].set(Mapping::OOPMAP_NEW, _offset, size, map);
 639       }
 640     } else if (is_last_duplicate(map)) {
 641       /* if this entry is identical to the previous one, just point it there */
 642       _mapping[i].set(Mapping::OOPMAP_DUPLICATE, _last_offset, 0, map, _last);
 643     } else {
 644       /* not empty, not an identical copy of the previous entry */


< prev index next >