Skip to content

Commit 1014ef9

Browse files
author
duke
committedFeb 5, 2024
Automatic merge of jdk:master into master
2 parents bce7139 + 8796f43 commit 1014ef9

File tree

4 files changed

+49
-96
lines changed

4 files changed

+49
-96
lines changed
 

‎src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp

+28-45
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2016, 2024 SAP SE. 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
@@ -2480,23 +2480,30 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L
24802480
assert_different_registers(obj, k_RInfo, klass_RInfo);
24812481

24822482
if (op->should_profile()) {
2483+
Register mdo = klass_RInfo;
2484+
metadata2reg(md->constant_encoding(), mdo);
24832485
NearLabel not_null;
24842486
__ compareU64_and_branch(obj, (intptr_t) 0, Assembler::bcondNotEqual, not_null);
24852487
// Object is null; update MDO and exit.
2486-
Register mdo = klass_RInfo;
2487-
metadata2reg(md->constant_encoding(), mdo);
24882488
Address data_addr(mdo, md->byte_offset_of_slot(data, DataLayout::header_offset()));
24892489
int header_bits = DataLayout::flag_mask_to_header_mask(BitData::null_seen_byte_constant());
24902490
__ or2mem_8(data_addr, header_bits);
24912491
__ branch_optimized(Assembler::bcondAlways, *obj_is_null);
24922492
__ bind(not_null);
2493+
2494+
NearLabel update_done;
2495+
Register recv = k_RInfo;
2496+
__ load_klass(recv, obj);
2497+
type_profile_helper(mdo, md, data, recv, Rtmp1, &update_done);
2498+
Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
2499+
__ add2mem_64(counter_addr, DataLayout::counter_increment, Rtmp1);
2500+
__ bind(update_done);
24932501
} else {
24942502
__ compareU64_and_branch(obj, (intptr_t) 0, Assembler::bcondEqual, *obj_is_null);
24952503
}
24962504

2497-
NearLabel profile_cast_failure, profile_cast_success;
2498-
Label *failure_target = op->should_profile() ? &profile_cast_failure : failure;
2499-
Label *success_target = op->should_profile() ? &profile_cast_success : success;
2505+
Label *failure_target = failure;
2506+
Label *success_target = success;
25002507

25012508
// Patching may screw with our temporaries,
25022509
// so let's do it before loading the class.
@@ -2536,28 +2543,12 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L
25362543
store_parameter(klass_RInfo, 0); // sub
25372544
store_parameter(k_RInfo, 1); // super
25382545
emit_call_c(a); // Sets condition code 0 for match (2 otherwise).
2539-
CHECK_BAILOUT2(profile_cast_failure, profile_cast_success);
25402546
__ branch_optimized(Assembler::bcondNotEqual, *failure_target);
25412547
// Fall through to success case.
25422548
}
25432549
}
25442550

2545-
if (op->should_profile()) {
2546-
Register mdo = klass_RInfo, recv = k_RInfo;
2547-
assert_different_registers(obj, mdo, recv);
2548-
__ bind(profile_cast_success);
2549-
metadata2reg(md->constant_encoding(), mdo);
2550-
__ load_klass(recv, obj);
2551-
type_profile_helper(mdo, md, data, recv, Rtmp1, success);
2552-
__ branch_optimized(Assembler::bcondAlways, *success);
2553-
2554-
__ bind(profile_cast_failure);
2555-
metadata2reg(md->constant_encoding(), mdo);
2556-
__ add2mem_64(Address(mdo, md->byte_offset_of_slot(data, CounterData::count_offset())), -(int)DataLayout::counter_increment, Rtmp1);
2557-
__ branch_optimized(Assembler::bcondAlways, *failure);
2558-
} else {
2559-
__ branch_optimized(Assembler::bcondAlways, *success);
2560-
}
2551+
__ branch_optimized(Assembler::bcondAlways, *success);
25612552
}
25622553

25632554
void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
@@ -2587,21 +2578,29 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
25872578
assert(data != nullptr, "need data for type check");
25882579
assert(data->is_ReceiverTypeData(), "need ReceiverTypeData for type check");
25892580
}
2590-
NearLabel profile_cast_success, profile_cast_failure, done;
2591-
Label *success_target = op->should_profile() ? &profile_cast_success : &done;
2592-
Label *failure_target = op->should_profile() ? &profile_cast_failure : stub->entry();
2581+
NearLabel done;
2582+
Label *success_target = &done;
2583+
Label *failure_target = stub->entry();
25932584

