< prev index next >

src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.inline.hpp

Print this page

552 inline bool ScavengingReleaseOp<Mspace, List>::excise_with_release(typename List::NodePtr node) {
553   assert(node != NULL, "invariant");
554   assert(node->retired(), "invariant");
555   _prev = _list.excise(_prev, node);
556   if (node->transient()) {
557     _mspace->deallocate(node);
558     return true;
559   }
560   assert(node->identity() != NULL, "invariant");
561   assert(node->empty(), "invariant");
562   assert(!node->lease(), "invariant");
563   assert(!node->excluded(), "invariant");
564   ++_count;
565   _amount += node->total_size();
566   node->clear_retired();
567   node->release();
568   mspace_release(node, _mspace);
569   return true;
570 }
571 
572 template <typename Mspace, typename FromList>
573 class ReleaseRetiredOp : public StackObj {
574 private:

575   Mspace* _mspace;
576   FromList& _list;
577   typename Mspace::NodePtr _prev;
578 public:
579   typedef typename Mspace::Node Node;
580   ReleaseRetiredOp(Mspace* mspace, FromList& list) :
581     _mspace(mspace), _list(list), _prev(NULL) {}
582   bool process(Node* node);
583 };
584 
585 template <typename Mspace, typename FromList>
586 inline bool ReleaseRetiredOp<Mspace, FromList>::process(typename Mspace::Node* node) {
587   assert(node != NULL, "invariant");
588   if (node->retired()) {



589     _prev = _list.excise(_prev, node);
590     node->reinitialize();
591     assert(node->empty(), "invariant");
592     assert(!node->retired(), "invariant");
593     node->release();
594     mspace_release(node, _mspace);
595   } else {
596     _prev = node;
597   }
598   return true;
599 }
600 
601 template <typename Mspace, typename FromList>
602 class ReinitializeAllReleaseRetiredOp : public StackObj {
603 private:
604   Mspace* _mspace;
605   FromList& _list;
606   typename Mspace::NodePtr _prev;
607  public:
608   typedef typename Mspace::Node Node;
609   ReinitializeAllReleaseRetiredOp(Mspace* mspace, FromList& list) :
610     _mspace(mspace), _list(list), _prev(NULL) {}
611   bool process(Node* node);
612 };
613 
614 template <typename Mspace, typename FromList>
615 inline bool ReinitializeAllReleaseRetiredOp<Mspace, FromList>::process(typename Mspace::Node* node) {
616   assert(node != NULL, "invariant");
617   // assumes some means of exclusive access to node
618   const bool retired = node->retired();

552 inline bool ScavengingReleaseOp<Mspace, List>::excise_with_release(typename List::NodePtr node) {
553   assert(node != NULL, "invariant");
554   assert(node->retired(), "invariant");
555   _prev = _list.excise(_prev, node);
556   if (node->transient()) {
557     _mspace->deallocate(node);
558     return true;
559   }
560   assert(node->identity() != NULL, "invariant");
561   assert(node->empty(), "invariant");
562   assert(!node->lease(), "invariant");
563   assert(!node->excluded(), "invariant");
564   ++_count;
565   _amount += node->total_size();
566   node->clear_retired();
567   node->release();
568   mspace_release(node, _mspace);
569   return true;
570 }
571 
572 template <typename Functor, typename Mspace, typename FromList>
573 class ReleaseRetiredOp : public StackObj {
574 private:
575   Functor& _functor;
576   Mspace* _mspace;
577   FromList& _list;
578   typename Mspace::NodePtr _prev;
579 public:
580   typedef typename Mspace::Node Node;
581   ReleaseRetiredOp(Functor& functor, Mspace* mspace, FromList& list) :
582     _functor(functor), _mspace(mspace), _list(list), _prev(NULL) {}
583   bool process(Node* node);
584 };
585 
586 template <typename Functor, typename Mspace, typename FromList>
587 inline bool ReleaseRetiredOp<Functor, Mspace, FromList>::process(typename Mspace::Node* node) {
588   assert(node != NULL, "invariant");
589   const bool is_retired = node->retired();
590   const bool result = _functor.process(node);
591   if (is_retired) {
592     assert(node->unflushed_size() == 0, "invariant");
593     _prev = _list.excise(_prev, node);
594     node->reinitialize();
595     assert(node->empty(), "invariant");
596     assert(!node->retired(), "invariant");
597     node->release();
598     mspace_release(node, _mspace);
599   } else {
600     _prev = node;
601   }
602   return result;
603 }
604 
605 template <typename Mspace, typename FromList>
606 class ReinitializeAllReleaseRetiredOp : public StackObj {
607 private:
608   Mspace* _mspace;
609   FromList& _list;
610   typename Mspace::NodePtr _prev;
611  public:
612   typedef typename Mspace::Node Node;
613   ReinitializeAllReleaseRetiredOp(Mspace* mspace, FromList& list) :
614     _mspace(mspace), _list(list), _prev(NULL) {}
615   bool process(Node* node);
616 };
617 
618 template <typename Mspace, typename FromList>
619 inline bool ReinitializeAllReleaseRetiredOp<Mspace, FromList>::process(typename Mspace::Node* node) {
620   assert(node != NULL, "invariant");
621   // assumes some means of exclusive access to node
622   const bool retired = node->retired();
< prev index next >