sun.jvm.hotspot.runtime.VM Java Examples

The following examples show how to use sun.jvm.hotspot.runtime.VM. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommandProcessor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        final PrintStream fout = out;
        final HTMLGenerator gen = new HTMLGenerator(false);
        CodeCacheVisitor v = new CodeCacheVisitor() {
                public void prologue(Address start, Address end) {
                }
                public void visit(CodeBlob blob) {
                    fout.println(gen.genHTML(blob.contentBegin()));
                }
                public void epilogue() {
                }


            };
        VM.getVM().getCodeCache().iterate(v);
    }
}
 
Example #2
Source File: CommandProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        SystemDictionary sysDict = VM.getVM().getSystemDictionary();
        sysDict.allClassesDo(new SystemDictionary.ClassVisitor() {
                public void visit(Klass k) {
                    if (k instanceof InstanceKlass && ((InstanceKlass)k).getConstants().getCache() != null) {
                        MethodArray methods = ((InstanceKlass)k).getMethods();
                        for (int i = 0; i < methods.length(); i++) {
                            Method m = methods.at(i);
                            HTMLGenerator gen = new HTMLGenerator(false);
                            out.println(gen.genHTML(m));
                        }
                    }
                }
            }
            );
    }
}
 
Example #3
Source File: CommandProcessor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                if (thread instanceof CompilerThread) {
                    CompilerThread ct = (CompilerThread)thread;
                    ciEnv env = ct.env();
                    if (env != null) {
                        Compile c = env.compilerData();
                        InlineTree ilt = c.ilt();
                        if (ilt != null) {
                            ilt.print(out);
                        }
                    }
                }
            }
        }
    }
}
 
Example #4
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        SystemDictionary sysDict = VM.getVM().getSystemDictionary();
        sysDict.allClassesDo(new SystemDictionary.ClassVisitor() {
                public void visit(Klass k) {
                    if (k instanceof InstanceKlass && ((InstanceKlass)k).getConstants().getCache() != null) {
                        MethodArray methods = ((InstanceKlass)k).getMethods();
                        for (int i = 0; i < methods.length(); i++) {
                            Method m = methods.at(i);
                            HTMLGenerator gen = new HTMLGenerator(false);
                            out.println(gen.genHTML(m));
                        }
                    }
                }
            }
            );
    }
}
 
Example #5
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
              if (thread instanceof CompilerThread) {
                CompilerThread ct = (CompilerThread)thread;
                out.println(ct);
                ciEnv env = ct.env();
                if (env != null) {
                  Compile c = env.compilerData();
                  c.cfg().dump(out);
                }
              }
            }
        }
    }
}
 
Example #6
Source File: CommandProcessor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
              if (thread instanceof CompilerThread) {
                CompilerThread ct = (CompilerThread)thread;
                out.println(ct);
                ciEnv env = ct.env();
                if (env != null) {
                  Compile c = env.compilerData();
                  c.cfg().dump(out);
                }
              }
            }
        }
    }
}
 
Example #7
Source File: CommandProcessor.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                if (thread instanceof CompilerThread) {
                    CompilerThread ct = (CompilerThread)thread;
                    ciEnv env = ct.env();
                    if (env != null) {
                        Compile c = env.compilerData();
                        InlineTree ilt = c.ilt();
                        if (ilt != null) {
                            ilt.print(out);
                        }
                    }
                }
            }
        }
    }
}
 
Example #8
Source File: CommandProcessor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        SystemDictionary sysDict = VM.getVM().getSystemDictionary();
        sysDict.allClassesDo(new SystemDictionary.ClassVisitor() {
                public void visit(Klass k) {
                    if (k instanceof InstanceKlass && ((InstanceKlass)k).getConstants().getCache() != null) {
                        MethodArray methods = ((InstanceKlass)k).getMethods();
                        for (int i = 0; i < methods.length(); i++) {
                            Method m = methods.at(i);
                            HTMLGenerator gen = new HTMLGenerator(false);
                            out.println(gen.genHTML(m));
                        }
                    }
                }
            }
            );
    }
}
 
Example #9
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
              if (thread instanceof CompilerThread) {
                CompilerThread ct = (CompilerThread)thread;
                out.println(ct);
                ciEnv env = ct.env();
                if (env != null) {
                  Compile c = env.compilerData();
                  c.root().dump(9999, out);
                } else {
                  out.println("  not compiling");
                }
              }
            }
        }
    }
}
 
Example #10
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        boolean all = name.equals("-a");
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                if (thread instanceof CompilerThread) {
                    CompilerThread ct = (CompilerThread)thread;
                    ciEnv env = ct.env();
                    if (env != null) {
                        Compile c = env.compilerData();
                        InlineTree ilt = c.ilt();
                        if (ilt != null) {
                            ilt.print(out);
                        }
                    }
                }
            }
        }
    }
}
 