25942585
if (op->should_profile()) {
2586+
Register mdo = klass_RInfo;
2587+
metadata2reg(md->constant_encoding(), mdo);
25952588
NearLabel not_null;
25962589
__ compareU64_and_branch(value, (intptr_t) 0, Assembler::bcondNotEqual, not_null);
25972590
// Object is null; update MDO and exit.
2598-
Register mdo = klass_RInfo;
2599-
metadata2reg(md->constant_encoding(), mdo);
26002591
Address data_addr(mdo, md->byte_offset_of_slot(data, DataLayout::header_offset()));
26012592
int header_bits = DataLayout::flag_mask_to_header_mask(BitData::null_seen_byte_constant());
26022593
__ or2mem_8(data_addr, header_bits);
26032594
__ branch_optimized(Assembler::bcondAlways, done);
26042595
__ bind(not_null);
2596+
2597+
NearLabel update_done;
2598+
Register recv = k_RInfo;
2599+
__ load_klass(recv, value);
2600+
type_profile_helper(mdo, md, data, recv, Rtmp1, &update_done);
2601+
Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
2602+
__ add2mem_64(counter_addr, DataLayout::counter_increment, Rtmp1);
2603+
__ bind(update_done);
26052604
} else {
26062605
__ compareU64_and_branch(value, (intptr_t) 0, Assembler::bcondEqual, done);
26072606
}
@@ -2619,25 +2618,9 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
26192618
store_parameter(klass_RInfo, 0); // sub
26202619
store_parameter(k_RInfo, 1); // super
26212620
emit_call_c(a); // Sets condition code 0 for match (2 otherwise).
2622-
CHECK_BAILOUT3(profile_cast_success, profile_cast_failure, done);
26232621
__ branch_optimized(Assembler::bcondNotEqual, *failure_target);
26242622
// Fall through to success case.
26252623

