Skip to content

Commit a9b8a19

Browse files
authored
Update (2023.03.10)
29885: LA port of 8302369: Reduce the stack size of the C1 compiler 29991: LA port of 8302070: Factor null-check into load_klass() calls
1 parent faa0fd4 commit a9b8a19

File tree

6 files changed

+17
-29
lines changed

6 files changed

+17
-29
lines changed

src/hotspot/cpu/loongarch/c1_CodeStubs_loongarch_64.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2021, 2022, Loongson Technology. All rights reserved.
3+
* Copyright (c) 2021, 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
@@ -62,18 +62,6 @@ void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
6262
__ b(_continuation);
6363
}
6464

65-
RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array)
66-
: _index(index), _array(array), _throw_index_out_of_bounds_exception(false) {
67-
assert(info != NULL, "must have info");
68-
_info = new CodeEmitInfo(info);
69-
}
70-
71-
RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index)
72-
: _index(index), _array(), _throw_index_out_of_bounds_exception(true) {
73-
assert(info != NULL, "must have info");
74-
_info = new CodeEmitInfo(info);
75-
}
76-
7765
void RangeCheckStub::emit_code(LIR_Assembler* ce) {
7866
__ bind(_entry);
7967
if (_info->deoptimize_on_exception()) {
@@ -200,13 +188,6 @@ void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
200188
__ b(_continuation);
201189
}
202190

203-
// Implementation of MonitorAccessStubs
204-
205-
MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info)
206-
: MonitorAccessStub(obj_reg, lock_reg) {
207-
_info = new CodeEmitInfo(info);
208-
}
209-
210191
void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
211192
assert(__ rsp_offset() == 0, "frame size should be fixed");
212193
__ bind(_entry);

src/hotspot/cpu/loongarch/c1_Defs_loongarch.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,9 @@ enum {
8080
pd_two_operand_lir_form = false
8181
};
8282

83+
// the number of stack required by ArrayCopyStub
84+
enum {
85+
pd_arraycopystub_reserved_argument_area_size = 2
86+
};
87+
8388
#endif // CPU_LOONGARCH_C1_DEFS_LOONGARCH_HPP

src/hotspot/cpu/loongarch/macroAssembler_loongarch.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,6 +1680,11 @@ void MacroAssembler::load_klass(Register dst, Register src) {
16801680
}
16811681
}
16821682

1683+
void MacroAssembler::load_klass_check_null(Register dst, Register src) {
1684+
null_check(src, oopDesc::klass_offset_in_bytes());
1685+
load_klass(dst, src);
1686+
}
1687+
16831688
void MacroAssembler::store_klass(Register dst, Register src) {
16841689
if(UseCompressedClassPointers){
16851690
encode_klass_not_null(src);

src/hotspot/cpu/loongarch/macroAssembler_loongarch.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ class MacroAssembler: public Assembler {
252252

253253
// oop manipulations
254254
void load_klass(Register dst, Register src);
255+
void load_klass_check_null(Register dst, Register src);
255256
void store_klass(Register dst, Register src);
256257

257258
void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,

src/hotspot/cpu/loongarch/methodHandles_loongarch.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 1997, 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
@@ -326,8 +326,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
326326
__ null_check(receiver_reg);
327327
} else {
328328
// load receiver klass itself
329-
__ null_check(receiver_reg, oopDesc::klass_offset_in_bytes());
330-
__ load_klass(temp1_recv_klass, receiver_reg);
329+
__ load_klass_check_null(temp1_recv_klass, receiver_reg);
331330
__ verify_klass_ptr(temp1_recv_klass);
332331
}
333332
BLOCK_COMMENT("check_receiver {");

src/hotspot/cpu/loongarch/templateTable_loongarch_64.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,8 +3262,7 @@ void TemplateTable::invokevirtual_helper(Register index,
32623262
__ bind(notFinal);
32633263

32643264
// get receiver klass
3265-
__ null_check(recv, oopDesc::klass_offset_in_bytes());
3266-
__ load_klass(T2, recv);
3265+
__ load_klass_check_null(T2, recv);
32673266

32683267
// profile this call
32693268
__ profile_virtual_call(T2, T0, T1);
@@ -3366,8 +3365,7 @@ void TemplateTable::invokeinterface(int byte_no) {
33663365
__ beq(AT, R0, notVFinal);
33673366

33683367
// Get receiver klass into FSR - also a null check
3369-
__ null_check(T3, oopDesc::klass_offset_in_bytes());
3370-
__ load_klass(FSR, T3);
3368+
__ load_klass_check_null(FSR, T3);
33713369

33723370
Label subtype;
33733371
__ check_klass_subtype(FSR, T2, T0, subtype);
@@ -3389,8 +3387,7 @@ void TemplateTable::invokeinterface(int byte_no) {
33893387

33903388
// Get receiver klass into T1 - also a null check
33913389
__ restore_locals();
3392-
__ null_check(T3, oopDesc::klass_offset_in_bytes());
3393-
__ load_klass(T1, T3);
3390+
__ load_klass_check_null(T1, T3);
33943391

33953392
Label no_such_method;
33963393

0 commit comments

Comments
 (0)