hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java
changeset 8110 c992c8d52344
parent 5547 f4b087cbb361
child 10565 dc90c239f4ec
equal deleted inserted replaced
8109:26c288ddbec3 8110:c992c8d52344
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   105             virtualConstructor.addMapping("CompilerThread", CompilerThread.class);
   105             virtualConstructor.addMapping("CompilerThread", CompilerThread.class);
   106         }
   106         }
   107         // for now, use JavaThread itself. fix it later with appropriate class if needed
   107         // for now, use JavaThread itself. fix it later with appropriate class if needed
   108         virtualConstructor.addMapping("SurrogateLockerThread", JavaThread.class);
   108         virtualConstructor.addMapping("SurrogateLockerThread", JavaThread.class);
   109         virtualConstructor.addMapping("JvmtiAgentThread", JvmtiAgentThread.class);
   109         virtualConstructor.addMapping("JvmtiAgentThread", JvmtiAgentThread.class);
   110         virtualConstructor.addMapping("LowMemoryDetectorThread", LowMemoryDetectorThread.class);
   110         virtualConstructor.addMapping("ServiceThread", ServiceThread.class);
   111     }
   111     }
   112 
   112 
   113     public Threads() {
   113     public Threads() {
   114     }
   114     }
   115 
   115 
   116     /** NOTE: this returns objects of type JavaThread, CompilerThread,
   116     /** NOTE: this returns objects of type JavaThread, CompilerThread,
   117       JvmtiAgentThread, and LowMemoryDetectorThread.
   117       JvmtiAgentThread, and ServiceThread.
   118       The latter four are subclasses of the former. Most operations
   118       The latter four are subclasses of the former. Most operations
   119       (fetching the top frame, etc.) are only allowed to be performed on
   119       (fetching the top frame, etc.) are only allowed to be performed on
   120       a "pure" JavaThread. For this reason, {@link
   120       a "pure" JavaThread. For this reason, {@link
   121       sun.jvm.hotspot.runtime.JavaThread#isJavaThread} has been
   121       sun.jvm.hotspot.runtime.JavaThread#isJavaThread} has been
   122       changed from the definition in the VM (which returns true for
   122       changed from the definition in the VM (which returns true for
   141             JavaThread thread = (JavaThread)virtualConstructor.instantiateWrapperFor(threadAddr);
   141             JavaThread thread = (JavaThread)virtualConstructor.instantiateWrapperFor(threadAddr);
   142             thread.setThreadPDAccess(access);
   142             thread.setThreadPDAccess(access);
   143             return thread;
   143             return thread;
   144         } catch (Exception e) {
   144         } catch (Exception e) {
   145             throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr +
   145             throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr +
   146             " (expected type JavaThread, CompilerThread, LowMemoryDetectorThread, JvmtiAgentThread, or SurrogateLockerThread)", e);
   146             " (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread, or SurrogateLockerThread)", e);
   147         }
   147         }
   148     }
   148     }
   149 
   149 
   150     /** Memory operations */
   150     /** Memory operations */
   151     public void oopsDo(AddressVisitor oopVisitor) {
   151     public void oopsDo(AddressVisitor oopVisitor) {