Module openj9.dtfj

Class JCJavaRuntime

  • All Implemented Interfaces:
    JavaRuntime, ManagedRuntime

    public class JCJavaRuntime
    extends Object
    implements JavaRuntime
    A javacore-based implementation of JavaRuntime. This supports partial object creation, meaning that a javaclass, javathread, etc.. can be partially constructed and stored, and at a later time during the javacore parsing, when more information is available, existing javaclasses, javathreads, and so on can be looked up and data added.

    However, all partial objects must contain at least one immutable field. See the implementation of each runtime component for more information.

    Rudimentary multiplatform support is also added in the form of unique runtime ids that must be passed during construction.
    See Also:
    JCJavaClass, JCJavaClassLoader, JCJavaThread, JCJavaMonitor, JavaRuntime
    • Method Detail

      • getCompiledMethods

        public Iterator getCompiledMethods()
        Description copied from interface: JavaRuntime
        This is short cut method. The same result can be found by iterating over all methods in all class loaders in all classes.
        Specified by:
        getCompiledMethods in interface JavaRuntime
        Returns:
        an iterator over all of the JavaMethods in the JavaRuntime which have been compiled
        See Also:
        JavaRuntime.getCompiledMethods()
      • getHeaps

        public Iterator getHeaps()
        Description copied from interface: JavaRuntime
        Get the set of heaps known by the VM
        Specified by:
        getHeaps in interface JavaRuntime
        Returns:
        an iterator for all of the Java heaps within this runtime. Heaps may be specific to this JavaVM instance, or may be shared between multiple JavaVM instances
        See Also:
        JavaRuntime.getHeaps()
      • getMonitors

        public Iterator getMonitors()
        Description copied from interface: JavaRuntime
        Provides access to the collection of monitors used in the JavaVM. This collection includes both monitors associated with managed objects (e.g. object monitors) and monitors associated with internal control structures (e.g. raw monitors)
        Specified by:
        getMonitors in interface JavaRuntime
        Returns:
        an iterator over the collection of monitors
        See Also:
        JavaRuntime.getMonitors()
      • getTraceBuffer

        public Object getTraceBuffer​(String arg0,
                                     boolean arg1)
                              throws CorruptDataException
        Description copied from interface: JavaRuntime
        Fetches implementation specific trace buffers, like the verbose GC buffer or the Universal Trace Engine (UTE) buffer
        Specified by:
        getTraceBuffer in interface JavaRuntime
        Parameters:
        arg0 - a String naming the buffer to be fetched
        arg1 - true if formatting should be performed on the buffer, or false if the raw buffer contents should be returned
        Returns:
        an implementation specific result, depending on the parameters
        Throws:
        CorruptDataException
        See Also:
        com.ibm.dtfj.java.JavaRuntime#getTraceBuffer()
      • getInternalID

        public String getInternalID()
        NON-DTFJ
        For internal building purposes only. Do not call outside the DTFJ implementation.

        May be used in multiple runtime environments, where each runtime in a javacore is identified uniquely. This method is generally just used during the building process only.
      • findJavaClassLoader

        public JCJavaClassLoader findJavaClassLoader​(long clLoaderID)
        NON-DTFJ
        For internal building purposes only. Do not call outside the DTFJ implementation.

        Parameters:
        javaClassLoaderName -
        Returns:
        javaclassloader if found or null
      • findMonitor

        public JCJavaMonitor findMonitor​(long id)
        NON-DTFJ
        For internal building purposes only. Do not call outside the DTFJ implementation.

        Parameters:
        id -
        Returns:
        found java monitor or null
      • addJavaThread

        public void addJavaThread​(JCJavaThread javaThread)
                           throws JCInvalidArgumentsException
        NON-DTFJ
        For internal building purposes only. Do not call outside the DTFJ implementation.

        Parameters:
        javaThread - must not be null.
        Throws:
        JCRegistrationFailureException - if java thread is null
        JCInvalidArgumentsException
      • findJavaThread

        public JCJavaThread findJavaThread​(long threadID)
        NON-DTFJ
        For internal building purposes only. Do not call outside the DTFJ implementation.

        In most cases, the threadID is the tid in a javacore, but in some other occasions, the id passed could be the system_thread_id or even the native thread. If a java thread is not found via tid, see if it can be found indirectly by an image thread that may be associated with the java thread (the image thread has a system thread ID as well as a native thread ID).
        Parameters:
        threadID - usually, tid in a javacore, may be id of some other internal vm datastructure.
        Returns:
        found java thread or null.
      • getImageProcess

        public JCImageProcess getImageProcess()
        NON-DTFJ
        For internal building purposes only. Do not call outside the DTFJ implementation.

        Returns:
        image process containing this java runtime. This should never be null.
      • addJavaClass

        public void addJavaClass​(JCJavaClass javaClass)
                          throws JCInvalidArgumentsException
        NON-DTFJ
        For internal building purposes only. Do not call outside the DTFJ implementation.

        Two separate maps are kept for classes. One based on class ID, the other based on class name. Both are used for lookups while building the runtime object. When a valid javaclass is added, it gets added at least the name-based map, and may be added to the ID-based map if the ID is available. The class name of the java class is a requirement, so this field must be set in the java class being passed.
        Parameters:
        javaClass - must not be null or exception thrown
        Throws:
        JCRegistrationFailureException - if java class is null
        JCInvalidArgumentsException
      • findJavaClass

        public JCJavaClass findJavaClass​(String javaClassName)
        NON-DTFJ
        For internal building purposes only. Do not call outside the DTFJ implementation.
        Parameters:
        javaClassName -
        Returns:
        found class or null if not found
      • findJavaClass

        public JCJavaClass findJavaClass​(long id)
        NON-DTFJ
        For internal building purposes only. Do not call outside the DTFJ implementation.

        In some cases, all that is available is a class ID, so it should be possible to retrieve a class based on just an ID.
        Parameters:
        id - class address
        Returns:
        found class or null if not found
      • setVersion

        public void setVersion​(String version)
        NON-DTFJ
        For internal building purposes only. Do not call outside the DTFJ implementation.

        Parameters:
        args - , the version string
      • setJITEnabled

        public void setJITEnabled​(boolean enabled)
      • addJITProperty

        public void addJITProperty​(String name,
                                   String value)
      • setStartTime

        public void setStartTime​(long startTime)
      • setStartTimeNanos

        public void setStartTimeNanos​(long nanoTime)