Skip to content

Commit

Permalink
Updated asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
robehn committed Oct 14, 2024
1 parent 1bab811 commit b60789e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/assembler_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2892,7 +2892,7 @@ enum Nf {
protected:
// All calls and jumps must go via MASM.
void jalr(Register Rd, Register Rs, const int32_t offset) {
assert(Rd != x5 && Rs != x5, "Register x5 not used for calls/jumps.");
assert(Rd != x5 && Rs != x5, "Register x5 must not be used for calls/jumps.");
/* jalr -> c.jr/c.jalr */
if (do_compress() && (offset == 0 && Rs != x0)) {
if (Rd == x1) {
Expand All @@ -2907,7 +2907,7 @@ enum Nf {
}

void jal(Register Rd, const int32_t offset) {
assert(Rd != x5, "Register x5 not used for calls/jumps.");
assert(Rd != x5, "Register x5 must not be used for calls/jumps.");
/* jal -> c.j, note c.jal is RV32C only */
if (do_compress() &&
Rd == x0 &&
Expand Down
15 changes: 5 additions & 10 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,7 @@ void MacroAssembler::li(Register Rd, int64_t imm) {

void MacroAssembler::load_link_jump(const address source, Register temp) {
assert(temp != noreg && temp != x0, "expecting a register");
assert(temp != x5, "Register x5 not used for calls.");
assert(temp != x1, "Register x1 not used for calls.");
assert(temp != x5 && temp != x1, "temp register must not be x1/x5.");
assert_cond(source != nullptr);
int64_t distance = source - pc();
assert(is_simm32(distance), "Must be");
Expand Down Expand Up @@ -1009,31 +1008,27 @@ void MacroAssembler::j(Label &lab, Register temp) {

void MacroAssembler::jr(Register Rd, int32_t offset) {
assert(Rd != noreg, "expecting a register");
assert(Rd != x5, "Register x5 not used for jumps.");
assert(Rd != x1, "Register x1 not used for jumps.");
assert(Rd != x1 && Rd != x5, "Rd register must not be x1/x5.");
Assembler::jalr(x0, Rd, offset);
}

void MacroAssembler::call(const address dest, Register temp) {
assert_cond(dest != nullptr);
assert(temp != noreg, "expecting a register");
assert(temp != x5, "Register x5 not used for jumps.");
assert(temp != x1, "Register x1 not used for jumps.");
assert(temp != x1 && temp != x5, "temp register must not be x1/x5.");
int32_t offset = 0;
la(temp, dest, offset);
jalr(temp, offset);
}

void MacroAssembler::jalr(Register Rs, int32_t offset) {
assert(Rs != noreg, "expecting a register");
assert(Rs != x1, "expecting a register");
assert(Rs != x5, "expecting a register");
assert(Rs != x1 && Rs != x5, "Rs register must not be x1/x5.");
Assembler::jalr(x1, Rs, offset);
}

void MacroAssembler::rt_call(address dest, Register tmp) {
assert(tmp != x5, "Register x5 not used for jumps.");
assert(tmp != x1, "Register x1 not used for jumps.");
assert(tmp != x1 && tmp != x5, "tmp register must not be x1/x5.");
CodeBlob *cb = CodeCache::find_blob(dest);
RuntimeAddress target(dest);
if (cb) {
Expand Down

0 comments on commit b60789e

Please sign in to comment.