1 /* 2 * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "incls/_precompiled.incl" 26 #include "incls/_g1SATBCardTableModRefBS.cpp.incl" 27 28 G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap, 29 int max_covered_regions) : 30 CardTableModRefBSForCTRS(whole_heap, max_covered_regions) 31 { 32 _kind = G1SATBCT; 33 } 34 35 36 void G1SATBCardTableModRefBS::enqueue(oop pre_val) { 37 assert(pre_val->is_oop_or_null(true), "Error"); 38 if (!JavaThread::satb_mark_queue_set().is_active()) return; 39 Thread* thr = Thread::current(); 40 if (thr->is_Java_thread()) { 41 JavaThread* jt = (JavaThread*)thr; 42 jt->satb_mark_queue().enqueue(pre_val); 43 } else { 44 MutexLocker x(Shared_SATB_Q_lock); 45 JavaThread::satb_mark_queue_set().shared_satb_queue()->enqueue(pre_val); 46 } | 1 /* 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" 27 #include "gc_implementation/g1/heapRegion.hpp" 28 #include "gc_implementation/g1/satbQueue.hpp" 29 #include "runtime/mutexLocker.hpp" 30 #include "runtime/thread.hpp" 31 #ifdef TARGET_OS_FAMILY_linux 32 # include "thread_linux.inline.hpp" 33 #endif 34 #ifdef TARGET_OS_FAMILY_solaris 35 # include "thread_solaris.inline.hpp" 36 #endif 37 #ifdef TARGET_OS_FAMILY_windows 38 # include "thread_windows.inline.hpp" 39 #endif 40 41 G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap, 42 int max_covered_regions) : 43 CardTableModRefBSForCTRS(whole_heap, max_covered_regions) 44 { 45 _kind = G1SATBCT; 46 } 47 48 49 void G1SATBCardTableModRefBS::enqueue(oop pre_val) { 50 assert(pre_val->is_oop_or_null(true), "Error"); 51 if (!JavaThread::satb_mark_queue_set().is_active()) return; 52 Thread* thr = Thread::current(); 53 if (thr->is_Java_thread()) { 54 JavaThread* jt = (JavaThread*)thr; 55 jt->satb_mark_queue().enqueue(pre_val); 56 } else { 57 MutexLocker x(Shared_SATB_Q_lock); 58 JavaThread::satb_mark_queue_set().shared_satb_queue()->enqueue(pre_val); 59 } |