[8u-dev] Request for approval JDK-8173013: JVMTI tagged object access needs G1 pre-barrier

Aleksey Shipilev shade at redhat.com
Fri Apr 13 16:22:25 UTC 2018


Hi,

Please approve the backport of this fix to 8u. This theoretically makes G1 more stable in 8u,
although I could not reproduce the failure with current G1 in 8u-dev (the reproducer is
time-sensitive). The absence of this fix causes problems with Shenandoah JDK 8 backport, which is
supposed to piggyback on G1 pre-barriers.

JDK 9 bug:
  https://bugs.openjdk.java.net/browse/JDK-8173013

JDK 9 change:
  http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/6c280bbde146

The patch needs to change include path to "gc_implementation", due to repository reshuffling:

diff -r 7fae638af89d src/share/vm/prims/jvmtiTagMap.cpp
--- a/src/share/vm/prims/jvmtiTagMap.cpp	Thu Nov 10 23:26:56 2016 -0800
+++ b/src/share/vm/prims/jvmtiTagMap.cpp	Fri Apr 13 17:25:08 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -47,6 +47,7 @@
 #include "services/serviceUtil.hpp"
 #include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
+#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #endif // INCLUDE_ALL_GCS

@@ -1519,6 +1520,14 @@
       if (_tags[i] == entry->tag()) {
         oop o = entry->object();
         assert(o != NULL && Universe::heap()->is_in_reserved(o), "sanity check");
+#if INCLUDE_ALL_GCS
+        if (UseG1GC) {
+          // The reference in this tag map could be the only (implicitly weak)
+          // reference to that object. If we hand it out, we need to keep it live wrt
+          // SATB marking similar to other j.l.ref.Reference referents.
+          G1SATBCardTableModRefBS::enqueue(o);
+        }
+#endif
         jobject ref = JNIHandles::make_local(JavaThread::current(), o);
         _object_results->append(ref);
         _tag_results->append((uint64_t)entry->tag());


Testing: x86_64 build

Thanks,
-Aleksey


More information about the jdk8u-dev mailing list