296 } else { |
296 } else { |
297 // make a copy the code which is going to be patched. |
297 // make a copy the code which is going to be patched. |
298 for (int i = 0; i < _bytes_to_copy; i++) { |
298 for (int i = 0; i < _bytes_to_copy; i++) { |
299 address ptr = (address)(_pc_start + i); |
299 address ptr = (address)(_pc_start + i); |
300 int a_byte = (*ptr) & 0xFF; |
300 int a_byte = (*ptr) & 0xFF; |
301 __ a_byte (a_byte); |
301 __ emit_int8 (a_byte); |
302 } |
302 } |
303 } |
303 } |
304 |
304 |
305 address end_of_patch = __ pc(); |
305 address end_of_patch = __ pc(); |
306 int bytes_to_skip = 0; |
306 int bytes_to_skip = 0; |
338 |
338 |
339 // emit the offsets needed to find the code to patch |
339 // emit the offsets needed to find the code to patch |
340 int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record; |
340 int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record; |
341 |
341 |
342 // Emit the patch record. We need to emit a full word, so emit an extra empty byte |
342 // Emit the patch record. We need to emit a full word, so emit an extra empty byte |
343 __ a_byte(0); |
343 __ emit_int8(0); |
344 __ a_byte(being_initialized_entry_offset); |
344 __ emit_int8(being_initialized_entry_offset); |
345 __ a_byte(bytes_to_skip); |
345 __ emit_int8(bytes_to_skip); |
346 __ a_byte(_bytes_to_copy); |
346 __ emit_int8(_bytes_to_copy); |
347 address patch_info_pc = __ pc(); |
347 address patch_info_pc = __ pc(); |
348 assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info"); |
348 assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info"); |
349 |
349 |
350 address entry = __ pc(); |
350 address entry = __ pc(); |
351 NativeGeneralJump::insert_unconditional((address)_pc_start, entry); |
351 NativeGeneralJump::insert_unconditional((address)_pc_start, entry); |