Skip to content

Commit 04a8176

Browse files
authored
Update (2023.03.01)
29437: [C2] Add branch instruct with immI12 for reduce spill_code 28247: 8301942: java/net/httpclient/DigestEchoClientSSL.java fail with -Xcomp 29763: Draw out StubRoutines::la::_call_stub_compiled_return 29546: 8301737: java/rmi/server/UnicastRemoteObject/serialFilter/FilterUROTest.java fail with -Xcomp 29524: java/net/httpclient/* fail with -Xcomp 29539: jdk/incubator/concurrent/StructuredTaskScope/StructuredTaskScopeTest.java failed with -Xcomp 27906: Inline ActiveCoresMP
1 parent 9761533 commit 04a8176

21 files changed

+94
-52
lines changed

src/hotspot/cpu/loongarch/assembler_loongarch.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ class Assembler : public AbstractAssembler {
21112111
void dbar(int hint) {
21122112
assert(is_uimm(hint, 15), "not a unsigned 15-bit int");
21132113

2114-
if (os::is_ActiveCoresMP())
2114+
if (UseActiveCoresMP)
21152115
andi(R0, R0, 0);
21162116
else
21172117
emit_int32(insn_I15(dbar_op, hint));

src/hotspot/cpu/loongarch/loongarch_64.ad

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5314,12 +5314,30 @@ instruct jmpLoopEnd_long(cmpOp cop, mRegI src1, mRegI src2, label labl) %{
53145314
ins_pc_relative(1);
53155315
%}
53165316

5317+
instruct jmpLoopEnd_reg_imm12_long(cmpOp cop, mRegI src1, immI12 src2, label labl) %{
5318+
match(CountedLoopEnd cop (CmpI src1 src2));
5319+
effect(USE labl);
5320+
5321+
ins_cost(300);
5322+
format %{ "J$cop $src1, $src2, $labl\t# Loop end @ jmpLoopEnd_reg_imm12_long" %}
5323+
ins_encode %{
5324+
Register op1 = $src1$$Register;
5325+
Label* L = $labl$$label;
5326+
int flag = $cop$$cmpcode;
5327+
5328+
__ addi_d(AT, R0, $src2$$constant);
5329+
__ cmp_branch_long(flag, op1, AT, L, true /* signed */);
5330+
%}
5331+
ins_pipe( pipe_jump );
5332+
ins_pc_relative(1);
5333+
%}
5334+
53175335
instruct jmpLoopEnd_reg_zero_long(cmpOp cop, mRegI src1, immI_0 zero, label labl) %{
53185336
match(CountedLoopEnd cop (CmpI src1 zero));
53195337
effect(USE labl);
53205338

53215339
ins_cost(300);
5322-
format %{ "J$cop $src1, $zero, $labl\t# Loop end @ jmpLoopEnd_reg_immI_long" %}
5340+
format %{ "J$cop $src1, $zero, $labl\t# Loop end @ jmpLoopEnd_reg_zero_long" %}
53235341
ins_encode %{
53245342
Register op1 = $src1$$Register;
53255343
Label* L = $labl$$label;
@@ -5460,6 +5478,24 @@ instruct cmpN_reg_branch_long(cmpOp cmp, mRegN op1, mRegN op2, label labl) %{
54605478
ins_pipe( pipe_alu_branch );
54615479
%}
54625480

5481+
instruct branchConIU_reg_imm12_long(cmpOp cmp, mRegI src1, immI12 src2, label labl) %{
5482+
match( If cmp (CmpU src1 src2) );
5483+
effect(USE labl);
5484+
format %{ "BR$cmp $src1, $src2, $labl #@branchConIU_reg_imm12_long" %}
5485+
5486+
ins_encode %{
5487+
Register op1 = $src1$$Register;
5488+
Label* L = $labl$$label;
5489+
int flag = $cmp$$cmpcode;
5490+
int imm = $src2$$constant;
5491+
__ addi_d(AT, R0, imm);
5492+
__ cmp_branch_long(flag, op1, AT, L, false /* unsigned*/);
5493+
%}
5494+
5495+
ins_pc_relative(1);
5496+
ins_pipe( pipe_alu_branch );
5497+
%}
5498+
54635499
instruct branchConIU_reg_reg_long(cmpOp cmp, mRegI src1, mRegI src2, label labl) %{
54645500
match( If cmp (CmpU src1 src2) );
54655501
effect(USE labl);
@@ -5482,7 +5518,7 @@ instruct branchConIU_reg_reg_long(cmpOp cmp, mRegI src1, mRegI src2, label labl)
54825518
instruct branchConIU_reg_zero_long(cmpOp cmp, mRegI src1, immI_0 zero, label labl) %{
54835519
match( If cmp (CmpU src1 zero) );
54845520
effect(USE labl);
5485-
format %{ "BR$cmp $src1, $zero, $labl #@branchConIU_reg_imm_long" %}
5521+
format %{ "BR$cmp $src1, $zero, $labl #@branchConIU_reg_zero_long" %}
54865522

54875523
ins_encode %{
54885524
Register op1 = $src1$$Register;
@@ -5518,7 +5554,7 @@ instruct branchConI_reg_zero_long(cmpOp cmp, mRegI src1, immI_0 zero, label labl
55185554
match( If cmp (CmpI src1 zero) );
55195555
effect(USE labl);
55205556
ins_cost(200);
5521-
format %{ "BR$cmp $src1, $zero, $labl #@branchConI_reg_imm_long" %}
5557+
format %{ "BR$cmp $src1, $zero, $labl #@branchConI_reg_zero_long" %}
55225558

55235559
ins_encode %{
55245560
Register op1 = $src1$$Register;

src/hotspot/cpu/loongarch/stubGenerator_loongarch_64.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,6 @@ class StubGenerator: public StubCodeGenerator {
258258
__ jalr(A4);
259259
return_address = __ pc();
260260

261-
Label common_return;
262-
__ bind(common_return);
263-
264261
// store result depending on type (everything that is not
265262
// T_OBJECT, T_LONG, T_FLOAT or T_DOUBLE is treated as T_INT)
266263
// n.b. this assumes Java returns an integral result in V0
@@ -324,9 +321,6 @@ class StubGenerator: public StubCodeGenerator {
324321
__ fst_d(FA0, T0, 0);
325322
__ b(exit);
326323

327-
StubRoutines::la::set_call_stub_compiled_return(__ pc());
328-
__ b(common_return);
329-
330324
return start;
331325
}
332326

src/hotspot/cpu/loongarch/stubRoutines_loongarch.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2015, 2022, Loongson Technology. All rights reserved.
3+
* Copyright (c) 2015, 2023, Loongson Technology. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,8 @@
3030
// definition. See stubRoutines.hpp for a description on how to
3131
// extend it.
3232

33-
static bool returns_to_call_stub(address return_pc){
34-
return return_pc == _call_stub_return_address||return_pc == la::get_call_stub_compiled_return();
33+
static bool returns_to_call_stub(address return_pc){
34+
return return_pc == _call_stub_return_address;
3535
}
3636

3737
enum platform_dependent_constants {
@@ -47,7 +47,6 @@ class la {
4747
// need to adjust the return back to the call stub to a specialized
4848
// piece of code that can handle compiled results and cleaning the fpu
4949
// stack. The variable holds that location.
50-
static address _call_stub_compiled_return;
5150
static address _vector_iota_indices;
5251
static juint _crc_table[];
5352
static address _method_entry_barrier;
@@ -66,8 +65,6 @@ class la {
6665

6766
public:
6867
// Call back points for traps in compiled code
69-
static address get_call_stub_compiled_return() { return _call_stub_compiled_return; }
70-
static void set_call_stub_compiled_return(address ret){ _call_stub_compiled_return = ret; }
7168
static address vector_iota_indices() { return _vector_iota_indices; }
7269

7370
static address method_entry_barrier() {

src/hotspot/cpu/loongarch/stubRoutines_loongarch_64.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2015, 2022, Loongson Technology. All rights reserved.
3+
* Copyright (c) 2015, 2023, Loongson Technology. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@
3232
// a description of how to extend it, see the stubRoutines.hpp file.
3333

3434
//find the last fp value
35-
address StubRoutines::la::_call_stub_compiled_return = NULL;
3635
address StubRoutines::la::_method_entry_barrier = NULL;
3736
address StubRoutines::la::_vector_iota_indices = NULL;
3837
address StubRoutines::la::_string_indexof_linear_ll = NULL;

src/hotspot/cpu/loongarch/vm_version_loongarch.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "runtime/java.hpp"
3232
#include "runtime/stubCodeGenerator.hpp"
3333
#include "runtime/vm_version.hpp"
34+
#include "os_linux.hpp"
3435
#ifdef TARGET_OS_FAMILY_linux
3536
# include "os_linux.inline.hpp"
3637
#endif
@@ -420,6 +421,17 @@ void VM_Version::get_processor_features() {
420421
warning("Intrinsic for BigInteger.shiftLeft/Right() employs LASX.");
421422
FLAG_SET_DEFAULT(UseBigIntegerShiftIntrinsic, false);
422423
}
424+
425+
if (UseActiveCoresMP) {
426+
if (os::Linux::sched_active_processor_count() != 1) {
427+
if (!FLAG_IS_DEFAULT(UseActiveCoresMP))
428+
warning("UseActiveCoresMP disabled because active processors are more than one.");
429+
FLAG_SET_DEFAULT(UseActiveCoresMP, false);
430+
}
431+
} else {
432+
if (!os::is_MP())
433+
FLAG_SET_DEFAULT(UseActiveCoresMP, true);
434+
}
423435
}
424436

425437
void VM_Version::initialize() {

src/hotspot/os/linux/os_linux.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
*/
2525

2626
/*
27-
* This file has been modified by Loongson Technology in 2022. These
28-
* modifications are Copyright (c) 2021, 2022, Loongson Technology, and are made
27+
* This file has been modified by Loongson Technology in 2023. These
28+
* modifications are Copyright (c) 2021, 2023, Loongson Technology, and are made
2929
* available on the same license terms set forth above.
3030
*/
3131

@@ -2080,6 +2080,12 @@ bool os::Linux::query_process_memory_info(os::Linux::meminfo_t* info) {
20802080
return false;
20812081
}
20822082

2083+
int os::Linux::sched_active_processor_count() {
2084+
if (OSContainer::is_containerized())
2085+
return OSContainer::active_processor_count();
2086+
return os::Linux::active_processor_count();
2087+
}
2088+
20832089
#ifdef __GLIBC__
20842090
// For Glibc, print a one-liner with the malloc tunables.
20852091
// Most important and popular is MALLOC_ARENA_MAX, but we are

src/hotspot/os/linux/os_linux.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
*
2323
*/
2424

25+
/*
26+
* This file has been modified by Loongson Technology in 2023. These
27+
* modifications are Copyright (c) 2023, Loongson Technology, and are made
28+
* available on the same license terms set forth above.
29+
*/
30+
2531
#ifndef OS_LINUX_OS_LINUX_HPP
2632
#define OS_LINUX_OS_LINUX_HPP
2733

@@ -193,6 +199,8 @@ class os::Linux {
193199

194200
// none present
195201

202+
static int sched_active_processor_count();
203+
196204
private:
197205
static void numa_init();
198206

src/hotspot/os_cpu/linux_loongarch/orderAccess_linux_loongarch.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2015, 2022, Loongson Technology. All rights reserved.
3+
* Copyright (c) 2015, 2023, Loongson Technology. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -31,10 +31,8 @@
3131
// Included in orderAccess.hpp header file.
3232

3333
// Implementation of class OrderAccess.
34-
#define inlasm_sync() if (os::is_ActiveCoresMP()) \
35-
__asm__ __volatile__ ("nop" : : : "memory"); \
36-
else \
37-
__asm__ __volatile__ ("dbar 0" : : : "memory");
34+
#define inlasm_sync() if (!UseActiveCoresMP) \
35+
__asm__ __volatile__ ("dbar 0" : : : "memory");
3836
#define inlasm_synci() __asm__ __volatile__ ("ibar 0" : : : "memory");
3937

4038
inline void OrderAccess::loadload() { inlasm_sync(); }

src/hotspot/os_cpu/linux_loongarch/os_linux_loongarch.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2015, 2022, Loongson Technology. All rights reserved.
3+
* Copyright (c) 2015, 2023, Loongson Technology. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -475,7 +475,3 @@ int os::extra_bang_size_in_bytes() {
475475
// LA does not require the additional stack bang.
476476
return 0;
477477
}
478-
479-
bool os::is_ActiveCoresMP() {
480-
return UseActiveCoresMP && _initial_active_processor_count == 1;
481-
}

0 commit comments

Comments
 (0)