Skip to content

Commit ff22353

Browse files
committed
8264565: Templatize num_arguments() functions of DCmd subclasses
Reviewed-by: coleenp, dholmes
1 parent 54b4070 commit ff22353

File tree

8 files changed

+36
-250
lines changed

8 files changed

+36
-250
lines changed

src/hotspot/share/classfile/stringTable.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -698,17 +698,6 @@ void StringtableDCmd::execute(DCmdSource source, TRAPS) {
698698
VMThread::execute(&dumper);
699699
}
700700

701-
int StringtableDCmd::num_arguments() {
702-
ResourceMark rm;
703-
StringtableDCmd* dcmd = new StringtableDCmd(NULL, false);
704-
if (dcmd != NULL) {
705-
DCmdMark mark(dcmd);
706-
return dcmd->_dcmdparser.num_arguments();
707-
} else {
708-
return 0;
709-
}
710-
}
711-
712701
// Sharing
713702
#if INCLUDE_CDS_JAVA_HEAP
714703
oop StringTable::lookup_shared(const jchar* name, int len, unsigned int hash) {

src/hotspot/share/classfile/symbolTable.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -881,14 +881,3 @@ void SymboltableDCmd::execute(DCmdSource source, TRAPS) {
881881
_verbose.value());
882882
VMThread::execute(&dumper);
883883
}
884-
885-
int SymboltableDCmd::num_arguments() {
886-
ResourceMark rm;
887-
SymboltableDCmd* dcmd = new SymboltableDCmd(NULL, false);
888-
if (dcmd != NULL) {
889-
DCmdMark mark(dcmd);
890-
return dcmd->_dcmdparser.num_arguments();
891-
} else {
892-
return 0;
893-
}
894-
}

src/hotspot/share/classfile/systemDictionary.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,14 +2526,3 @@ void SystemDictionaryDCmd::execute(DCmdSource source, TRAPS) {
25262526
_verbose.value());
25272527
VMThread::execute(&dumper);
25282528
}
2529-
2530-
int SystemDictionaryDCmd::num_arguments() {
2531-
ResourceMark rm;
2532-
SystemDictionaryDCmd* dcmd = new SystemDictionaryDCmd(NULL, false);
2533-
if (dcmd != NULL) {
2534-
DCmdMark mark(dcmd);
2535-
return dcmd->_dcmdparser.num_arguments();
2536-
} else {
2537-
return 0;
2538-
}
2539-
}

src/hotspot/share/services/diagnosticCommand.cpp

Lines changed: 0 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,6 @@ void HelpDCmd::execute(DCmdSource source, TRAPS) {
219219
}
220220
}
221221

222-
int HelpDCmd::num_arguments() {
223-
ResourceMark rm;
224-
HelpDCmd* dcmd = new HelpDCmd(NULL, false);
225-
if (dcmd != NULL) {
226-
DCmdMark mark(dcmd);
227-
return dcmd->_dcmdparser.num_arguments();
228-
} else {
229-
return 0;
230-
}
231-
}
232-
233222
void VersionDCmd::execute(DCmdSource source, TRAPS) {
234223
output()->print_cr("%s version %s", VM_Version::vm_name(),
235224
VM_Version::vm_release());
@@ -258,17 +247,6 @@ void PrintVMFlagsDCmd::execute(DCmdSource source, TRAPS) {
258247
}
259248
}
260249

261-
int PrintVMFlagsDCmd::num_arguments() {
262-
ResourceMark rm;
263-
PrintVMFlagsDCmd* dcmd = new PrintVMFlagsDCmd(NULL, false);
264-
if (dcmd != NULL) {
265-
DCmdMark mark(dcmd);
266-
return dcmd->_dcmdparser.num_arguments();
267-
} else {
268-
return 0;
269-
}
270-
}
271-
272250
SetVMFlagDCmd::SetVMFlagDCmd(outputStream* output, bool heap) :
273251
DCmdWithParser(output, heap),
274252
_flag("flag name", "The name of the flag we want to set",
@@ -292,17 +270,6 @@ void SetVMFlagDCmd::execute(DCmdSource source, TRAPS) {
292270
}
293271
}
294272

