Skip to content

Commit

Permalink
Update (2025.02.19)
Browse files Browse the repository at this point in the history
35480: Fix the bugs related to LoongArch architecture support in JVMCI
  • Loading branch information
loongson-jvm authored Feb 19, 2025
1 parent 0c961cd commit 86b098a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/cpu/loongarch/jvmciCodeInstaller_loongarch.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Loongson Technology. All rights reserved.
* Copyright (c) 2022, 2025, Loongson Technology. 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
Expand Down Expand Up @@ -40,7 +40,7 @@ jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, JVMC
address pc = (address) inst;
if (inst->is_int_branch() || inst->is_float_branch()) {
return pc_offset + NativeInstruction::nop_instruction_size;
} else if (inst->is_call()) {
} else if (inst->is_call() || inst->is_jalr()) {
return pc_offset + NativeCall::instruction_size;
} else if (inst->is_far_call()) {
return pc_offset + NativeFarCall::instruction_size;
Expand Down
5 changes: 5 additions & 0 deletions src/hotspot/cpu/loongarch/nativeInst_loongarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ bool NativeInstruction::is_pcaddu12i_add() const {
Assembler::high(int_at(4), 10) == Assembler::addi_d_op;
}

bool NativeInstruction::is_jalr() const {
return Assembler::high(int_at(0), 6) == Assembler::jirl_op &&
Assembler::low(int_at(0), 5) == RA->encoding();
}

bool NativeCall::is_bl() const {
return Assembler::high(int_at(0), 6) == Assembler::bl_op;
}
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/cpu/loongarch/nativeInst_loongarch.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024, Loongson Technology. All rights reserved.
* Copyright (c) 2015, 2025, Loongson Technology. 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
Expand Down Expand Up @@ -76,6 +76,7 @@ class NativeInstruction {
bool is_lu12iw_lu32id() const;
bool is_pcaddu12i_add() const;
bool is_pcaddi() const;
bool is_jalr() const;

// LoongArch has no instruction to generate a illegal instruction exception?
// But `break 11` is not illegal instruction for LoongArch.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, Loongson Technology. All rights reserved.
* Copyright (c) 2022, 2025, Loongson Technology. 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
Expand Down Expand Up @@ -242,7 +242,7 @@ private CallingConvention callingConvention(RegisterArray generalParameterRegist
if (currentFloat < floatParameterRegisters.size()) {
Register register = floatParameterRegisters.get(currentFloat++);
locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
} else if (currentGeneral < generalParameterRegisters.size()) {
} else if (type == HotSpotCallingConventionType.NativeCall && currentGeneral < generalParameterRegisters.size()) {
Register register = generalParameterRegisters.get(currentGeneral++);
locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
}
Expand Down

0 comments on commit 86b098a

Please sign in to comment.