pliden@6413: /* pliden@6413: * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. pliden@6413: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. pliden@6413: * pliden@6413: * This code is free software; you can redistribute it and/or modify it pliden@6413: * under the terms of the GNU General Public License version 2 only, as pliden@6413: * published by the Free Software Foundation. pliden@6413: * pliden@6413: * This code is distributed in the hope that it will be useful, but WITHOUT pliden@6413: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or pliden@6413: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License pliden@6413: * version 2 for more details (a copy is included in the LICENSE file that pliden@6413: * accompanied this code). pliden@6413: * pliden@6413: * You should have received a copy of the GNU General Public License version pliden@6413: * 2 along with this work; if not, write to the Free Software Foundation, pliden@6413: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. pliden@6413: * pliden@6413: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA pliden@6413: * or visit www.oracle.com if you need additional information or have any pliden@6413: * questions. pliden@6413: * pliden@6413: */ pliden@6413: pliden@6413: #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPTHREAD_HPP pliden@6413: #define SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPTHREAD_HPP pliden@6413: pliden@6413: #include "gc_implementation/g1/g1StringDedupStat.hpp" pliden@6413: #include "gc_implementation/shared/concurrentGCThread.hpp" pliden@6413: pliden@6413: // pliden@6413: // The deduplication thread is where the actual deduplication occurs. It waits for pliden@6413: // deduplication candidates to appear on the deduplication queue, removes them from pliden@6413: // the queue and tries to deduplicate them. It uses the deduplication hashtable to pliden@6413: // find identical, already existing, character arrays on the heap. The thread runs pliden@6413: // concurrently with the Java application but participates in safepoints to allow pliden@6413: // the GC to adjust and unlink oops from the deduplication queue and table. pliden@6413: // pliden@6413: class G1StringDedupThread: public ConcurrentGCThread { pliden@6413: private: pliden@6413: static G1StringDedupThread* _thread; pliden@6413: pliden@6413: G1StringDedupThread(); pliden@6413: ~G1StringDedupThread(); pliden@6413: pliden@6413: void print(outputStream* st, const G1StringDedupStat& last_stat, const G1StringDedupStat& total_stat); pliden@6413: pliden@6413: public: pliden@6413: static void create(); pliden@6690: static void stop(); pliden@6690: pliden@6413: static G1StringDedupThread* thread(); pliden@6413: pliden@6413: virtual void run(); pliden@6413: virtual void print_on(outputStream* st) const; pliden@6413: }; pliden@6413: pliden@6413: #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPTHREAD_HPP