# HG changeset patch # User dbuck # Date 1415261890 0 # Node ID 1b27e73be477a0c1f58a9b46126d7b1a8b8d4de0 # Parent 6ac67737d35955c1229542896725ab9f799e086b# Parent 1f22a5d5be00612b6ee7378feeac4c5e13f37f87 Merge diff -r 6ac67737d359 -r 1b27e73be477 hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/CodeCacheSweeperThread.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/CodeCacheSweeperThread.java Thu Nov 06 08:18:10 2014 +0000 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package sun.jvm.hotspot.runtime; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.types.*; + +public class CodeCacheSweeperThread extends JavaThread { + public CodeCacheSweeperThread(Address addr) { + super(addr); + } + + public boolean isJavaThread() { return false; } + public boolean isHiddenFromExternalView() { return true; } + public boolean isCodeCacheSweeperThread() { return true; } + +} diff -r 6ac67737d359 -r 1b27e73be477 hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java Wed Nov 05 23:37:17 2014 -0800 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java Thu Nov 06 08:18:10 2014 +0000 @@ -118,9 +118,10 @@ return VM.getVM().getThreads().createJavaThreadWrapper(threadAddr); } - /** NOTE: for convenience, this differs in definition from the - underlying VM. Only "pure" JavaThreads return true; - CompilerThreads and JVMDIDebuggerThreads return false. FIXME: + /** NOTE: for convenience, this differs in definition from the underlying VM. + Only "pure" JavaThreads return true; CompilerThreads, the CodeCacheSweeperThread, + JVMDIDebuggerThreads return false. + FIXME: consider encapsulating platform-specific functionality in an object instead of using inheritance (which is the primary reason we can't traverse CompilerThreads, etc; didn't want to have, for diff -r 6ac67737d359 -r 1b27e73be477 hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Thread.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Thread.java Wed Nov 05 23:37:17 2014 -0800 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Thread.java Thu Nov 06 08:18:10 2014 +0000 @@ -111,14 +111,15 @@ return allocatedBytesField.getValue(addr); } - public boolean isVMThread() { return false; } - public boolean isJavaThread() { return false; } - public boolean isCompilerThread() { return false; } - public boolean isHiddenFromExternalView() { return false; } - public boolean isJvmtiAgentThread() { return false; } - public boolean isWatcherThread() { return false; } + public boolean isVMThread() { return false; } + public boolean isJavaThread() { return false; } + public boolean isCompilerThread() { return false; } + public boolean isCodeCacheSweeperThread() { return false; } + public boolean isHiddenFromExternalView() { return false; } + public boolean isJvmtiAgentThread() { return false; } + public boolean isWatcherThread() { return false; } public boolean isConcurrentMarkSweepThread() { return false; } - public boolean isServiceThread() { return false; } + public boolean isServiceThread() { return false; } /** Memory operations */ public void oopsDo(AddressVisitor oopVisitor) { diff -r 6ac67737d359 -r 1b27e73be477 hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Wed Nov 05 23:37:17 2014 -0800 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Thu Nov 06 08:18:10 2014 +0000 @@ -120,6 +120,7 @@ virtualConstructor.addMapping("JavaThread", JavaThread.class); if (!VM.getVM().isCore()) { virtualConstructor.addMapping("CompilerThread", CompilerThread.class); + virtualConstructor.addMapping("CodeCacheSweeperThread", CodeCacheSweeperThread.class); } // for now, use JavaThread itself. fix it later with appropriate class if needed virtualConstructor.addMapping("SurrogateLockerThread", JavaThread.class); @@ -164,7 +165,7 @@ return thread; } catch (Exception e) { throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr + - " (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread, or SurrogateLockerThread)", e); + " (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread, SurrogateLockerThread, or CodeCacheSweeperThread)", e); } } @@ -201,7 +202,7 @@ public List getPendingThreads(ObjectMonitor monitor) { List pendingThreads = new ArrayList(); for (JavaThread thread = first(); thread != null; thread = thread.next()) { - if (thread.isCompilerThread()) { + if (thread.isCompilerThread() || thread.isCodeCacheSweeperThread()) { continue; } ObjectMonitor pending = thread.getCurrentPendingMonitor(); diff -r 6ac67737d359 -r 1b27e73be477 hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Wed Nov 05 23:37:17 2014 -0800 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Thu Nov 06 08:18:10 2014 +0000 @@ -836,6 +836,7 @@ // Java Threads vmType2Class["JavaThread"] = sapkg.runtime.JavaThread; vmType2Class["CompilerThread"] = sapkg.runtime.CompilerThread; +vmType2Class["CodeCacheSweeperThread"] = sapkg.runtime.CodeCacheSweeperThread; vmType2Class["SurrogateLockerThread"] = sapkg.runtime.JavaThread; vmType2Class["DebuggerThread"] = sapkg.runtime.DebuggerThread; diff -r 6ac67737d359 -r 1b27e73be477 hotspot/src/share/vm/runtime/vmStructs.cpp --- a/hotspot/src/share/vm/runtime/vmStructs.cpp Wed Nov 05 23:37:17 2014 -0800 +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Thu Nov 06 08:18:10 2014 +0000 @@ -1594,6 +1594,7 @@ declare_type(JvmtiAgentThread, JavaThread) \ declare_type(ServiceThread, JavaThread) \ declare_type(CompilerThread, JavaThread) \ + declare_type(CodeCacheSweeperThread, JavaThread) \ declare_toplevel_type(OSThread) \ declare_toplevel_type(JavaFrameAnchor) \ \