0N/A/*
3158N/A * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef CPU_SPARC_VM_ASSEMBLER_SPARC_INLINE_HPP
1879N/A#define CPU_SPARC_VM_ASSEMBLER_SPARC_INLINE_HPP
1879N/A
1879N/A#include "asm/assembler.inline.hpp"
1879N/A#include "asm/codeBuffer.hpp"
1879N/A#include "code/codeCache.hpp"
1879N/A#include "runtime/handles.inline.hpp"
1879N/A
0N/Ainline void MacroAssembler::pd_patch_instruction(address branch, address target) {
0N/A jint& stub_inst = *(jint*) branch;
0N/A stub_inst = patched_branch(target - branch, stub_inst, 0);
0N/A}
0N/A
0N/A#ifndef PRODUCT
0N/Ainline void MacroAssembler::pd_print_patched_instruction(address branch) {
0N/A jint stub_inst = *(jint*) branch;
0N/A print_instruction(stub_inst);
0N/A ::tty->print("%s", " (unresolved)");
0N/A}
0N/A#endif // PRODUCT
0N/A
0N/Ainline bool Address::is_simm13(int offset) { return Assembler::is_simm13(disp() + offset); }
0N/A
0N/A
727N/Ainline int AddressLiteral::low10() const {
727N/A return Assembler::low10(value());
727N/A}
727N/A
727N/A
0N/A// inlines for SPARC assembler -- dmu 5/97
0N/A
0N/Ainline void Assembler::check_delay() {
0N/A# ifdef CHECK_DELAY
0N/A guarantee( delay_state != at_delay_slot, "must say delayed() when filling delay slot");
0N/A delay_state = no_delay;
0N/A# endif
0N/A}
0N/A
0N/Ainline void Assembler::emit_long(int x) {
0N/A check_delay();
0N/A AbstractAssembler::emit_long(x);
0N/A}
0N/A
0N/Ainline void Assembler::emit_data(int x, relocInfo::relocType rtype) {
0N/A relocate(rtype);
0N/A emit_long(x);
0N/A}
0N/A
0N/Ainline void Assembler::emit_data(int x, RelocationHolder const& rspec) {
0N/A relocate(rspec);
0N/A emit_long(x);
0N/A}
0N/A
0N/A
727N/Ainline void Assembler::add(Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | rs2(s2) ); }
727N/Ainline void Assembler::add(Register s1, int simm13a, Register d, relocInfo::relocType rtype ) { emit_data( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rtype ); }
727N/Ainline void Assembler::add(Register s1, int simm13a, Register d, RelocationHolder const& rspec ) { emit_data( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rspec ); }
0N/A
2664N/Ainline void Assembler::bpr( RCondition c, bool a, Predict p, Register s1, address d, relocInfo::relocType rt ) { v9_only(); cti(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(bpr_op2) | wdisp16(intptr_t(d), intptr_t(pc())) | predict(p) | rs1(s1), rt); has_delay_slot(); }
0N/Ainline void Assembler::bpr( RCondition c, bool a, Predict p, Register s1, Label& L) { bpr( c, a, p, s1, target(L)); }
0N/A
2664N/Ainline void Assembler::fb( Condition c, bool a, address d, relocInfo::relocType rt ) { v9_dep(); cti(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(fb_op2) | wdisp(intptr_t(d), intptr_t(pc()), 22), rt); has_delay_slot(); }
0N/Ainline void Assembler::fb( Condition c, bool a, Label& L ) { fb(c, a, target(L)); }
0N/A
2664N/Ainline void Assembler::fbp( Condition c, bool a, CC cc, Predict p, address d, relocInfo::relocType rt ) { v9_only(); cti(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(fbp_op2) | branchcc(cc) | predict(p) | wdisp(intptr_t(d), intptr_t(pc()), 19), rt); has_delay_slot(); }
0N/Ainline void Assembler::fbp( Condition c, bool a, CC cc, Predict p, Label& L ) { fbp(c, a, cc, p, target(L)); }
0N/A
2664N/Ainline void Assembler::cb( Condition c, bool a, address d, relocInfo::relocType rt ) { v8_only(); cti(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(cb_op2) | wdisp(intptr_t(d), intptr_t(pc()), 22), rt); has_delay_slot(); }
0N/Ainline void Assembler::cb( Condition c, bool a, Label& L ) { cb(c, a, target(L)); }
0N/A
2664N/Ainline void Assembler::br( Condition c, bool a, address d, relocInfo::relocType rt ) { v9_dep(); cti(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(br_op2) | wdisp(intptr_t(d), intptr_t(pc()), 22), rt); has_delay_slot(); }
0N/Ainline void Assembler::br( Condition c, bool a, Label& L ) { br(c, a, target(L)); }
0N/A
2664N/Ainline void Assembler::bp( Condition c, bool a, CC cc, Predict p, address d, relocInfo::relocType rt ) { v9_only(); cti(); emit_data( op(branch_op) | annul(a) | cond(c) | op2(bp_op2) | branchcc(cc) | predict(p) | wdisp(intptr_t(d), intptr_t(pc()), 19), rt); has_delay_slot(); }
0N/Ainline void Assembler::bp( Condition c, bool a, CC cc, Predict p, Label& L ) { bp(c, a, cc, p, target(L)); }
0N/A
2664N/A// compare and branch
2664N/Ainline void Assembler::cbcond(Condition c, CC cc, Register s1, Register s2, Label& L) { cti(); no_cbcond_before(); emit_data(op(branch_op) | cond_cbcond(c) | op2(bpr_op2) | branchcc(cc) | wdisp10(intptr_t(target(L)), intptr_t(pc())) | rs1(s1) | rs2(s2)); }
2664N/Ainline void Assembler::cbcond(Condition c, CC cc, Register s1, int simm5, Label& L) { cti(); no_cbcond_before(); emit_data(op(branch_op) | cond_cbcond(c) | op2(bpr_op2) | branchcc(cc) | wdisp10(intptr_t(target(L)), intptr_t(pc())) | rs1(s1) | immed(true) | simm(simm5, 5)); }
2664N/A
2664N/Ainline void Assembler::call( address d, relocInfo::relocType rt ) { cti(); emit_data( op(call_op) | wdisp(intptr_t(d), intptr_t(pc()), 30), rt); has_delay_slot(); assert(rt != relocInfo::virtual_call_type, "must use virtual_call_Relocation::spec"); }
0N/Ainline void Assembler::call( Label& L, relocInfo::relocType rt ) { call( target(L), rt); }
0N/A
0N/Ainline void Assembler::flush( Register s1, Register s2) { emit_long( op(arith_op) | op3(flush_op3) | rs1(s1) | rs2(s2)); }
0N/Ainline void Assembler::flush( Register s1, int simm13a) { emit_data( op(arith_op) | op3(flush_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/A
2664N/Ainline void Assembler::jmpl( Register s1, Register s2, Register d ) { cti(); emit_long( op(arith_op) | rd(d) | op3(jmpl_op3) | rs1(s1) | rs2(s2)); has_delay_slot(); }
2664N/Ainline void Assembler::jmpl( Register s1, int simm13a, Register d, RelocationHolder const& rspec ) { cti(); emit_data( op(arith_op) | rd(d) | op3(jmpl_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rspec); has_delay_slot(); }
0N/A
1006N/Ainline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, RegisterOrConstant s2, FloatRegister d) {
1006N/A if (s2.is_register()) ldf(w, s1, s2.as_register(), d);
1006N/A else ldf(w, s1, s2.as_constant(), d);
1006N/A}
1006N/A
727N/Ainline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, Register s2, FloatRegister d) { emit_long( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | rs2(s2) ); }
727N/Ainline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, int simm13a, FloatRegister d, RelocationHolder const& rspec) { emit_data( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13), rspec); }
0N/A
727N/Ainline void Assembler::ldf(FloatRegisterImpl::Width w, const Address& a, FloatRegister d, int offset) { relocate(a.rspec(offset)); ldf( w, a.base(), a.disp() + offset, d); }
0N/A
0N/Ainline void Assembler::ldfsr( Register s1, Register s2) { v9_dep(); emit_long( op(ldst_op) | op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldfsr( Register s1, int simm13a) { v9_dep(); emit_data( op(ldst_op) | op3(ldfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/Ainline void Assembler::ldxfsr( Register s1, Register s2) { v9_only(); emit_long( op(ldst_op) | rd(G1) | op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldxfsr( Register s1, int simm13a) { v9_only(); emit_data( op(ldst_op) | rd(G1) | op3(ldfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/A
0N/Ainline void Assembler::ldc( Register s1, Register s2, int crd) { v8_only(); emit_long( op(ldst_op) | fcn(crd) | op3(ldc_op3 ) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldc( Register s1, int simm13a, int crd) { v8_only(); emit_data( op(ldst_op) | fcn(crd) | op3(ldc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/Ainline void Assembler::lddc( Register s1, Register s2, int crd) { v8_only(); emit_long( op(ldst_op) | fcn(crd) | op3(lddc_op3 ) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::lddc( Register s1, int simm13a, int crd) { v8_only(); emit_data( op(ldst_op) | fcn(crd) | op3(lddc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/Ainline void Assembler::ldcsr( Register s1, Register s2, int crd) { v8_only(); emit_long( op(ldst_op) | fcn(crd) | op3(ldcsr_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldcsr( Register s1, int simm13a, int crd) { v8_only(); emit_data( op(ldst_op) | fcn(crd) | op3(ldcsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/A
0N/Ainline void Assembler::ldsb( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldsb( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsb_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/A
0N/Ainline void Assembler::ldsh( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsh_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldsh( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsh_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/Ainline void Assembler::ldsw( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsw_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldsw( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/Ainline void Assembler::ldub( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldub_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldub( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldub_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/Ainline void Assembler::lduh( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(lduh_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::lduh( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(lduh_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/Ainline void Assembler::lduw( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(lduw_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::lduw( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(lduw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/A
0N/Ainline void Assembler::ldx( Register s1, Register s2, Register d) { v9_only(); emit_long( op(ldst_op) | rd(d) | op3(ldx_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldx( Register s1, int simm13a, Register d) { v9_only(); emit_data( op(ldst_op) | rd(d) | op3(ldx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/Ainline void Assembler::ldd( Register s1, Register s2, Register d) { v9_dep(); assert(d->is_even(), "not even"); emit_long( op(ldst_op) | rd(d) | op3(ldd_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldd( Register s1, int simm13a, Register d) { v9_dep(); assert(d->is_even(), "not even"); emit_data( op(ldst_op) | rd(d) | op3(ldd_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/A
0N/A#ifdef _LP64
0N/A// Make all 32 bit loads signed so 64 bit registers maintain proper sign
727N/Ainline void Assembler::ld( Register s1, Register s2, Register d) { ldsw( s1, s2, d); }
727N/Ainline void Assembler::ld( Register s1, int simm13a, Register d) { ldsw( s1, simm13a, d); }
0N/A#else
727N/Ainline void Assembler::ld( Register s1, Register s2, Register d) { lduw( s1, s2, d); }
727N/Ainline void Assembler::ld( Register s1, int simm13a, Register d) { lduw( s1, simm13a, d); }
727N/A#endif
727N/A
727N/A#ifdef ASSERT
727N/A // ByteSize is only a class when ASSERT is defined, otherwise it's an int.
727N/A# ifdef _LP64
727N/Ainline void Assembler::ld( Register s1, ByteSize simm13a, Register d) { ldsw( s1, in_bytes(simm13a), d); }
727N/A# else
727N/Ainline void Assembler::ld( Register s1, ByteSize simm13a, Register d) { lduw( s1, in_bytes(simm13a), d); }
727N/A# endif
0N/A#endif
0N/A
727N/Ainline void Assembler::ld( const Address& a, Register d, int offset) {
727N/A if (a.has_index()) { assert(offset == 0, ""); ld( a.base(), a.index(), d); }
727N/A else { ld( a.base(), a.disp() + offset, d); }
622N/A}
727N/Ainline void Assembler::ldsb(const Address& a, Register d, int offset) {
727N/A if (a.has_index()) { assert(offset == 0, ""); ldsb(a.base(), a.index(), d); }
727N/A else { ldsb(a.base(), a.disp() + offset, d); }
622N/A}
727N/Ainline void Assembler::ldsh(const Address& a, Register d, int offset) {
727N/A if (a.has_index()) { assert(offset == 0, ""); ldsh(a.base(), a.index(), d); }
727N/A else { ldsh(a.base(), a.disp() + offset, d); }
622N/A}
727N/Ainline void Assembler::ldsw(const Address& a, Register d, int offset) {
727N/A if (a.has_index()) { assert(offset == 0, ""); ldsw(a.base(), a.index(), d); }
727N/A else { ldsw(a.base(), a.disp() + offset, d); }
727N/A}
727N/Ainline void Assembler::ldub(const Address& a, Register d, int offset) {
727N/A if (a.has_index()) { assert(offset == 0, ""); ldub(a.base(), a.index(), d); }
727N/A else { ldub(a.base(), a.disp() + offset, d); }
622N/A}
727N/Ainline void Assembler::lduh(const Address& a, Register d, int offset) {
727N/A if (a.has_index()) { assert(offset == 0, ""); lduh(a.base(), a.index(), d); }
727N/A else { lduh(a.base(), a.disp() + offset, d); }
622N/A}
727N/Ainline void Assembler::lduw(const Address& a, Register d, int offset) {
727N/A if (a.has_index()) { assert(offset == 0, ""); lduw(a.base(), a.index(), d); }
727N/A else { lduw(a.base(), a.disp() + offset, d); }
727N/A}
727N/Ainline void Assembler::ldd( const Address& a, Register d, int offset) {
727N/A if (a.has_index()) { assert(offset == 0, ""); ldd( a.base(), a.index(), d); }
727N/A else { ldd( a.base(), a.disp() + offset, d); }
622N/A}
727N/Ainline void Assembler::ldx( const Address& a, Register d, int offset) {
727N/A if (a.has_index()) { assert(offset == 0, ""); ldx( a.base(), a.index(), d); }
727N/A else { ldx( a.base(), a.disp() + offset, d); }
622N/A}
727N/A
727N/Ainline void Assembler::ldub(Register s1, RegisterOrConstant s2, Register d) { ldub(Address(s1, s2), d); }
727N/Ainline void Assembler::ldsb(Register s1, RegisterOrConstant s2, Register d) { ldsb(Address(s1, s2), d); }
727N/Ainline void Assembler::lduh(Register s1, RegisterOrConstant s2, Register d) { lduh(Address(s1, s2), d); }
727N/Ainline void Assembler::ldsh(Register s1, RegisterOrConstant s2, Register d) { ldsh(Address(s1, s2), d); }
727N/Ainline void Assembler::lduw(Register s1, RegisterOrConstant s2, Register d) { lduw(Address(s1, s2), d); }
727N/Ainline void Assembler::ldsw(Register s1, RegisterOrConstant s2, Register d) { ldsw(Address(s1, s2), d); }
727N/Ainline void Assembler::ldx( Register s1, RegisterOrConstant s2, Register d) { ldx( Address(s1, s2), d); }
727N/Ainline void Assembler::ld( Register s1, RegisterOrConstant s2, Register d) { ld( Address(s1, s2), d); }
727N/Ainline void Assembler::ldd( Register s1, RegisterOrConstant s2, Register d) { ldd( Address(s1, s2), d); }
622N/A
622N/A// form effective addresses this way:
1831N/Ainline void Assembler::add(const Address& a, Register d, int offset) {
1831N/A if (a.has_index()) add(a.base(), a.index(), d);
1831N/A else { add(a.base(), a.disp() + offset, d, a.rspec(offset)); offset = 0; }
1831N/A if (offset != 0) add(d, offset, d);
1831N/A}
1423N/Ainline void Assembler::add(Register s1, RegisterOrConstant s2, Register d, int offset) {
1423N/A if (s2.is_register()) add(s1, s2.as_register(), d);
622N/A else { add(s1, s2.as_constant() + offset, d); offset = 0; }
622N/A if (offset != 0) add(d, offset, d);
622N/A}
0N/A
1423N/Ainline void Assembler::andn(Register s1, RegisterOrConstant s2, Register d) {
1423N/A if (s2.is_register()) andn(s1, s2.as_register(), d);
1423N/A else andn(s1, s2.as_constant(), d);
1423N/A}
1423N/A
0N/Ainline void Assembler::ldstub( Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldstub_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::ldstub( Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldstub_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/A
0N/A
0N/Ainline void Assembler::prefetch(Register s1, Register s2, PrefetchFcn f) { v9_only(); emit_long( op(ldst_op) | fcn(f) | op3(prefetch_op3) | rs1(s1) | rs2(s2) ); }
0N/Ainline void Assembler::prefetch(Register s1, int simm13a, PrefetchFcn f) { v9_only(); emit_data( op(ldst_op) | fcn(f) | op3(prefetch_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
0N/A
0N/Ainline void Assembler::prefetch(const Address& a, PrefetchFcn f, int offset) { v9_only(); relocate(a.rspec(offset)); prefetch(a.base(), a.disp() + offset, f); }
0N/A
0N/A
2664N/Ainline void Assembler::rett( Register s1, Register s2 ) { cti(); emit_long( op(arith_op) | op3(rett_op3) | rs1(s1) | rs2(s2)); has_delay_slot(); }
2664N/Ainline void Assembler::rett( Register s1, int simm13a, relocInfo::relocType rt) { cti(); emit_data( op(arith_op) | op3(rett_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rt); has_delay_slot(); }
0N/A
0N/Ainline void Assembler::sethi( int imm22a, Register d, RelocationHolder const& rspec ) { emit_data( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(imm22a), rspec); }
0N/A
0N/A // pp 222
0N/A
1006N/Ainline void Assembler::stf( FloatRegisterImpl::Width w, FloatRegister d, Register s1, RegisterOrConstant s2) {
1006N/A if (s2.is_register()) stf(w, d, s1, s2.as_register());
1006N/A else stf(w, d, s1, s2.as_constant());
1006N/A}
1006N/A
0N/Ainline void Assembler:: Error!

 

There was an error!

null

java.lang.NullPointerException