< prev index next >

src/hotspot/share/compiler/oopMap.cpp

Print this page

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












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

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


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

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

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