RFR: 8240263: Assertion-only call in Method::link_method affecting product builds

Claes Redestad claes.redestad at oracle.com
Mon Mar 2 09:22:32 UTC 2020


Hi,

in Method::link_method we resolve an entry when linking methods from CDS
which is only used for purposes of some assertions. Even though the
resolution does not have any side effect compilers can't see through
into all parts of this call (specifically method_kind) to prove this and
DCE the code.

Guarding the resolution by DEBUG_ONLY seem the right thing to do here,
which bring a small improvement on startup tests when CDS is enabled.

See attached patch[1].

Bug: https://bugs.openjdk.java.net/browse/JDK-8240263

Testing: tier1-3

Thanks!

/Claes

[1]
diff -r acc083236275 src/hotspot/share/oops/method.cpp
--- a/src/hotspot/share/oops/method.cpp	Mon Mar 02 08:22:48 2020 +0100
+++ b/src/hotspot/share/oops/method.cpp	Mon Mar 02 10:15:37 2020 +0100
@@ -1175,7 +1175,7 @@
    // If the code cache is full, we may reenter this function for the
    // leftover methods that weren't linked.
    if (is_shared()) {
-    address entry = Interpreter::entry_for_cds_method(h_method);
+    DEBUG_ONLY(address entry = 
Interpreter::entry_for_cds_method(h_method);)
      assert(entry != NULL && entry == _i2i_entry,
             "should be correctly set during dump time");
      if (adapter() != NULL) {


More information about the hotspot-runtime-dev mailing list