Skip to content

Commit

Permalink
Update (2024.01.29)
Browse files Browse the repository at this point in the history
33504: LA port of 8322294: Cleanup NativePostCallNop
33503: Eliminate -Wparentheses warnings in LoongArch code
33502: LA port of 8237842: Separate definitions for default cache line and padding sizes
  • Loading branch information
loongson-jvm authored Jan 29, 2024
1 parent 44a6530 commit 9529d19
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 29 deletions.
4 changes: 1 addition & 3 deletions src/hotspot/cpu/loongarch/frame_loongarch.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Loongson Technology. All rights reserved.
* Copyright (c) 2015, 2024, 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 @@ -155,8 +155,6 @@
static void verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp);
#endif

const ImmutableOopMap* get_oop_map() const;

public:
// Constructors

Expand Down
18 changes: 2 additions & 16 deletions src/hotspot/cpu/loongarch/frame_loongarch.inline.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Loongson Technology. All rights reserved.
* Copyright (c) 2015, 2024, 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 @@ -183,7 +183,7 @@ inline bool frame::equal(frame other) const {
unextended_sp() == other.unextended_sp() &&
fp() == other.fp() &&
pc() == other.pc();
assert(!ret || ret && cb() == other.cb() && _deopt_state == other._deopt_state, "inconsistent construction");
assert(!ret || (cb() == other.cb() && _deopt_state == other._deopt_state), "inconsistent construction");
return ret;
}

Expand Down Expand Up @@ -342,20 +342,6 @@ inline int frame::sender_sp_ret_address_offset() {
return frame::sender_sp_offset - frame::return_addr_offset;
}

inline const ImmutableOopMap* frame::get_oop_map() const {
if (_cb == nullptr) return nullptr;
if (_cb->oop_maps() != nullptr) {
NativePostCallNop* nop = nativePostCallNop_at(_pc);
if (nop != nullptr && nop->displacement() != 0) {
int slot = ((nop->displacement() >> 24) & 0xff);
return _cb->oop_map_for_slot(slot, _pc);
}
const ImmutableOopMap* oop_map = OopMapSet::find_map(this);
return oop_map;
}
return nullptr;
}

//------------------------------------------------------------------------------
// frame::sender
frame frame::sender(RegisterMap* map) const {
Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/cpu/loongarch/globalDefinitions_loongarch.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Loongson Technology. All rights reserved.
* Copyright (c) 2015, 2024, 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 @@ -53,6 +53,10 @@ const bool CCallingConventionRequiresIntsAsLongs = false;

#define USE_POINTERS_TO_REGISTER_IMPL_ARRAY

// The expected size in bytes of a cache line.
#define DEFAULT_CACHE_LINE_SIZE 64

// The default padding size for data structures to avoid false sharing.
#define DEFAULT_PADDING_SIZE DEFAULT_CACHE_LINE_SIZE

#endif // CPU_LOONGARCH_GLOBALDEFINITIONS_LOONGARCH_HPP
15 changes: 10 additions & 5 deletions src/hotspot/cpu/loongarch/nativeInst_loongarch.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Loongson Technology. All rights reserved.
* Copyright (c) 2015, 2024, 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 @@ -511,12 +511,16 @@ void NativePostCallNop::make_deopt() {
NativeDeoptInstruction::insert(addr_at(0));
}

void NativePostCallNop::patch(jint diff) {
assert(diff != 0, "must be");
bool NativePostCallNop::patch(int32_t oopmap_slot, int32_t cb_offset) {
if (((oopmap_slot & 0xff) != oopmap_slot) || ((cb_offset & 0xffffff) != cb_offset)) {
return false; // cannot encode
}
uint32_t data = ((uint32_t)oopmap_slot << 24) | cb_offset;
assert(data != 0, "must be");
assert(check(), "must be");

int lo = (diff & 0xffff);
int hi = ((diff >> 16) & 0xffff);
int lo = (data & 0xffff);
int hi = ((data >> 16) & 0xffff);

uint32_t *code_pos_first = (uint32_t *) addr_at(4);
uint32_t *code_pos_second = (uint32_t *) addr_at(8);
Expand All @@ -525,6 +529,7 @@ void NativePostCallNop::patch(jint diff) {

*((uint32_t *)(code_pos_first)) = (uint32_t) ((opcode | lo) << 5);
*((uint32_t *)(code_pos_second)) = (uint32_t) ((opcode | hi) << 5);
return true; // successfully encoded
}

void NativeDeoptInstruction::verify() {
Expand Down
14 changes: 10 additions & 4 deletions 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, 2023, Loongson Technology. All rights reserved.
* Copyright (c) 2015, 2024, 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 @@ -536,15 +536,21 @@ class NativePostCallNop: public NativeInstruction {
return is_nop() && ((uint_at(4) & 0xffc0001f) == 0x03800000);
}

jint displacement() const {
bool decode(int32_t& oopmap_slot, int32_t& cb_offset) const {
uint32_t first_ori = uint_at(4);
uint32_t second_ori = uint_at(8);
int lo = ((first_ori >> 5) & 0xffff);
int hi = ((second_ori >> 5) & 0xffff);
return (jint) ((hi << 16) | lo);
uint32_t data = (hi << 16) | lo;
if (data == 0) {
return false; // no information encoded
}
cb_offset = (data & 0xffffff);
oopmap_slot = (data >> 24) & 0xff;
return true; // decoding succeeded
}

void patch(jint diff);
bool patch(int32_t oopmap_slot, int32_t cb_offset);
void make_deopt();
};

Expand Down

0 comments on commit 9529d19

Please sign in to comment.