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