changeset 46282:a001553763bc

8162104: Use in_cset() instead of obj_in_cs() Reviewed-by: ehelin, sjohanss
author tschatzl
date Thu, 23 Feb 2017 10:19:05 +0100
parents 758ec922d4f2
children 09e328af295a
files hotspot/src/share/vm/gc/g1/g1CodeBlobClosure.cpp hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp hotspot/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp
diffstat 7 files changed, 15 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/gc/g1/g1CodeBlobClosure.cpp	Thu Feb 23 10:18:21 2017 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CodeBlobClosure.cpp	Thu Feb 23 10:19:05 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -37,7 +37,7 @@
   if (!oopDesc::is_null(oop_or_narrowoop)) {
     oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);
     HeapRegion* hr = _g1h->heap_region_containing(o);
-    assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in collection set then evacuation failed and nm must already be in the remset");
+    assert(!_g1h->is_in_cset(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in collection set then evacuation failed and nm must already be in the remset");
     hr->add_strong_code_root(_nm);
   }
 }
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu Feb 23 10:18:21 2017 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu Feb 23 10:19:05 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -2364,11 +2364,6 @@
 }
 #endif
 
-bool G1CollectedHeap::obj_in_cs(oop obj) {
-  HeapRegion* r = _hrm.addr_to_region((HeapWord*) obj);
-  return r != NULL && r->in_collection_set();
-}
-
 // Iteration functions.
 
 // Applies an ExtendedOopClosure onto all references of objects within a HeapRegion.
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp	Thu Feb 23 10:18:21 2017 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp	Thu Feb 23 10:19:05 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -1129,9 +1129,7 @@
 #endif
 
   // Return "TRUE" iff the given object address is within the collection
-  // set. Slow implementation.
-  bool obj_in_cs(oop obj);
-
+  // set. Assumes that the reference points into the heap.
   inline bool is_in_cset(const HeapRegion *hr);
   inline bool is_in_cset(oop obj);
 
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp	Thu Feb 23 10:18:21 2017 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp	Thu Feb 23 10:19:05 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -142,16 +142,8 @@
   return _cm->nextMarkBitMap()->isMarked((HeapWord *)obj);
 }
 
-// This is a fast test on whether a reference points into the
-// collection set or not. Assume that the reference
-// points into the heap.
 inline bool G1CollectedHeap::is_in_cset(oop obj) {
-  bool ret = _in_cset_fast_test.is_in_cset((HeapWord*)obj);
-  // let's make sure the result is consistent with what the slower
-  // test returns
-  assert( ret || !obj_in_cs(obj), "sanity");
-  assert(!ret ||  obj_in_cs(obj), "sanity");
-  return ret;
+  return _in_cset_fast_test.is_in_cset((HeapWord*)obj);
 }
 
 bool G1CollectedHeap::is_in_cset(const HeapRegion* hr) {
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Thu Feb 23 10:18:21 2017 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Thu Feb 23 10:19:05 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -2012,7 +2012,7 @@
     guarantee(G1CMObjArrayProcessor::is_array_slice(obj) || obj->is_oop(),
               "Non-oop " PTR_FORMAT ", phase: %s, info: %d",
               p2i(obj), _phase, _info);
-    guarantee(G1CMObjArrayProcessor::is_array_slice(obj) || !_g1h->obj_in_cs(obj),
+    guarantee(G1CMObjArrayProcessor::is_array_slice(obj) || !_g1h->is_in_cset(obj),
               "obj: " PTR_FORMAT " in CSet, phase: %s, info: %d",
               p2i(obj), _phase, _info);
   }
--- a/hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp	Thu Feb 23 10:18:21 2017 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp	Thu Feb 23 10:19:05 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -114,7 +114,7 @@
     } else if (state.is_ext()) {
       _par_scan_state->do_oop_ext(p);
     } else {
-      assert(!_g1->obj_in_cs(obj), "checking");
+      assert(!_g1->is_in_cset(obj), "checking");
     }
   }
 }
--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp	Thu Feb 23 10:18:21 2017 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp	Thu Feb 23 10:19:05 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, 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
@@ -113,7 +113,7 @@
   if (has_partial_array_mask(ref)) {
     // Must be in the collection set--it's already been copied.
     oop p = clear_partial_array_mask(ref);
-    assert(_g1h->obj_in_cs(p),
+    assert(_g1h->is_in_cset(p),
            "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p));
   } else {
     oop p = oopDesc::load_decode_heap_oop(ref);
@@ -372,7 +372,7 @@
 }
 
 oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markOop m) {
-  assert(_g1h->obj_in_cs(old), "Object " PTR_FORMAT " should be in the CSet", p2i(old));
+  assert(_g1h->is_in_cset(old), "Object " PTR_FORMAT " should be in the CSet", p2i(old));
 
   oop forward_ptr = old->forward_to_atomic(old);
   if (forward_ptr == NULL) {
@@ -394,7 +394,7 @@
     // Forward-to-self failed. Either someone else managed to allocate
     // space for this object (old != forward_ptr) or they beat us in
     // self-forwarding it (old == forward_ptr).
-    assert(old == forward_ptr || !_g1h->obj_in_cs(forward_ptr),
+    assert(old == forward_ptr || !_g1h->is_in_cset(forward_ptr),
            "Object " PTR_FORMAT " forwarded to: " PTR_FORMAT " "
            "should not be in the CSet",
            p2i(old), p2i(forward_ptr));