< prev index next >

src/hotspot/share/gc/shared/preservedMarks.cpp

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2016, 2021, 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 2016, 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 22,10 ***
--- 22,11 ---
   *
   */
  
  #include "precompiled.hpp"
  #include "gc/shared/preservedMarks.inline.hpp"
+ #include "gc/shared/slidingForwarding.inline.hpp"
  #include "gc/shared/workerThread.hpp"
  #include "gc/shared/workerUtils.hpp"
  #include "memory/allocation.inline.hpp"
  #include "memory/resourceArea.hpp"
  #include "oops/oop.inline.hpp"

*** 38,22 ***
      elem.set_mark();
    }
    assert_empty();
  }
  
! void PreservedMarks::adjust_during_full_gc() {
    StackIterator<OopAndMarkWord, mtGC> iter(_stack);
    while (!iter.is_empty()) {
      OopAndMarkWord* elem = iter.next_addr();
  
      oop obj = elem->get_oop();
      if (obj->is_forwarded()) {
!       elem->set_oop(obj->forwardee());
      }
    }
  }
  
  void PreservedMarks::restore_and_increment(volatile size_t* const total_size_addr) {
    const size_t stack_size = size();
    restore();
    // Only do the atomic add if the size is > 0.
    if (stack_size > 0) {
--- 39,31 ---
      elem.set_mark();
    }
    assert_empty();
  }
  
! template <bool ALT_FWD>
+ void PreservedMarks::adjust_during_full_gc_impl() {
    StackIterator<OopAndMarkWord, mtGC> iter(_stack);
    while (!iter.is_empty()) {
      OopAndMarkWord* elem = iter.next_addr();
  
      oop obj = elem->get_oop();
      if (obj->is_forwarded()) {
!       elem->set_oop(SlidingForwarding::forwardee<ALT_FWD>(obj));
      }
    }
  }
  
+ void PreservedMarks::adjust_during_full_gc() {
+   if (UseAltGCForwarding) {
+     adjust_during_full_gc_impl<true>();
+   } else {
+     adjust_during_full_gc_impl<false>();
+   }
+ }
+ 
  void PreservedMarks::restore_and_increment(volatile size_t* const total_size_addr) {
    const size_t stack_size = size();
    restore();
    // Only do the atomic add if the size is > 0.
    if (stack_size > 0) {
< prev index next >