2626-
if (op->should_profile()) {
2627-
Register mdo = klass_RInfo, recv = k_RInfo;
2628-
assert_different_registers(value, mdo, recv);
2629-
__ bind(profile_cast_success);
2630-
metadata2reg(md->constant_encoding(), mdo);
2631-
__ load_klass(recv, value);
2632-
type_profile_helper(mdo, md, data, recv, Rtmp1, &done);
2633-
__ branch_optimized(Assembler::bcondAlways, done);
2634-
2635-
__ bind(profile_cast_failure);
2636-
metadata2reg(md->constant_encoding(), mdo);
2637-
__ add2mem_64(Address(mdo, md->byte_offset_of_slot(data, CounterData::count_offset())), -(int)DataLayout::counter_increment, Rtmp1);
2638-
__ branch_optimized(Assembler::bcondAlways, *stub->entry());
2639-
}
2640-
26412624
__ bind(done);
26422625
} else {
26432626
if (code == lir_checkcast) {

‎src/hotspot/cpu/s390/interp_masm_s390.cpp

+15-43
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2016, 2024 SAP SE. 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
@@ -447,9 +447,6 @@ void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
447447

448448
// Do the check.
449449
check_klass_subtype(Rsub_klass, Rsuper_klass, Rtmp1, Rtmp2, ok_is_subtype);
450-
451-
// Profile the failure of the check.
452-
profile_typecheck_failed(Rtmp1, Rtmp2);
453450
}
454451

455452
// Pop topmost element from stack. It just disappears.
@@ -1425,7 +1422,7 @@ void InterpreterMacroAssembler::profile_virtual_call(Register receiver,
14251422
}
14261423

14271424
// Record the receiver type.
1428-
record_klass_in_profile(receiver, mdp, reg2, true);
1425+
record_klass_in_profile(receiver, mdp, reg2);
14291426
bind(skip_receiver_profile);
14301427

14311428
// The method data pointer needs to be updated to reflect the new target.
@@ -1448,11 +1445,9 @@ void InterpreterMacroAssembler::profile_virtual_call(Register receiver,
14481445
void InterpreterMacroAssembler::record_klass_in_profile_helper(
14491446
Register receiver, Register mdp,
14501447
Register reg2, int start_row,
1451-
Label& done, bool is_virtual_call) {
1448+
Label& done) {
14521449
if (TypeProfileWidth == 0) {
1453-
if (is_virtual_call) {
1454-
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
1455-
}
1450+
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
14561451
return;
14571452
}
14581453

@@ -1487,23 +1482,19 @@ void InterpreterMacroAssembler::record_klass_in_profile_helper(
14871482
z_ltgr(reg2, reg2);
14881483
if (start_row == last_row) {
14891484
// The only thing left to do is handle the null case.
1490-
if (is_virtual_call) {
1491-
z_brz(found_null);
1492-
// Receiver did not match any saved receiver and there is no empty row for it.
1493-
// Increment total counter to indicate polymorphic case.
1494-
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
1495-
z_bru(done);
1496-
bind(found_null);
1497-
} else {
1498-
z_brnz(done);
1499-
}
1485+
z_brz(found_null);
1486+
// Receiver did not match any saved receiver and there is no empty row for it.
1487+
// Increment total counter to indicate polymorphic case.
1488+
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
1489+
z_bru(done);
1490+
bind(found_null);
15001491
break;
15011492
}
15021493
// Since null is rare, make it be the branch-taken case.
15031494
z_brz(found_null);
15041495

15051496
// Put all the "Case 3" tests here.
1506-
record_klass_in_profile_helper(receiver, mdp, reg2, start_row + 1, done, is_virtual_call);
1497+
record_klass_in_profile_helper(receiver, mdp, reg2, start_row + 1, done);
15071498

15081499
// Found a null. Keep searching for a matching receiver,
15091500
// but remember that this is an empty (unused) slot.
@@ -1550,12 +1541,11 @@ void InterpreterMacroAssembler::record_klass_in_profile_helper(
15501541
// done:
15511542

15521543
void InterpreterMacroAssembler::record_klass_in_profile(Register receiver,
1553-
Register mdp, Register reg2,
1554-
bool is_virtual_call) {
1544+
Register mdp, Register reg2) {
15551545
assert(ProfileInterpreter, "must be profiling");
15561546
Label done;
15571547

1558-
record_klass_in_profile_helper(receiver, mdp, reg2, 0, done, is_virtual_call);
1548+
record_klass_in_profile_helper(receiver, mdp, reg2, 0, done);
15591549

15601550
bind (done);
15611551
}
@@ -1615,24 +1605,6 @@ void InterpreterMacroAssembler::profile_null_seen(Register mdp) {
16151605
}
16161606
}
16171607

1618-
void InterpreterMacroAssembler::profile_typecheck_failed(Register mdp, Register tmp) {
1619-
if (ProfileInterpreter && TypeProfileCasts) {
1620-
Label profile_continue;
1621-
1622-
// If no method data exists, go to profile_continue.
1623-
test_method_data_pointer(mdp, profile_continue);
1624-
1625-
int count_offset = in_bytes(CounterData::count_offset());
1626-
// Back up the address, since we have already bumped the mdp.
1627-
count_offset -= in_bytes(VirtualCallData::virtual_call_data_size());
1628-
1629-
// *Decrement* the counter. We expect to see zero or small negatives.
1630-
increment_mdp_data_at(mdp, count_offset, tmp, true);
1631-
1632-
bind (profile_continue);
1633-
}
1634-
}
1635-
16361608
void InterpreterMacroAssembler::profile_typecheck(Register mdp, Register klass, Register reg2) {
16371609
if (ProfileInterpreter) {
16381610
Label profile_continue;
@@ -1646,7 +1618,7 @@ void InterpreterMacroAssembler::profile_typecheck(Register mdp, Register klass,
16461618
mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size());
16471619

16481620
// Record the object type.
1649-
record_klass_in_profile(klass, mdp, reg2, false);
1621+
record_klass_in_profile(klass, mdp, reg2);
16501622
}
16511623
update_mdp_by_constant(mdp, mdp_delta);
16521624

‎src/hotspot/cpu/s390/interp_masm_s390.hpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2016, 2024 SAP SE. 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
@@ -281,10 +281,10 @@ class InterpreterMacroAssembler: public MacroAssembler {
281281
Label& not_equal_continue);
282282

283283
void record_klass_in_profile(Register receiver, Register mdp,
284-
Register reg2, bool is_virtual_call);
284+
Register reg2);
285285
void record_klass_in_profile_helper(Register receiver, Register mdp,
286286
Register reg2, int start_row,
287-
Label& done, bool is_virtual_call);
287+
Label& done);
288288

289289
void update_mdp_by_offset(Register mdp_in, int offset_of_offset);
290290
void update_mdp_by_offset(Register mdp_in, Register dataidx, int offset_of_disp);
@@ -301,7 +301,6 @@ class InterpreterMacroAssembler: public MacroAssembler {
301301
void profile_ret(Register return_bci, Register mdp);
302302
void profile_null_seen(Register mdp);
303303
void profile_typecheck(Register mdp, Register klass, Register scratch);
304-
void profile_typecheck_failed(Register mdp, Register tmp);
305304
void profile_switch_default(Register mdp);
306305
void profile_switch_case(Register index_in_scratch, Register mdp,
307306
Register scratch1, Register scratch2);

‎src/hotspot/cpu/s390/vm_version_s390.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2016, 2022 SAP SE. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2016, 2024 SAP SE. 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
@@ -567,7 +567,6 @@ class VM_Version: public Abstract_VM_Version {
567567
static unsigned long z_SIGSEGV();
568568

569569
static void initialize_cpu_information(void);
570-
static bool profile_all_receivers_at_type_check() { return false; }
571570
};
572571

573572
#endif // CPU_S390_VM_VERSION_S390_HPP

0 commit comments

Comments
 (0)
Please sign in to comment.