Mercurial > hg > graal-compiler
comparison src/cpu/ppc/vm/nativeInst_ppc.cpp @ 20804:7848fc12602b
Merge with jdk8u40-b25
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 07 Apr 2015 14:58:49 +0200 |
parents | c5e86c5cd22e |
children |
comparison
equal
deleted
inserted
replaced
20184:84105dcdb05b | 20804:7848fc12602b |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2012, 2013 SAP AG. All rights reserved. | 3 * Copyright 2012, 2014 SAP AG. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | 5 * |
6 * This code is free software; you can redistribute it and/or modify it | 6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as | 7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. | 8 * published by the Free Software Foundation. |
98 | 98 |
99 CodeBuffer cb(addr_call, code_size + 1); | 99 CodeBuffer cb(addr_call, code_size + 1); |
100 MacroAssembler* a = new MacroAssembler(&cb); | 100 MacroAssembler* a = new MacroAssembler(&cb); |
101 | 101 |
102 // Patch the call. | 102 // Patch the call. |
103 if (ReoptimizeCallSequences && | 103 if (!ReoptimizeCallSequences || !a->is_within_range_of_b(dest, addr_call)) { |
104 a->is_within_range_of_b(dest, addr_call)) { | |
105 a->bl(dest); | |
106 } else { | |
107 address trampoline_stub_addr = get_trampoline(); | 104 address trampoline_stub_addr = get_trampoline(); |
108 | 105 |
109 // We did not find a trampoline stub because the current codeblob | 106 // We did not find a trampoline stub because the current codeblob |
110 // does not provide this information. The branch will be patched | 107 // does not provide this information. The branch will be patched |
111 // later during a final fixup, when all necessary information is | 108 // later during a final fixup, when all necessary information is |
113 if (trampoline_stub_addr == 0) | 110 if (trampoline_stub_addr == 0) |
114 return; | 111 return; |
115 | 112 |
116 // Patch the constant in the call's trampoline stub. | 113 // Patch the constant in the call's trampoline stub. |
117 NativeCallTrampolineStub_at(trampoline_stub_addr)->set_destination(dest); | 114 NativeCallTrampolineStub_at(trampoline_stub_addr)->set_destination(dest); |
118 | 115 dest = trampoline_stub_addr; |
119 a->bl(trampoline_stub_addr); | 116 } |
120 } | 117 |
118 OrderAccess::release(); | |
119 a->bl(dest); | |
120 | |
121 ICache::ppc64_flush_icache_bytes(addr_call, code_size); | 121 ICache::ppc64_flush_icache_bytes(addr_call, code_size); |
122 } | 122 } |
123 | 123 |
124 address NativeCall::get_trampoline() { | 124 address NativeCall::get_trampoline() { |
125 address call_addr = addr_at(0); | 125 address call_addr = addr_at(0); |
145 #ifdef ASSERT | 145 #ifdef ASSERT |
146 void NativeCall::verify() { | 146 void NativeCall::verify() { |
147 address addr = addr_at(0); | 147 address addr = addr_at(0); |
148 | 148 |
149 if (!NativeCall::is_call_at(addr)) { | 149 if (!NativeCall::is_call_at(addr)) { |
150 tty->print_cr("not a NativeCall at " PTR_FORMAT, addr); | 150 tty->print_cr("not a NativeCall at " PTR_FORMAT, p2i(addr)); |
151 // TODO: PPC port: Disassembler::decode(addr - 20, addr + 20, tty); | 151 // TODO: PPC port: Disassembler::decode(addr - 20, addr + 20, tty); |
152 fatal(err_msg("not a NativeCall at " PTR_FORMAT, addr)); | 152 fatal(err_msg("not a NativeCall at " PTR_FORMAT, p2i(addr))); |
153 } | 153 } |
154 } | 154 } |
155 #endif // ASSERT | 155 #endif // ASSERT |
156 | 156 |
157 #ifdef ASSERT | 157 #ifdef ASSERT |
158 void NativeFarCall::verify() { | 158 void NativeFarCall::verify() { |
159 address addr = addr_at(0); | 159 address addr = addr_at(0); |
160 | 160 |
161 NativeInstruction::verify(); | 161 NativeInstruction::verify(); |
162 if (!NativeFarCall::is_far_call_at(addr)) { | 162 if (!NativeFarCall::is_far_call_at(addr)) { |
163 tty->print_cr("not a NativeFarCall at " PTR_FORMAT, addr); | 163 tty->print_cr("not a NativeFarCall at " PTR_FORMAT, p2i(addr)); |
164 // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); | 164 // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); |
165 fatal(err_msg("not a NativeFarCall at " PTR_FORMAT, addr)); | 165 fatal(err_msg("not a NativeFarCall at " PTR_FORMAT, p2i(addr))); |
166 } | 166 } |
167 } | 167 } |
168 #endif // ASSERT | 168 #endif // ASSERT |
169 | 169 |
170 address NativeMovConstReg::next_instruction_address() const { | 170 address NativeMovConstReg::next_instruction_address() const { |
304 ! MacroAssembler::is_load_const_from_method_toc_at(addr)) { | 304 ! MacroAssembler::is_load_const_from_method_toc_at(addr)) { |
305 CodeBlob* cb = CodeCache::find_blob_unsafe(addr); // find_nmethod() asserts if nmethod is zombie. | 305 CodeBlob* cb = CodeCache::find_blob_unsafe(addr); // find_nmethod() asserts if nmethod is zombie. |
306 if (! (cb != NULL && MacroAssembler::is_calculate_address_from_global_toc_at(addr, cb->content_begin())) && | 306 if (! (cb != NULL && MacroAssembler::is_calculate_address_from_global_toc_at(addr, cb->content_begin())) && |
307 ! (cb != NULL && MacroAssembler::is_set_narrow_oop(addr, cb->content_begin())) && | 307 ! (cb != NULL && MacroAssembler::is_set_narrow_oop(addr, cb->content_begin())) && |
308 ! MacroAssembler::is_bl(*((int*) addr))) { | 308 ! MacroAssembler::is_bl(*((int*) addr))) { |
309 tty->print_cr("not a NativeMovConstReg at " PTR_FORMAT, addr); | 309 tty->print_cr("not a NativeMovConstReg at " PTR_FORMAT, p2i(addr)); |
310 // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); | 310 // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); |
311 fatal(err_msg("not a NativeMovConstReg at " PTR_FORMAT, addr)); | 311 fatal(err_msg("not a NativeMovConstReg at " PTR_FORMAT, p2i(addr))); |
312 } | 312 } |
313 } | 313 } |
314 } | 314 } |
315 #endif // ASSERT | 315 #endif // ASSERT |
316 | 316 |
342 void NativeJump::verify() { | 342 void NativeJump::verify() { |
343 address addr = addr_at(0); | 343 address addr = addr_at(0); |
344 | 344 |
345 NativeInstruction::verify(); | 345 NativeInstruction::verify(); |
346 if (!NativeJump::is_jump_at(addr)) { | 346 if (!NativeJump::is_jump_at(addr)) { |
347 tty->print_cr("not a NativeJump at " PTR_FORMAT, addr); | 347 tty->print_cr("not a NativeJump at " PTR_FORMAT, p2i(addr)); |
348 // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); | 348 // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); |
349 fatal(err_msg("not a NativeJump at " PTR_FORMAT, addr)); | 349 fatal(err_msg("not a NativeJump at " PTR_FORMAT, p2i(addr))); |
350 } | 350 } |
351 } | 351 } |
352 #endif // ASSERT | 352 #endif // ASSERT |
353 | 353 |
354 //------------------------------------------------------------------- | 354 //------------------------------------------------------------------- |