From 618eadfb3a35629f49878586f6e919ec131f06f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lund=C3=A9n?= Date: Thu, 30 Nov 2023 17:45:05 +0100 Subject: [PATCH 1/6] Replace adr in const2reg with lea --- src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp index 360ef7a747a83..03a7f035c42ab 100644 --- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp @@ -575,7 +575,7 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod if (__ operand_valid_for_float_immediate(c->as_jfloat())) { __ fmovs(dest->as_float_reg(), (c->as_jfloat())); } else { - __ adr(rscratch1, InternalAddress(float_constant(c->as_jfloat()))); + __ lea(rscratch1, InternalAddress(float_constant(c->as_jfloat()))); __ ldrs(dest->as_float_reg(), Address(rscratch1)); } break; @@ -585,7 +585,7 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod if (__ operand_valid_for_float_immediate(c->as_jdouble())) { __ fmovd(dest->as_double_reg(), (c->as_jdouble())); } else { - __ adr(rscratch1, InternalAddress(double_constant(c->as_jdouble()))); + __ lea(rscratch1, InternalAddress(double_constant(c->as_jdouble()))); __ ldrd(dest->as_double_reg(), Address(rscratch1)); } break; From 505dbd40354379faf334e3a621d5e65a71ab26a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lund=C3=A9n?= Date: Fri, 1 Dec 2023 12:00:53 +0100 Subject: [PATCH 2/6] Add regression test --- .../jtreg/compiler/arguments/TestC1Globals.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java b/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java index b8ed2c36918ca..ec2fe90d0659b 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java +++ b/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java @@ -79,6 +79,20 @@ * */ +/** + * @test + * @bug 8320682 + * @requires vm.debug + * @requires os.family == "linux" + * @summary Test flag with large value and specific compilation. + * + * @run main/othervm -XX:NMethodSizeLimit=224001703 + * -XX:CompileOnly=java.util.HashMap::putMapEntries + * -Xcomp + * compiler.arguments.TestC1Globals + * + */ + package compiler.arguments; public class TestC1Globals { From ed27abecf2f97e656fd59c8eb08ec4757973a078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lund=C3=A9n?= Date: Mon, 4 Dec 2023 11:05:51 +0100 Subject: [PATCH 3/6] Remove OS restriction in test --- test/hotspot/jtreg/compiler/arguments/TestC1Globals.java | 1 - 1 file changed, 1 deletion(-) diff --git a/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java b/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java index ec2fe90d0659b..eb8c560e29f79 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java +++ b/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java @@ -83,7 +83,6 @@ * @test * @bug 8320682 * @requires vm.debug - * @requires os.family == "linux" * @summary Test flag with large value and specific compilation. * * @run main/othervm -XX:NMethodSizeLimit=224001703 From a35bad0e89d162355a6c2cc95abe427eb53c59f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lund=C3=A9n?= Date: Thu, 7 Dec 2023 15:57:46 +0100 Subject: [PATCH 4/6] Revert fix and restrict NMethodSizeLimit instead --- .../cpu/aarch64/c1_LIRAssembler_aarch64.cpp | 4 +- src/hotspot/share/c1/c1_globals.hpp | 2 +- .../compiler/arguments/TestC1Globals.java | 47 +++---------------- 3 files changed, 9 insertions(+), 44 deletions(-) diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp index 03a7f035c42ab..360ef7a747a83 100644 --- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp @@ -575,7 +575,7 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod if (__ operand_valid_for_float_immediate(c->as_jfloat())) { __ fmovs(dest->as_float_reg(), (c->as_jfloat())); } else { - __ lea(rscratch1, InternalAddress(float_constant(c->as_jfloat()))); + __ adr(rscratch1, InternalAddress(float_constant(c->as_jfloat()))); __ ldrs(dest->as_float_reg(), Address(rscratch1)); } break; @@ -585,7 +585,7 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod if (__ operand_valid_for_float_immediate(c->as_jdouble())) { __ fmovd(dest->as_double_reg(), (c->as_jdouble())); } else { - __ lea(rscratch1, InternalAddress(double_constant(c->as_jdouble()))); + __ adr(rscratch1, InternalAddress(double_constant(c->as_jdouble()))); __ ldrd(dest->as_double_reg(), Address(rscratch1)); } break; diff --git a/src/hotspot/share/c1/c1_globals.hpp b/src/hotspot/share/c1/c1_globals.hpp index 1c22cf16cfe79..e2057d20e5937 100644 --- a/src/hotspot/share/c1/c1_globals.hpp +++ b/src/hotspot/share/c1/c1_globals.hpp @@ -277,7 +277,7 @@ \ develop(intx, NMethodSizeLimit, (64*K)*wordSize, \ "Maximum size of a compiled method.") \ - range(0, max_jint) \ + range(0, 1*M) \ \ develop(bool, TraceFPUStack, false, \ "Trace emulation of the FPU stack (intel only)") \ diff --git a/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java b/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java index eb8c560e29f79..ff639a69bd937 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java +++ b/test/hotspot/jtreg/compiler/arguments/TestC1Globals.java @@ -21,48 +21,14 @@ * questions. */ -/** - * @test - * @bug 8318817 - * @requires vm.debug - * @summary Test flag with large value - * - * @run main/othervm -XX:NMethodSizeLimit=351658240 - * compiler.arguments.TestC1Globals - */ - -/** - * @test - * @bug 8318817 - * @requires vm.debug - * @summary Test flag with large value - * - * @run main/othervm -XX:NMethodSizeLimit=224001703 - * compiler.arguments.TestC1Globals - */ - /** * @test * @bug 8316653 * @requires vm.debug - * @summary Test flag with max value - * - * @run main/othervm -XX:NMethodSizeLimit=2147483647 - * compiler.arguments.TestC1Globals - */ - -/** - * @test - * @bug 8318817 - * @requires vm.debug - * @requires os.family == "linux" - * @summary Test flag with large value combined with transparent huge pages on - * Linux. + * @summary Test flag with max value. * - * @run main/othervm -XX:NMethodSizeLimit=351658240 - * -XX:+UseTransparentHugePages + * @run main/othervm -XX:NMethodSizeLimit=1M * compiler.arguments.TestC1Globals - * */ /** @@ -70,22 +36,21 @@ * @bug 8318817 * @requires vm.debug * @requires os.family == "linux" - * @summary Test flag with large value combined with transparent huge pages on + * @summary Test flag with max value combined with transparent huge pages on * Linux. * - * @run main/othervm -XX:NMethodSizeLimit=224001703 + * @run main/othervm -XX:NMethodSizeLimit=1M * -XX:+UseTransparentHugePages * compiler.arguments.TestC1Globals - * */ /** * @test * @bug 8320682 * @requires vm.debug - * @summary Test flag with large value and specific compilation. + * @summary Test flag with max value and specific compilation. * - * @run main/othervm -XX:NMethodSizeLimit=224001703 + * @run main/othervm -XX:NMethodSizeLimit=1M * -XX:CompileOnly=java.util.HashMap::putMapEntries * -Xcomp * compiler.arguments.TestC1Globals From d19040e5f0d6ecc92c39b03e5a52df104747da30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lund=C3=A9n?= Date: Thu, 7 Dec 2023 16:50:15 +0100 Subject: [PATCH 5/6] Update copyright --- src/hotspot/share/c1/c1_globals.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/c1/c1_globals.hpp b/src/hotspot/share/c1/c1_globals.hpp index e2057d20e5937..1455c8acabac6 100644 --- a/src/hotspot/share/c1/c1_globals.hpp +++ b/src/hotspot/share/c1/c1_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2023, Oracle and/or its affiliates. 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 From 1d0515b77f4985a7782377b074612d84bcdf5473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lund=C3=A9n?= Date: Thu, 14 Dec 2023 09:40:11 +0100 Subject: [PATCH 6/6] Add comment explaining 1MB restriction --- src/hotspot/share/c1/c1_globals.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hotspot/share/c1/c1_globals.hpp b/src/hotspot/share/c1/c1_globals.hpp index 1455c8acabac6..4c73d7536b522 100644 --- a/src/hotspot/share/c1/c1_globals.hpp +++ b/src/hotspot/share/c1/c1_globals.hpp @@ -275,6 +275,8 @@ develop(bool, InstallMethods, true, \ "Install methods at the end of successful compilations") \ \ + /* The compiler assumes, in many places, that methods are at most 1MB. */ \ + /* Therefore, we restrict this flag to at most 1MB. */ \ develop(intx, NMethodSizeLimit, (64*K)*wordSize, \ "Maximum size of a compiled method.") \ range(0, 1*M) \