Example #11
Source File: BsdDebuggerLocal.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** this functions used for core file reading and called from native attach0,
    it returns an array of long integers as
    [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for
    all java threads recorded in Threads. Also adds the ThreadProxy to threadList */
public long[] getJavaThreadsInfo() {
    requireAttach();
    Threads threads = VM.getVM().getThreads();
    int len = threads.getNumberOfThreads();
    long[] result = new long[len * 3];    // triple
    JavaThread t = threads.first();
    long beg, end;
    int i = 0;
    while (t != null) {
        end = t.getStackBaseValue();
        beg = end - t.getStackSize();
        BsdThread bsdt = (BsdThread)t.getThreadProxy();
        long uid = bsdt.getUniqueThreadId();
        if (threadList != null) threadList.add(bsdt);
        result[i] = uid;
        result[i + 1] = beg;
        result[i + 2] = end;
        t = t.next();
        i += 3;
    }
    return result;
}
 
Example #12
Source File: CommandProcessor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        final PrintStream fout = out;
        final HTMLGenerator gen = new HTMLGenerator(false);
        CodeCacheVisitor v = new CodeCacheVisitor() {
                public void prologue(Address start, Address end) {
                }
                public void visit(CodeBlob blob) {
                    fout.println(gen.genHTML(blob.contentBegin()));
                }
                public void epilogue() {
                }


            };
        VM.getVM().getCodeCache().iterate(v);
    }
}
 
Example #13
Source File: BsdDebuggerLocal.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** this functions used for core file reading and called from native attach0,
    it returns an array of long integers as
    [thread_id, stack_start, stack_end, thread_id, stack_start, stack_end, ....] for
    all java threads recorded in Threads. Also adds the ThreadProxy to threadList */
public long[] getJavaThreadsInfo() {
    requireAttach();
    Threads threads = VM.getVM().getThreads();
    int len = threads.getNumberOfThreads();
    long[] result = new long[len * 3];    // triple
    JavaThread t = threads.first();
    long beg, end;
    int i = 0;
    while (t != null) {
        end = t.getStackBaseValue();
        beg = end - t.getStackSize();
        BsdThread bsdt = (BsdThread)t.getThreadProxy();
        long uid = bsdt.getUniqueThreadId();
        if (threadList != null) threadList.add(bsdt);
        result[i] = uid;
        result[i + 1] = beg;
        result[i + 2] = end;
        t = t.next();
        i += 3;
    }
    return result;
}
 
Example #14
Source File: CommandProcessor.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            thread.printThreadIDOn(out);
            out.println(" " + thread.getThreadName());
        }
    }
}
 
Example #15
Source File: VirtualMachineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void init() {
    saVM = VM.getVM();
    saUniverse = saVM.getUniverse();
    saSystemDictionary = saVM.getSystemDictionary();
    saSymbolTable = saVM.getSymbolTable();
    saObjectHeap = saVM.getObjectHeap();
    initClassNameSymbols();
}
 
Example #16
Source File: G1HeapRegionTable.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private HeapRegion at(long index) {
    Address arrayAddr = baseField.getValue(addr);
    // Offset of &_base[index]
    long offset = index * VM.getVM().getAddressSize();
    Address regionAddr = arrayAddr.getAddressAt(offset);
    return (HeapRegion) VMObjectFactory.newObject(HeapRegion.class,
                                                  regionAddr);
}
 
Example #17
Source File: CompactibleFreeListSpace.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static synchronized void initialize(TypeDataBase db) {
   long sizeofFreeChunk = db.lookupType("FreeChunk").getSize();
   VM vm = VM.getVM();
   MinChunkSizeInBytes = numQuanta(sizeofFreeChunk, vm.getMinObjAlignmentInBytes()) *
                  vm.getMinObjAlignmentInBytes();

  Type type = db.lookupType("CompactibleFreeListSpace");
  collectorField = type.getAddressField("_collector");
  collectorField       = type.getAddressField("_collector");
  dictionaryField      = type.getAddressField("_dictionary");
  indexedFreeListField = type.getAddressField("_indexedFreeList[0]");
  smallLinearAllocBlockFieldOffset = type.getField("_smallLinearAllocBlock").getOffset();
}
 
Example #18
Source File: JInfo.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void printVMFlags() {
    VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    System.out.print("Non-default VM flags: ");
    for (VM.Flag flag : flags) {
        if (flag.getOrigin() == 0) {
            // only print flags which aren't their defaults
            continue;
        }
        if (flag.isBool()) {
            String onoff = flag.getBool() ? "+" : "-";
            System.out.print("-XX:" + onoff + flag.getName() + " ");
        } else {
            System.out.print("-XX:" + flag.getName() + "="
                    + flag.getValue() + " ");
        }
    }
    System.out.println();

    System.out.print("Command line: ");
    String str = Arguments.getJVMFlags();
    if (str != null) {
        System.out.print(str + " ");
    }
    str = Arguments.getJVMArgs();
    if (str != null) {
        System.out.print(str);
    }
    System.out.println();
}
 
