1 /* 2 * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. 7 * 8 * This code is distributed in the hope that it will be useful, but WITHOUT 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * version 2 for more details (a copy is included in the LICENSE file that 12 * accompanied this code). 13 * 14 * You should have received a copy of the GNU General Public License version 15 * 2 along with this work; if not, write to the Free Software Foundation, 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * 18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * or visit www.oracle.com if you need additional information or have any 20 * questions. 21 * 22 */ 23 24 #include "precompiled.hpp" 25 26 #include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp" 27 #include "gc_implementation/shenandoah/shenandoahVMOperations.hpp" 28 #include "gc_implementation/shenandoah/shenandoahUtils.hpp" 29 30 bool VM_ShenandoahReferenceOperation::doit_prologue() { 31 if (Thread::current()->is_Java_thread()) { 32 InstanceRefKlass::acquire_pending_list_lock(&_pending_list_basic_lock); 33 } else { 34 ShenandoahHeap *sh = (ShenandoahHeap*) Universe::heap(); 35 sh->acquire_pending_refs_lock(); 36 } 37 return true; 38 } 39 40 void VM_ShenandoahReferenceOperation::doit_epilogue() { 41 if (Thread::current()->is_Java_thread()) { 42 InstanceRefKlass::release_and_notify_pending_list_lock(&_pending_list_basic_lock); 43 } else { 44 ShenandoahHeap *sh = ShenandoahHeap::heap(); 45 sh->release_pending_refs_lock(); 46 } 47 } 48 49 void VM_ShenandoahInitMark::doit() { 50 ShenandoahGCPauseMark mark(SvcGCMarker::OTHER); 51 ShenandoahHeap::heap()->entry_init_mark(); 52 } 53 54 void VM_ShenandoahFinalMarkStartEvac::doit() { 55 ShenandoahGCPauseMark mark(SvcGCMarker::OTHER); 56 ShenandoahHeap::heap()->entry_final_mark(); 57 } 58 59 void VM_ShenandoahFinalEvac::doit() { 60 ShenandoahGCPauseMark mark(SvcGCMarker::OTHER); 61 ShenandoahHeap::heap()->entry_final_evac(); 62 } 63 64 void VM_ShenandoahFullGC::doit() { 65 ShenandoahGCPauseMark mark(SvcGCMarker::FULL); 66 ShenandoahHeap::heap()->entry_full(_gc_cause); 67 } 68 69 void VM_ShenandoahInitTraversalGC::doit() { 70 ShenandoahGCPauseMark mark(SvcGCMarker::OTHER); 71 ShenandoahHeap::heap()->entry_init_traversal(); 72 } 73 74 void VM_ShenandoahFinalTraversalGC::doit() { 75 ShenandoahGCPauseMark mark(SvcGCMarker::OTHER); 76 ShenandoahHeap::heap()->entry_final_traversal(); 77 } 78 79 void VM_ShenandoahInitUpdateRefs::doit() { 80 ShenandoahGCPauseMark mark(SvcGCMarker::OTHER); 81 ShenandoahHeap::heap()->entry_init_updaterefs(); 82 } 83 84 void VM_ShenandoahFinalUpdateRefs::doit() { 85 ShenandoahGCPauseMark mark(SvcGCMarker::OTHER); 86 ShenandoahHeap::heap()->entry_final_updaterefs(); 87 } 88 89 void VM_ShenandoahDegeneratedGC::doit() { 90 ShenandoahGCPauseMark mark(SvcGCMarker::OTHER); 91 ShenandoahHeap::heap()->entry_degenerated(_point); 92 }