/* * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// Do not rely on add2reg* emitter. // Depending on CmdLine switches and actual parameter values, // the generated code may alter the condition code, which is counter-intuitive // to the semantics of the "load address" (LA/LAY) instruction. // Generic address loading d <- base(a) + index(a) + disp(a) inlinevoid MacroAssembler::load_address(Register d, const Address &a) { if (Displacement::is_shortDisp(a.disp())) {
z_la(d, a.disp(), a.indexOrR0(), a.baseOrR0());
} elseif (Displacement::is_validDisp(a.disp())) {
z_lay(d, a.disp(), a.indexOrR0(), a.baseOrR0());
} else {
guarantee(false, "displacement = " SIZE_FORMAT_X ", out of range for LA/LAY", a.disp());
}
}
// Load a 64 bit constant encoded by a `Label'. // Works for bound as well as unbound labels. For unbound labels, the // code will become patched as soon as the label gets bound. inlinevoid MacroAssembler::load_const(Register t, Label& L) {
load_const(t, target(L));
}
inlinevoid MacroAssembler::load_const(Register t, const AddressLiteral& a) {
assert(t != Z_R0, "R0 not allowed"); // First relocate (we don't change the offset in the RelocationHolder, // just pass a.rspec()), then delegate to load_const(Register, long).
relocate(a.rspec());
load_const(t, (long)a.value());
}
// Adds MetaData constant md to TOC and loads it from there. // md is added to the oop_recorder, but no relocation is added. inlinebool MacroAssembler::set_metadata_constant(Metadata* md, Register d) {
AddressLiteral a = constant_metadata_address(md); return load_const_from_toc(d, a, d); // Discards the relocation.
}
inlinebool MacroAssembler::is_call_pcrelative_short(unsignedlong inst) { return is_equal(inst, BRAS_ZOPC); // off 16, len 16
}
inlinebool MacroAssembler::is_call_pcrelative_long(unsignedlong inst) { return is_equal(inst, BRASL_ZOPC); // off 16, len 32
}
inlinebool MacroAssembler::is_branch_pcrelative_short(unsignedlong inst) { // Branch relative, 16-bit offset. return is_equal(inst, BRC_ZOPC); // off 16, len 16
}
inlinebool MacroAssembler::is_branch_pcrelative_long(unsignedlong inst) { // Branch relative, 32-bit offset. return is_equal(inst, BRCL_ZOPC); // off 16, len 32
}
// Dynamic TOC. Test for any pc-relative instruction. inlinebool MacroAssembler::is_pcrelative_instruction(address iloc) { unsignedlong inst;
get_instruction(iloc, &inst); return is_pcrelative_short(inst) ||
is_pcrelative_long(inst);
}
inlinebool MacroAssembler::is_load_addr_pcrel(address a) { return is_equal(a, LARL_ZOPC, LARL_MASK);
}
// Save the return pc in the register that should be stored as the return pc // in the current frame (default is R14). inlinevoid MacroAssembler::save_return_pc(Register pc) {
z_stg(pc, _z_abi16(return_pc), Z_SP);
}
// Call a function with given entry. inline address MacroAssembler::call(Register function_entry) {
assert(function_entry != Z_R0, "function_entry cannot be Z_R0");
// Call a C function via a function entry. inline address MacroAssembler::call_c(Register function_entry) { return call(function_entry);
}
// Call a stub function via a function descriptor, but don't save TOC before // call, don't setup TOC and ENV for call, and don't restore TOC after call inline address MacroAssembler::call_stub(Register function_entry) { return call_c(function_entry);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.