< prev index next >

src/hotspot/share/compiler/oopMap.cpp

Print this page

 98 
 99 // OopMap
100 
101 // frame_size units are stack-slots (4 bytes) NOT intptr_t; we can name odd
102 // slots to hold 4-byte values like ints and floats in the LP64 build.
103 OopMap::OopMap(int frame_size, int arg_count) {
104   // OopMaps are usually quite so small, so pick a small initial size
105   set_write_stream(new CompressedWriteStream(32));
106   set_omv_count(0);
107   _num_oops = 0;
108   _has_derived_oops = false;
109   _index = -1;
110 
111 #ifdef ASSERT
112   _locs_length = VMRegImpl::stack2reg(0)->value() + frame_size + arg_count;
113   _locs_used   = NEW_RESOURCE_ARRAY(OopMapValue::oop_types, _locs_length);
114   for(int i = 0; i < _locs_length; i++) _locs_used[i] = OopMapValue::unused_value;
115 #endif
116 }
117 












118 
119 OopMap::OopMap(OopMap::DeepCopyToken, OopMap* source) {
120   // This constructor does a deep copy
121   // of the source OopMap.
122   set_write_stream(new CompressedWriteStream(source->omv_count() * 2));
123   set_omv_count(0);
124   set_offset(source->offset());
125   _num_oops = source->num_oops();
126   _has_derived_oops = source->has_derived_oops();
127   _index = -1;
128 
129 #ifdef ASSERT
130   _locs_length = source->_locs_length;
131   _locs_used = NEW_RESOURCE_ARRAY(OopMapValue::oop_types, _locs_length);
132   for(int i = 0; i < _locs_length; i++) _locs_used[i] = OopMapValue::unused_value;
133 #endif
134 
135   // We need to copy the entries too.
136   for (OopMapStream oms(source); !oms.is_done(); oms.next()) {
137     OopMapValue omv = oms.current();

348 
349 
350 void OopMap::set_callee_saved(VMReg reg, VMReg caller_machine_register ) {
351   set_xxx(reg, OopMapValue::callee_saved_value, caller_machine_register);
352 }
353 
354 
355 void OopMap::set_derived_oop(VMReg reg, VMReg derived_from_local_register ) {
356   if( reg == derived_from_local_register ) {
357     // Actually an oop, derived shares storage with base,
358     set_oop(reg);
359   } else {
360     set_xxx(reg, OopMapValue::derived_oop_value, derived_from_local_register);
361   }
362 }
363 
364 // OopMapSet
365 
366 OopMapSet::OopMapSet() : _list(MinOopMapAllocation) {}
367 


368 int OopMapSet::add_gc_map(int pc_offset, OopMap *map ) {
369   map->set_offset(pc_offset);
370 
371 #ifdef ASSERT
372   if(_list.length() > 0) {
373     OopMap* last = _list.last();
374     if (last->offset() == map->offset() ) {
375       fatal("OopMap inserted twice");
376     }
377     if (last->offset() > map->offset()) {
378       tty->print_cr( "WARNING, maps not sorted: pc[%d]=%d, pc[%d]=%d",
379                       _list.length(),last->offset(),_list.length()+1,map->offset());
380     }
381   }
382 #endif // ASSERT
383 
384   int index = add(map);
385   map->_index = index;
386   return index;
387 }

 98 
 99 // OopMap
100 
101 // frame_size units are stack-slots (4 bytes) NOT intptr_t; we can name odd
102 // slots to hold 4-byte values like ints and floats in the LP64 build.
103 OopMap::OopMap(int frame_size, int arg_count) {
104   // OopMaps are usually quite so small, so pick a small initial size
105   set_write_stream(new CompressedWriteStream(32));
106   set_omv_count(0);
107   _num_oops = 0;
108   _has_derived_oops = false;
109   _index = -1;
110 
111 #ifdef ASSERT
112   _locs_length = VMRegImpl::stack2reg(0)->value() + frame_size + arg_count;
113   _locs_used   = NEW_RESOURCE_ARRAY(OopMapValue::oop_types, _locs_length);
114   for(int i = 0; i < _locs_length; i++) _locs_used[i] = OopMapValue::unused_value;
115 #endif
116 }
117 
118 OopMap::OopMap(int data_size) {
119   // OopMaps are usually quite so small, so pick a small initial size
120   set_write_stream(new CompressedWriteStream(data_size));
121   set_omv_count(0);
122   _num_oops = 0;
123   _has_derived_oops = false;
124   _index = -1;
125 #ifdef ASSERT
126   _locs_length = 0;
127   _locs_used   = nullptr;
128 #endif
129 }
130 
131 OopMap::OopMap(OopMap::DeepCopyToken, OopMap* source) {
132   // This constructor does a deep copy
133   // of the source OopMap.
134   set_write_stream(new CompressedWriteStream(source->omv_count() * 2));
135   set_omv_count(0);
136   set_offset(source->offset());
137   _num_oops = source->num_oops();
138   _has_derived_oops = source->has_derived_oops();
139   _index = -1;
140 
141 #ifdef ASSERT
142   _locs_length = source->_locs_length;
143   _locs_used = NEW_RESOURCE_ARRAY(OopMapValue::oop_types, _locs_length);
144   for(int i = 0; i < _locs_length; i++) _locs_used[i] = OopMapValue::unused_value;
145 #endif
146 
147   // We need to copy the entries too.
148   for (OopMapStream oms(source); !oms.is_done(); oms.next()) {
149     OopMapValue omv = oms.current();

360 
361 
362 void OopMap::set_callee_saved(VMReg reg, VMReg caller_machine_register ) {
363   set_xxx(reg, OopMapValue::callee_saved_value, caller_machine_register);
364 }
365 
366 
367 void OopMap::set_derived_oop(VMReg reg, VMReg derived_from_local_register ) {
368   if( reg == derived_from_local_register ) {
369     // Actually an oop, derived shares storage with base,
370     set_oop(reg);
371   } else {
372     set_xxx(reg, OopMapValue::derived_oop_value, derived_from_local_register);
373   }
374 }
375 
376 // OopMapSet
377 
378 OopMapSet::OopMapSet() : _list(MinOopMapAllocation) {}
379 
380 OopMapSet::OopMapSet(int size) : _list(size) {}
381 
382 int OopMapSet::add_gc_map(int pc_offset, OopMap *map ) {
383   map->set_offset(pc_offset);
384 
385 #ifdef ASSERT
386   if(_list.length() > 0) {
387     OopMap* last = _list.last();
388     if (last->offset() == map->offset() ) {
389       fatal("OopMap inserted twice");
390     }
391     if (last->offset() > map->offset()) {
392       tty->print_cr( "WARNING, maps not sorted: pc[%d]=%d, pc[%d]=%d",
393                       _list.length(),last->offset(),_list.length()+1,map->offset());
394     }
395   }
396 #endif // ASSERT
397 
398   int index = add(map);
399   map->_index = index;
400   return index;
401 }
< prev index next >