Mercurial > hg > truffle
comparison src/share/vm/runtime/relocator.cpp @ 14909:4ca6dc0799b6
Backout jdk9 merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 01 Apr 2014 13:57:07 +0200 |
parents | 63a4eb8bcd23 |
children |
comparison
equal
deleted
inserted
replaced
14908:8db6e76cb658 | 14909:4ca6dc0799b6 |
---|---|
139 set_compressed_line_number_table_size(0); | 139 set_compressed_line_number_table_size(0); |
140 _listener = listener; | 140 _listener = listener; |
141 } | 141 } |
142 | 142 |
143 // size is the new size of the instruction at bci. Hence, if size is less than the current | 143 // size is the new size of the instruction at bci. Hence, if size is less than the current |
144 // instruction size, we will shrink the code. | 144 // instruction sice, we will shrink the code. |
145 methodHandle Relocator::insert_space_at(int bci, int size, u_char inst_buffer[], TRAPS) { | 145 methodHandle Relocator::insert_space_at(int bci, int size, u_char inst_buffer[], TRAPS) { |
146 _changes = new GrowableArray<ChangeItem*> (10); | 146 _changes = new GrowableArray<ChangeItem*> (10); |
147 _changes->push(new ChangeWiden(bci, size, inst_buffer)); | 147 _changes->push(new ChangeWiden(bci, size, inst_buffer)); |
148 | 148 |
149 if (TraceRelocator) { | 149 if (TraceRelocator) { |
190 } | 190 } |
191 | 191 |
192 // Execute operation | 192 // Execute operation |
193 if (!ci->handle_code_change(this)) return false; | 193 if (!ci->handle_code_change(this)) return false; |
194 | 194 |
195 // Shuffle items up | 195 // Shuffel items up |
196 for (int index = 1; index < _changes->length(); index++) { | 196 for (int index = 1; index < _changes->length(); index++) { |
197 _changes->at_put(index-1, _changes->at(index)); | 197 _changes->at_put(index-1, _changes->at(index)); |
198 } | 198 } |
199 _changes->pop(); | 199 _changes->pop(); |
200 } | 200 } |
212 } | 212 } |
213 return true; // dummy | 213 return true; // dummy |
214 } | 214 } |
215 | 215 |
216 // We need a special instruction size method, since lookupswitches and tableswitches might not be | 216 // We need a special instruction size method, since lookupswitches and tableswitches might not be |
217 // properly aligned during relocation | 217 // properly alligned during relocation |
218 int Relocator::rc_instr_len(int bci) { | 218 int Relocator::rc_instr_len(int bci) { |
219 Bytecodes::Code bc= code_at(bci); | 219 Bytecodes::Code bc= code_at(bci); |
220 switch (bc) { | 220 switch (bc) { |
221 // In the case of switch instructions, see if we have the original | 221 // In the case of switch instructions, see if we have the original |
222 // padding recorded. | 222 // padding recorded. |
609 // Change jumps before doing the copying; this routine requires aligned switches. | 609 // Change jumps before doing the copying; this routine requires aligned switches. |
610 change_jumps(bci, delta); | 610 change_jumps(bci, delta); |
611 | 611 |
612 // In case we have shrunken a tableswitch/lookupswitch statement, we store the last | 612 // In case we have shrunken a tableswitch/lookupswitch statement, we store the last |
613 // bytes that get overwritten. We have to copy the bytes after the change_jumps method | 613 // bytes that get overwritten. We have to copy the bytes after the change_jumps method |
614 // has been called, since it is likely to update last offset in a tableswitch/lookupswitch | 614 // has been called, since it is likly to update last offset in a tableswitch/lookupswitch |
615 if (delta < 0) { | 615 if (delta < 0) { |
616 assert(delta>=-3, "we cannot overwrite more than 3 bytes"); | 616 assert(delta>=-3, "we cannot overwrite more than 3 bytes"); |
617 memcpy(_overwrite, addr_at(bci + ilen + delta), -delta); | 617 memcpy(_overwrite, addr_at(bci + ilen + delta), -delta); |
618 } | 618 } |
619 | 619 |