Example #19
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            thread.printThreadIDOn(out);
            out.println(" " + thread.getThreadName());
            thread.printInfoOn(out);
            out.println("\n...");
        }
    }
}
 
Example #20
Source File: JInfo.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void printVMFlags() {
    VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    System.out.print("Non-default VM flags: ");
    for (VM.Flag flag : flags) {
        if (flag.getOrigin() == 0) {
            // only print flags which aren't their defaults
            continue;
        }
        if (flag.isBool()) {
            String onoff = flag.getBool() ? "+" : "-";
            System.out.print("-XX:" + onoff + flag.getName() + " ");
        } else {
            System.out.print("-XX:" + flag.getName() + "="
                    + flag.getValue() + " ");
        }
    }
    System.out.println();

    System.out.print("Command line: ");
    String str = Arguments.getJVMFlags();
    if (str != null) {
        System.out.print(str + " ");
    }
    str = Arguments.getJVMArgs();
    if (str != null) {
        System.out.print(str);
    }
    System.out.println();
}
 
Example #21
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        Threads threads = VM.getVM().getThreads();
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            thread.printThreadIDOn(out);
            out.println(" " + thread.getThreadName());
            thread.printInfoOn(out);
            out.println("\n...");
        }
    }
}
 
Example #22
Source File: CommandProcessor.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 0) {
        usage();
    } else {
        Universe u = VM.getVM().getUniverse();
        out.println("Heap Parameters:");
        u.heap().printOn(out);
    }
}
 
Example #23
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
        HTMLGenerator gen = new HTMLGenerator(false);
        out.println(gen.genHTML(a));
    }
}
 
Example #24
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
        PointerLocation loc = PointerFinder.find(a);
        loc.printOn(out);
    }
}
 
Example #25
Source File: CommandProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
        HTMLGenerator gen = new HTMLGenerator(false);
        out.println(gen.genHTML(a));
    }
}
 
Example #26
Source File: CommandProcessor.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        String name = t.nextToken();
        Threads threads = VM.getVM().getThreads();
        boolean all = name.equals("-a");
        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            thread.printThreadIDOn(new PrintStream(bos));
            if (all || bos.toString().equals(name)) {
                out.println("Thread " + bos.toString() + " Address: " + thread.getAddress());
                HTMLGenerator gen = new HTMLGenerator(false);
                try {
                    out.println(gen.genHTMLForJavaStackTrace(thread));
                } catch (Exception e) {
                    err.println("Error: " + e);
                    if (verboseExceptions) {
                        e.printStackTrace(err);
                    }
                }
                if (!all) return;
            }
        }
        if (!all) out.println("Couldn't find thread " + name);
    }
}
 
Example #27
Source File: CommandProcessor.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    int tokens = t.countTokens();
    if (tokens != 1) {
        usage();
        return;
    }
    Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
    Method m = (Method)Metadata.instantiateWrapperFor(a);
    HTMLGenerator html = new HTMLGenerator(false);
    out.println(html.genHTML(m));
}
 
Example #28
Source File: CommandProcessor.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 2) {
        usage();
    } else {
        Type type = agent.getTypeDataBase().lookupType(t.nextToken());
        Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
        CTypeTreeNodeAdapter node = new CTypeTreeNodeAdapter(a, type, null);

        out.println("pointer to " + type + " @ " + a +
                    " (size = " + type.getSize() + ")");
        printNode(node);
    }
}
 
Example #29
Source File: HotSpotAgent.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private boolean detachInternal() {
    if (debugger == null) {
        return false;
    }
    boolean retval = true;
    if (!isServer) {
        VM.shutdown();
    }
    // We must not call detach() if we are a client and are connected
    // to a remote debugger
    Debugger dbg = null;
    DebuggerException ex = null;
    if (isServer) {
        try {
            RMIHelper.unbind(serverID);
        }
        catch (DebuggerException de) {
            ex = de;
        }
        dbg = debugger;
    } else {
        if (startupMode != REMOTE_MODE) {
            dbg = debugger;
        }
    }
    if (dbg != null) {
        retval = dbg.detach();
    }

    debugger = null;
    machDesc = null;
    db = null;
    if (ex != null) {
        throw(ex);
    }
    return retval;
}
 
Example #30
Source File: CommandProcessor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
        Symbol.create(a).printValueOn(out);
        out.println();
    }
}