1 // |
1 // |
2 // Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. |
2 // Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. |
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 // |
4 // |
5 // This code is free software; you can redistribute it and/or modify it |
5 // This code is free software; you can redistribute it and/or modify it |
6 // under the terms of the GNU General Public License version 2 only, as |
6 // under the terms of the GNU General Public License version 2 only, as |
7 // published by the Free Software Foundation. |
7 // published by the Free Software Foundation. |
939 } |
943 } |
940 } |
944 } |
941 #endif |
945 #endif |
942 } |
946 } |
943 |
947 |
944 void emit_call_reloc(CodeBuffer &cbuf, intptr_t entry_point, relocInfo::relocType rtype, bool preserve_g2 = false, bool force_far_call = false) { |
948 void emit_call_reloc(CodeBuffer &cbuf, intptr_t entry_point, relocInfo::relocType rtype, bool preserve_g2 = false) { |
945 // The method which records debug information at every safepoint |
949 // The method which records debug information at every safepoint |
946 // expects the call to be the first instruction in the snippet as |
950 // expects the call to be the first instruction in the snippet as |
947 // it creates a PcDesc structure which tracks the offset of a call |
951 // it creates a PcDesc structure which tracks the offset of a call |
948 // from the start of the codeBlob. This offset is computed as |
952 // from the start of the codeBlob. This offset is computed as |
949 // code_end() - code_begin() of the code which has been emitted |
953 // code_end() - code_begin() of the code which has been emitted |
961 |
965 |
962 #ifdef ASSERT |
966 #ifdef ASSERT |
963 int startpos = __ offset(); |
967 int startpos = __ offset(); |
964 #endif /* ASSERT */ |
968 #endif /* ASSERT */ |
965 |
969 |
966 #ifdef _LP64 |
970 __ call((address)entry_point, rtype); |
967 // Calls to the runtime or native may not be reachable from compiled code, |
|
968 // so we generate the far call sequence on 64 bit sparc. |
|
969 // This code sequence is relocatable to any address, even on LP64. |
|
970 if ( force_far_call ) { |
|
971 __ relocate(rtype); |
|
972 AddressLiteral dest(entry_point); |
|
973 __ jumpl_to(dest, O7, O7); |
|
974 } |
|
975 else |
|
976 #endif |
|
977 { |
|
978 __ call((address)entry_point, rtype); |
|
979 } |
|
980 |
971 |
981 if (preserve_g2) __ delayed()->mov(G2, L7); |
972 if (preserve_g2) __ delayed()->mov(G2, L7); |
982 else __ delayed()->nop(); |
973 else __ delayed()->nop(); |
983 |
974 |
984 if (preserve_g2) __ mov(L7, G2); |
975 if (preserve_g2) __ mov(L7, G2); |
2505 |
2496 |
2506 enc_class Java_To_Runtime (method meth) %{ // CALL Java_To_Runtime |
2497 enc_class Java_To_Runtime (method meth) %{ // CALL Java_To_Runtime |
2507 // CALL directly to the runtime |
2498 // CALL directly to the runtime |
2508 // The user of this is responsible for ensuring that R_L7 is empty (killed). |
2499 // The user of this is responsible for ensuring that R_L7 is empty (killed). |
2509 emit_call_reloc(cbuf, $meth$$method, relocInfo::runtime_call_type, |
2500 emit_call_reloc(cbuf, $meth$$method, relocInfo::runtime_call_type, |
2510 /*preserve_g2=*/true, /*force far call*/true); |
2501 /*preserve_g2=*/true); |
2511 %} |
2502 %} |
2512 |
2503 |
2513 enc_class preserve_SP %{ |
2504 enc_class preserve_SP %{ |
2514 MacroAssembler _masm(&cbuf); |
2505 MacroAssembler _masm(&cbuf); |
2515 __ mov(SP, L7_mh_SP_save); |
2506 __ mov(SP, L7_mh_SP_save); |