8184994: Add Dictionary size logging and jcmd

Added dcmd for printing system dictionary like the stringtable and symboltable and making print functions go to outputstream rather than tty

Reviewed-by: shade, hseigel
This commit is contained in:
Coleen Phillimore 2017-08-02 10:52:50 -04:00
parent 366e6ac796
commit 17f23d1881
30 changed files with 349 additions and 254 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -25,10 +25,8 @@
#ifndef SHARE_VM_CLASSFILE_COMPACTHASHTABLE_HPP
#define SHARE_VM_CLASSFILE_COMPACTHASHTABLE_HPP
#include "classfile/stringTable.hpp"
#include "classfile/symbolTable.hpp"
#include "oops/array.hpp"
#include "oops/symbol.hpp"
#include "services/diagnosticCommand.hpp"
#include "utilities/hashtable.hpp"
template <class T, class N> class CompactHashtable;
@ -357,89 +355,4 @@ public:
static void put_utf8(outputStream* st, const char* utf8_string, int utf8_length);
};
///////////////////////////////////////////////////////////////////////
//
// jcmd command support for symbol table and string table dumping:
// VM.symboltable -verbose: for dumping the symbol table
// VM.stringtable -verbose: for dumping the string table
//
class VM_DumpHashtable : public VM_Operation {
private:
outputStream* _out;
int _which;
bool _verbose;
public:
enum {
DumpSymbols = 1 << 0,
DumpStrings = 1 << 1,
DumpSysDict = 1 << 2 // not implemented yet
};
VM_DumpHashtable(outputStream* out, int which, bool verbose) {
_out = out;
_which = which;
_verbose = verbose;
}
virtual VMOp_Type type() const { return VMOp_DumpHashtable; }
virtual void doit() {
switch (_which) {
case DumpSymbols:
SymbolTable::dump(_out, _verbose);
break;
case DumpStrings:
StringTable::dump(_out, _verbose);
break;
default:
ShouldNotReachHere();
}
}
};
class SymboltableDCmd : public DCmdWithParser {
protected:
DCmdArgument<bool> _verbose;
public:
SymboltableDCmd(outputStream* output, bool heap);
static const char* name() {
return "VM.symboltable";
}
static const char* description() {
return "Dump symbol table.";
}
static const char* impact() {
return "Medium: Depends on Java content.";
}
static const JavaPermission permission() {
JavaPermission p = {"java.lang.management.ManagementPermission",
"monitor", NULL};
return p;
}
static int num_arguments();
virtual void execute(DCmdSource source, TRAPS);
};
class StringtableDCmd : public DCmdWithParser {
protected:
DCmdArgument<bool> _verbose;
public:
StringtableDCmd(outputStream* output, bool heap);
static const char* name() {
return "VM.stringtable";
}
static const char* description() {
return "Dump string table.";
}
static const char* impact() {
return "Medium: Depends on Java content.";
}
static const JavaPermission permission() {
JavaPermission p = {"java.lang.management.ManagementPermission",
"monitor", NULL};
return p;
}
static int num_arguments();
virtual void execute(DCmdSource source, TRAPS);
};
#endif // SHARE_VM_CLASSFILE_COMPACTHASHTABLE_HPP