src/hotspot/share/gc/shared/preservedMarks.hpp
changeset 47885 5caa1d5f74c1
parent 47216 71c04702a3d5
child 49392 2956d0ece7a9
equal deleted inserted replaced
47884:3cfab71d6c81 47885:5caa1d5f74c1
     1 /*
     1 /*
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    33 class PreservedMarksSet;
    33 class PreservedMarksSet;
    34 class WorkGang;
    34 class WorkGang;
    35 
    35 
    36 class PreservedMarks VALUE_OBJ_CLASS_SPEC {
    36 class PreservedMarks VALUE_OBJ_CLASS_SPEC {
    37 private:
    37 private:
    38   class OopAndMarkOop {
    38   class OopAndMarkOop VALUE_OBJ_CLASS_SPEC {
    39   private:
    39   private:
    40     oop _o;
    40     oop _o;
    41     markOop _m;
    41     markOop _m;
    42 
    42 
    43   public:
    43   public:
    44     OopAndMarkOop(oop obj, markOop m) : _o(obj), _m(m) { }
    44     OopAndMarkOop(oop obj, markOop m) : _o(obj), _m(m) { }
    45 
    45 
    46     void set_mark() const {
    46     oop get_oop() { return _o; }
    47       _o->set_mark(_m);
    47     void set_mark() const { _o->set_mark(_m); }
    48     }
    48     void set_oop(oop obj) { _o = obj; }
    49   };
    49   };
    50   typedef Stack<OopAndMarkOop, mtGC> OopAndMarkOopStack;
    50   typedef Stack<OopAndMarkOop, mtGC> OopAndMarkOopStack;
    51 
    51 
    52   OopAndMarkOopStack _stack;
    52   OopAndMarkOopStack _stack;
    53 
    53 
    54   inline bool should_preserve_mark(oop obj, markOop m) const;
    54   inline bool should_preserve_mark(oop obj, markOop m) const;
    55   inline void push(oop obj, markOop m);
       
    56 
    55 
    57 public:
    56 public:
    58   size_t size() const { return _stack.size(); }
    57   size_t size() const { return _stack.size(); }
       
    58   inline void push(oop obj, markOop m);
    59   inline void push_if_necessary(oop obj, markOop m);
    59   inline void push_if_necessary(oop obj, markOop m);
    60   // Iterate over the stack, restore all preserved marks, and
    60   // Iterate over the stack, restore all preserved marks, and
    61   // reclaim the memory taken up by the stack segments.
    61   // reclaim the memory taken up by the stack segments.
    62   void restore();
    62   void restore();
       
    63   // Iterate over the stack, adjust all preserved marks according
       
    64   // to their forwarding location stored in the mark.
       
    65   void adjust_during_full_gc();
    63 
    66 
    64   void restore_and_increment(volatile size_t* const _total_size_addr);
    67   void restore_and_increment(volatile size_t* const _total_size_addr);
    65   inline static void init_forwarded_mark(oop obj);
    68   inline static void init_forwarded_mark(oop obj);
    66 
    69 
    67   // Assert the stack is empty and has no cached segments.
    70   // Assert the stack is empty and has no cached segments.