295-
int SetVMFlagDCmd::num_arguments() {
296-
ResourceMark rm;
297-
SetVMFlagDCmd* dcmd = new SetVMFlagDCmd(NULL, false);
298-
if (dcmd != NULL) {
299-
DCmdMark mark(dcmd);
300-
return dcmd->_dcmdparser.num_arguments();
301-
} else {
302-
return 0;
303-
}
304-
}
305-
306273
void JVMTIDataDumpDCmd::execute(DCmdSource source, TRAPS) {
307274
if (JvmtiExport::should_post_data_dump()) {
308275
JvmtiExport::post_data_dump();
@@ -360,16 +327,6 @@ void JVMTIAgentLoadDCmd::execute(DCmdSource source, TRAPS) {
360327
}
361328
}
362329

363-
int JVMTIAgentLoadDCmd::num_arguments() {
364-
ResourceMark rm;
365-
JVMTIAgentLoadDCmd* dcmd = new JVMTIAgentLoadDCmd(NULL, false);
366-
if (dcmd != NULL) {
367-
DCmdMark mark(dcmd);
368-
return dcmd->_dcmdparser.num_arguments();
369-
} else {
370-
return 0;
371-
}
372-
}
373330
#endif // INCLUDE_JVMTI
374331
#endif // INCLUDE_SERVICES
375332

@@ -432,17 +389,6 @@ void VMUptimeDCmd::execute(DCmdSource source, TRAPS) {
432389
output()->print_cr(" s");
433390
}
434391

435-
int VMUptimeDCmd::num_arguments() {
436-
ResourceMark rm;
437-
VMUptimeDCmd* dcmd = new VMUptimeDCmd(NULL, false);
438-
if (dcmd != NULL) {
439-
DCmdMark mark(dcmd);
440-
return dcmd->_dcmdparser.num_arguments();
441-
} else {
442-
return 0;
443-
}
444-
}
445-
446392
void VMInfoDCmd::execute(DCmdSource source, TRAPS) {
447393
VMError::print_vm_info(_output);
448394
}
@@ -544,17 +490,6 @@ void HeapDumpDCmd::execute(DCmdSource source, TRAPS) {
544490
dumper.dump(_filename.value(), output(), (int) level);
545491
}
546492

547-
int HeapDumpDCmd::num_arguments() {
548-
ResourceMark rm;
549-
HeapDumpDCmd* dcmd = new HeapDumpDCmd(NULL, false);
550-
if (dcmd != NULL) {
551-
DCmdMark mark(dcmd);
552-
return dcmd->_dcmdparser.num_arguments();
553-
} else {
554-
return 0;
555-
}
556-
}
557-
558493
ClassHistogramDCmd::ClassHistogramDCmd(outputStream* output, bool heap) :
559494
DCmdWithParser(output, heap),
560495
_all("-all", "Inspect all objects, including unreachable objects",
@@ -568,17 +503,6 @@ void ClassHistogramDCmd::execute(DCmdSource source, TRAPS) {
568503
VMThread::execute(&heapop);
569504
}
570505

571-
int ClassHistogramDCmd::num_arguments() {
572-
ResourceMark rm;
573-
ClassHistogramDCmd* dcmd = new ClassHistogramDCmd(NULL, false);
574-
if (dcmd != NULL) {
575-
DCmdMark mark(dcmd);
576-
return dcmd->_dcmdparser.num_arguments();
577-
} else {
578-
return 0;
579-
}
580-
}
581-
582506
#endif // INCLUDE_SERVICES
583507

584508
ThreadDumpDCmd::ThreadDumpDCmd(outputStream* output, bool heap) :
@@ -603,17 +527,6 @@ void ThreadDumpDCmd::execute(DCmdSource source, TRAPS) {
603527
VMThread::execute(&op3);
604528
}
605529

606-
int ThreadDumpDCmd::num_arguments() {
607-
ResourceMark rm;
608-
ThreadDumpDCmd* dcmd = new ThreadDumpDCmd(NULL, false);
609-
if (dcmd != NULL) {
610-
DCmdMark mark(dcmd);
611-
return dcmd->_dcmdparser.num_arguments();
612-
} else {
613-
return 0;
614-
}
615-
}
616-
617530
// Enhanced JMX Agent support
618531

619532
JMXStartRemoteDCmd::JMXStartRemoteDCmd(outputStream *output, bool heap_allocated) :
@@ -729,19 +642,6 @@ JMXStartRemoteDCmd::JMXStartRemoteDCmd(outputStream *output, bool heap_allocated
729642
_dcmdparser.add_dcmd_option(&_jdp_name);
730643
}
731644

732-
733-
int JMXStartRemoteDCmd::num_arguments() {
734-
ResourceMark rm;
735-
JMXStartRemoteDCmd* dcmd = new JMXStartRemoteDCmd(NULL, false);
736-
if (dcmd != NULL) {
737-
DCmdMark mark(dcmd);
738-
return dcmd->_dcmdparser.num_arguments();
739-
} else {
740-
return 0;
741-
}
742-
}
743-
744-
745645
void JMXStartRemoteDCmd::execute(DCmdSource source, TRAPS) {
746646
ResourceMark rm(THREAD);
747647
HandleMark hm(THREAD);
@@ -929,17 +829,6 @@ void CodeHeapAnalyticsDCmd::execute(DCmdSource source, TRAPS) {
929829

930830
CompileBroker::print_heapinfo(output(), _function.value(), granularity);
931831
}
932-
933-
int CodeHeapAnalyticsDCmd::num_arguments() {
934-
ResourceMark rm;
935-
CodeHeapAnalyticsDCmd* dcmd = new CodeHeapAnalyticsDCmd(NULL, false);
936-
if (dcmd != NULL) {
937-
DCmdMark mark(dcmd);
938-
return dcmd->_dcmdparser.num_arguments();
939-
} else {
940-
return 0;
941-
}
942-
}
943832
//---< END >--- CodeHeap State Analytics.
944833

945834
EventLogDCmd::EventLogDCmd(outputStream* output, bool heap) :
@@ -970,17 +859,6 @@ void EventLogDCmd::execute(DCmdSource source, TRAPS) {
970859
}
971860
}
972861

973-
int EventLogDCmd::num_arguments() {
974-
ResourceMark rm;
975-
EventLogDCmd* dcmd = new EventLogDCmd(NULL, false);
976-
if (dcmd != NULL) {
977-
DCmdMark mark(dcmd);
978-
return dcmd->_dcmdparser.num_arguments();
979-
} else {
980-
return 0;
981-
}
982-
}
983-
984862
void CompilerDirectivesPrintDCmd::execute(DCmdSource source, TRAPS) {
985863
DirectivesStack::print(output());
986864
}
@@ -995,17 +873,6 @@ void CompilerDirectivesAddDCmd::execute(DCmdSource source, TRAPS) {
995873
DirectivesParser::parse_from_file(_filename.value(), output());
996874
}
997875

998-
int CompilerDirectivesAddDCmd::num_arguments() {
999-
ResourceMark rm;
1000-
CompilerDirectivesAddDCmd* dcmd = new CompilerDirectivesAddDCmd(NULL, false);
1001-
if (dcmd != NULL) {
1002-
DCmdMark mark(dcmd);
1003-
return dcmd->_dcmdparser.num_arguments();
1004-
} else {
1005-
return 0;
1006-
}
1007-
}
1008-
1009876
void CompilerDirectivesRemoveDCmd::execute(DCmdSource source, TRAPS) {
1010877
DirectivesStack::pop(1);
1011878
}
@@ -1032,18 +899,6 @@ void ClassHierarchyDCmd::execute(DCmdSource source, TRAPS) {
1032899
_print_subclasses.value(), _classname.value());
1033900
VMThread::execute(&printClassHierarchyOp);
1034901
}
1035-
1036-
int ClassHierarchyDCmd::num_arguments() {
1037-
ResourceMark rm;
1038-
ClassHierarchyDCmd* dcmd = new ClassHierarchyDCmd(NULL, false);
1039-
if (dcmd != NULL) {
1040-
DCmdMark mark(dcmd);
1041-
return dcmd->_dcmdparser.num_arguments();
1042-
} else {
1043-
return 0;
1044-
}
1045-
}
1046-
1047902
#endif
1048903

1049904
class VM_DumpTouchedMethods : public VM_Operation {
@@ -1061,10 +916,6 @@ class VM_DumpTouchedMethods : public VM_Operation {
1061916
}
1062917
};
1063918

1064-
TouchedMethodsDCmd::TouchedMethodsDCmd(outputStream* output, bool heap) :
1065-
DCmdWithParser(output, heap)
1066-
{}
1067-
1068919
void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) {
1069920
if (!LogTouchedMethods) {
1070921
output()->print_cr("VM.print_touched_methods command requires -XX:+LogTouchedMethods");
@@ -1073,19 +924,11 @@ void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) {
1073924
VM_DumpTouchedMethods dumper(output());
1074925
VMThread::execute(&dumper);
1075926
}
1076-
1077-
int TouchedMethodsDCmd::num_arguments() {
1078-
return 0;
1079-
}
1080-
1081927
#if INCLUDE_JVMTI
1082928
extern "C" typedef char const* (JNICALL *debugInit_startDebuggingViaCommandPtr)(JNIEnv* env, jthread thread, char const** transport_name,
1083929
char const** address, jboolean* first_start);
1084930
static debugInit_startDebuggingViaCommandPtr dvc_start_ptr = NULL;
1085931

1086-
DebugOnCmdStartDCmd::DebugOnCmdStartDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap) {
1087-
}
1088-
1089932
void DebugOnCmdStartDCmd::execute(DCmdSource source, TRAPS) {
1090933
char const* transport = NULL;
1091934
char const* addr = NULL;

0 commit comments

Comments
 (0)