Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8331341: secondary_super_cache does not scale well: C1 and interpreter #19989

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b814460
Stage
Jun 4, 2024
97dec4c
Temp
Jun 4, 2024
491177c
Super
Jun 12, 2024
3db4a14
Merge branch 'clean' into JDK-8331658-work
Jun 12, 2024
4b3aae9
Inter
Jun 13, 2024
9232639
Inter
Jun 14, 2024
02a4e3c
Temp
Jun 19, 2024
db07cbd
Ready for x86
Jun 20, 2024
3288967
Ready for x86
Jun 20, 2024
4fd1215
First stab at x86
Jun 21, 2024
345f22a
Converging
Jun 24, 2024
6b286a3
UseSecondarySupersTable on by default (temp)
Jun 25, 2024
a027a57
Temp
Jun 26, 2024
f095fee
Cleanup
Jun 26, 2024
de17b44
Cleanup
Jun 26, 2024
84a978c
Merge branch 'clean' into JDK-8331658-work
Jul 2, 2024
73ff8fb
Temp
Jul 2, 2024
80d33b9
Temp
Jul 2, 2024
e38e086
Temp
Jul 2, 2024
16f60f9
Fix x86
Jul 2, 2024
d2771bc
Fix x86-32
Jul 4, 2024
bc5afd0
Merge remote-tracking branch 'refs/remotes/origin/JDK-8331658-work' i…
Jul 4, 2024
cec26c7
Temp
Jul 4, 2024
876987e
Small
Jul 4, 2024
b75d993
small
Jul 4, 2024
7d7694c
Cleanup tests
Jul 4, 2024
bfe9cee
Negated tests
Jul 18, 2024
129987f
Cleanup check_klass_subtype_fast_path for AArch64, deleting dead code
Jul 19, 2024
0421b92
Review feedback
Jul 19, 2024
2b002e4
Review feedback
Jul 19, 2024
98f6b2b
Review feedback
Jul 19, 2024
69d1d8d
Review comments
Jul 22, 2024
c252efc
Review comments
Jul 22, 2024
02cfd13
Review comments
Jul 22, 2024
48e80a1
Review comments
Jul 24, 2024
54050a5
Minor cleanup
Jul 24, 2024
1242584
Merge branch 'JDK-8331658-work' of https://github.com/theRealAph/jdk …
Jul 24, 2024
7858fef
temp
Jul 25, 2024
011a388
Cleanup
Jul 25, 2024
248f44d
Merge branch 'clean' into JDK-8331658-work
Jul 25, 2024
e958101
Fix test failure
Jul 26, 2024
329f487
Minor
Jul 29, 2024
193478d
Experiment: test bitmap upfront.
Jul 29, 2024
0571877
Experiment: test bitmap upfront.
Jul 29, 2024
5cca1cc
Review comments
Jul 31, 2024
c33e1bd
Fix AArch64
Jul 31, 2024
4c9a081
Review comments
Jul 31, 2024
2769d9e
Merge branch 'JDK-8331658-work' of https://github.com/theRealAph/jdk …
Jul 31, 2024
24aca9a
Reorganize x86
Aug 1, 2024
e41f15a
Untabify
Aug 1, 2024
4c7fad7
use assert rather than guarantee
Aug 1, 2024
7792ca8
Fix shared code
Aug 1, 2024
eb73993
Fix shared code
Aug 1, 2024
51c68a0
Cleanup
Aug 6, 2024
5b46b38
Merge from JDK head.
Aug 12, 2024
790939c
Merge branch 'clean' into JDK-8331658-work
Aug 12, 2024
77de087
Fix merge
Aug 12, 2024
dd42fe9
Merge branch 'clean' into JDK-8331658-work
Aug 16, 2024
fe754fb
Use post-incrememnt RegSet operator.
Aug 30, 2024
a726b62
Fix s390
Aug 30, 2024
a761267
Merge from 4ff72dc57e65e99b129f0ba28196994edf402018
Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 38 additions & 22 deletions src/hotspot/cpu/aarch64/aarch64.ad
Original file line number Diff line number Diff line change
Expand Up @@ -16044,9 +16044,10 @@ instruct ShouldNotReachHere() %{
instruct partialSubtypeCheck(iRegP_R4 sub, iRegP_R0 super, iRegP_R2 temp, iRegP_R5 result, rFlagsReg cr)
%{
match(Set result (PartialSubtypeCheck sub super));
predicate(!UseSecondarySupersTable);
effect(KILL cr, KILL temp);

ins_cost(1100); // slightly larger than the next version
ins_cost(20 * INSN_COST); // slightly larger than the next version
format %{ "partialSubtypeCheck $result, $sub, $super" %}

ins_encode(aarch64_enc_partial_subtype_check(sub, super, temp, result));
Expand All @@ -16056,6 +16057,35 @@ instruct partialSubtypeCheck(iRegP_R4 sub, iRegP_R0 super, iRegP_R2 temp, iRegP_
ins_pipe(pipe_class_memory);
%}

// Two versions of partialSubtypeCheck, both used when we need to
// search for a super class in the secondary supers array. The first
// is used when we don't know _a priori_ the class being searched
// for. The second, far more common, is used when we do know: this is
// used for instanceof, checkcast, and any case where C2 can determine
// it by constant propagation.

instruct partialSubtypeCheckVarSuper(iRegP_R4 sub, iRegP_R0 super, vRegD_V0 vtemp, iRegP_R5 result,
iRegP_R1 tempR1, iRegP_R2 tempR2, iRegP_R3 tempR3,
rFlagsReg cr)
%{
match(Set result (PartialSubtypeCheck sub super));
predicate(UseSecondarySupersTable);
effect(KILL cr, TEMP tempR1, TEMP tempR2, TEMP tempR3, TEMP vtemp);

ins_cost(10 * INSN_COST); // slightly larger than the next version
format %{ "partialSubtypeCheck $result, $sub, $super" %}

ins_encode %{
bool success = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool success = false;

__ lookup_secondary_supers_table_var($sub$$Register, $super$$Register,
$tempR1$$Register, $tempR2$$Register, $tempR3$$Register,
$vtemp$$FloatRegister,
$result$$Register, /*L_success*/nullptr);
%}

ins_pipe(pipe_class_memory);
%}

instruct partialSubtypeCheckConstSuper(iRegP_R4 sub, iRegP_R0 super_reg, immP super_con, vRegD_V0 vtemp, iRegP_R5 result,
iRegP_R1 tempR1, iRegP_R2 tempR2, iRegP_R3 tempR3,
rFlagsReg cr)
Expand All @@ -16064,18 +16094,19 @@ instruct partialSubtypeCheckConstSuper(iRegP_R4 sub, iRegP_R0 super_reg, immP su
predicate(UseSecondarySupersTable);
effect(KILL cr, TEMP tempR1, TEMP tempR2, TEMP tempR3, TEMP vtemp);

ins_cost(700); // smaller than the next version
ins_cost(5 * INSN_COST); // smaller than the next version
format %{ "partialSubtypeCheck $result, $sub, $super_reg, $super_con" %}

ins_encode %{
bool success = false;
u1 super_klass_slot = ((Klass*)$super_con$$constant)->hash_slot();
if (InlineSecondarySupersTest) {
success = __ lookup_secondary_supers_table($sub$$Register, $super_reg$$Register,
$tempR1$$Register, $tempR2$$Register, $tempR3$$Register,
$vtemp$$FloatRegister,
$result$$Register,
super_klass_slot);
success =
__ lookup_secondary_supers_table_const($sub$$Register, $super_reg$$Register,
$tempR1$$Register, $tempR2$$Register, $tempR3$$Register,
$vtemp$$FloatRegister,
$result$$Register,
super_klass_slot);
} else {
address call = __ trampoline_call(RuntimeAddress(StubRoutines::lookup_secondary_supers_table_stub(super_klass_slot)));
success = (call != nullptr);
Expand All @@ -16089,21 +16120,6 @@ instruct partialSubtypeCheckConstSuper(iRegP_R4 sub, iRegP_R0 super_reg, immP su
ins_pipe(pipe_class_memory);
%}

instruct partialSubtypeCheckVsZero(iRegP_R4 sub, iRegP_R0 super, iRegP_R2 temp, iRegP_R5 result, immP0 zero, rFlagsReg cr)
%{
match(Set cr (CmpP (PartialSubtypeCheck sub super) zero));
effect(KILL temp, KILL result);

ins_cost(1100); // slightly larger than the next version
format %{ "partialSubtypeCheck $result, $sub, $super == 0" %}

ins_encode(aarch64_enc_partial_subtype_check(sub, super, temp, result));

opcode(0x0); // Don't zero result reg on hit

ins_pipe(pipe_class_memory);
%}

// Intrisics for String.compareTo()

instruct string_compareU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
Expand Down
8 changes: 7 additions & 1 deletion src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,13 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
__ ldp(r4, r0, Address(sp, (sup_k_off) * VMRegImpl::stack_slot_size));

Label miss;
__ check_klass_subtype_slow_path(r4, r0, r2, r5, nullptr, &miss);
__ check_klass_subtype_slow_path(/*sub_klass*/r4,
/*super_klass*/r0,
/*temp_reg*/r2,
/*temp2_reg*/r5,
/*L_success*/nullptr,
/*L_failure*/&miss);
// Need extras for table lookup: r1, r3, vtemp

// fallthrough on success:
__ mov(rscratch1, 1);
Expand Down
Loading