8199918: Shorten names of CollectedHeap::Name members

Reviewed-by: shade, eosterlund
This commit is contained in:
Per Lidén 2018-03-28 11:38:47 +02:00
parent fe3badf59a
commit 3b7962d614
18 changed files with 31 additions and 36 deletions

View File

@ -3708,7 +3708,7 @@ void MacroAssembler::g1_write_barrier_post(Register store_addr, Register new_val
// Called from init_globals() after universe_init() and before interpreter_init()
void g1_barrier_stubs_init() {
CollectedHeap* heap = Universe::heap();
if (heap->kind() == CollectedHeap::G1CollectedHeap) {
if (heap->kind() == CollectedHeap::G1) {
// Only needed for G1
if (dirty_card_log_enqueue == 0) {
G1BarrierSet* bs =

View File

@ -132,7 +132,7 @@ void CMSHeap::check_gen_kinds() {
CMSHeap* CMSHeap::heap() {
CollectedHeap* heap = Universe::heap();
assert(heap != NULL, "Uninitialized access to CMSHeap::heap()");
assert(heap->kind() == CollectedHeap::CMSHeap, "Not a CMSHeap");
assert(heap->kind() == CollectedHeap::CMS, "Invalid name");
return (CMSHeap*) heap;
}

View File

@ -57,7 +57,7 @@ public:
static CMSHeap* heap();
virtual Name kind() const {
return CollectedHeap::CMSHeap;
return CollectedHeap::CMS;
}
virtual const char* name() const {

View File

@ -2486,7 +2486,7 @@ void G1CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
G1CollectedHeap* G1CollectedHeap::heap() {
CollectedHeap* heap = Universe::heap();
assert(heap != NULL, "Uninitialized access to G1CollectedHeap::heap()");
assert(heap->kind() == CollectedHeap::G1CollectedHeap, "Not a G1CollectedHeap");
assert(heap->kind() == CollectedHeap::G1, "Invalid name");
return (G1CollectedHeap*)heap;
}

View File

@ -958,7 +958,7 @@ public:
void ref_processing_init();
virtual Name kind() const {
return CollectedHeap::G1CollectedHeap;
return CollectedHeap::G1;
}
virtual const char* name() const {

View File

@ -622,7 +622,7 @@ void ParallelScavengeHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_trac
ParallelScavengeHeap* ParallelScavengeHeap::heap() {
CollectedHeap* heap = Universe::heap();
assert(heap != NULL, "Uninitialized access to ParallelScavengeHeap::heap()");
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Not a ParallelScavengeHeap");
assert(heap->kind() == CollectedHeap::Parallel, "Invalid name");
return (ParallelScavengeHeap*)heap;
}

View File

@ -102,7 +102,7 @@ class ParallelScavengeHeap : public CollectedHeap {
};
virtual Name kind() const {
return CollectedHeap::ParallelScavengeHeap;
return CollectedHeap::Parallel;
}
virtual const char* name() const {

View File

@ -47,7 +47,7 @@ public:
SerialHeap(GenCollectorPolicy* policy);
virtual Name kind() const {
return CollectedHeap::SerialHeap;
return CollectedHeap::Serial;
}
virtual const char* name() const {

View File

@ -187,10 +187,10 @@ class CollectedHeap : public CHeapObj<mtInternal> {
public:
enum Name {
SerialHeap,
ParallelScavengeHeap,
G1CollectedHeap,
CMSHeap
Serial,
Parallel,
CMS,
G1
};
static inline size_t filler_array_max_size() {

View File

@ -1232,8 +1232,8 @@ void GenCollectedHeap::save_marks() {
GenCollectedHeap* GenCollectedHeap::heap() {
CollectedHeap* heap = Universe::heap();
assert(heap != NULL, "Uninitialized access to GenCollectedHeap::heap()");
assert(heap->kind() == CollectedHeap::SerialHeap ||
heap->kind() == CollectedHeap::CMSHeap, "Not a GenCollectedHeap");
assert(heap->kind() == CollectedHeap::Serial ||
heap->kind() == CollectedHeap::CMS, "Invalid name");
return (GenCollectedHeap*) heap;
}

View File

@ -2261,10 +2261,10 @@ typedef PaddedEnd<ObjectMonitor> PaddedObjectMonitor;
\
declare_constant(G1CardTable::g1_young_gen) \
\
declare_constant(CollectedHeap::SerialHeap) \
declare_constant(CollectedHeap::CMSHeap) \
declare_constant(CollectedHeap::ParallelScavengeHeap) \
declare_constant(CollectedHeap::G1CollectedHeap) \
declare_constant(CollectedHeap::Serial) \
declare_constant(CollectedHeap::Parallel) \
declare_constant(CollectedHeap::CMS) \
declare_constant(CollectedHeap::G1) \
\
/* constants from Generation::Name enum */ \
\

View File

@ -35,6 +35,6 @@ public class CMSHeap extends GenCollectedHeap {
}
public CollectedHeapName kind() {
return CollectedHeapName.CMS_HEAP;
return CollectedHeapName.CMS;
}
}

View File

@ -125,7 +125,7 @@ public class G1CollectedHeap extends CollectedHeap {
}
public CollectedHeapName kind() {
return CollectedHeapName.G1_COLLECTED_HEAP;
return CollectedHeapName.G1;
}
@Override

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -85,7 +85,7 @@ public class ParallelScavengeHeap extends CollectedHeap {
}
public CollectedHeapName kind() {
return CollectedHeapName.PARALLEL_SCAVENGE_HEAP;
return CollectedHeapName.PARALLEL;
}
public void printOn(PrintStream tty) {

View File

@ -35,6 +35,6 @@ public class SerialHeap extends GenCollectedHeap {
}
public CollectedHeapName kind() {
return CollectedHeapName.SERIAL_HEAP;
return CollectedHeapName.SERIAL;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, 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
@ -31,11 +31,10 @@ public class CollectedHeapName {
private CollectedHeapName(String name) { this.name = name; }
public static final CollectedHeapName GEN_COLLECTED_HEAP = new CollectedHeapName("GenCollectedHeap");
public static final CollectedHeapName CMS_HEAP = new CollectedHeapName("CMSHeap");
public static final CollectedHeapName SERIAL_HEAP = new CollectedHeapName("SerialHeap");
public static final CollectedHeapName G1_COLLECTED_HEAP = new CollectedHeapName("G1CollectedHeap");
public static final CollectedHeapName PARALLEL_SCAVENGE_HEAP = new CollectedHeapName("ParallelScavengeHeap");
public static final CollectedHeapName SERIAL = new CollectedHeapName("Serial");
public static final CollectedHeapName PARALLEL = new CollectedHeapName("Parallel");
public static final CollectedHeapName CMS = new CollectedHeapName("CMS");
public static final CollectedHeapName G1 = new CollectedHeapName("G1");
public String toString() {
return name;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, 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
@ -32,7 +32,7 @@ import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.types.*;
import sun.jvm.hotspot.utilities.*;
public class GenCollectedHeap extends CollectedHeap {
abstract public class GenCollectedHeap extends CollectedHeap {
private static AddressField youngGenField;
private static AddressField oldGenField;
@ -134,10 +134,6 @@ public class GenCollectedHeap extends CollectedHeap {
}
}
public CollectedHeapName kind() {
return CollectedHeapName.GEN_COLLECTED_HEAP;
}
public void printOn(PrintStream tty) {
for (int i = 0; i < nGens(); i++) {
tty.print("Gen " + i + ": ");

View File

@ -110,7 +110,7 @@ public class TestIntConstant {
// with names and the values derived from enums and #define preprocessor
// macros in hotspot.
String[] defaultOutputStrings =
{"CollectedHeap::G1CollectedHeap 2",
{"CollectedHeap::G1 3",
"RUNNABLE 2",
"Deoptimization::Reason_class_check 4",
"InstanceKlass::_misc_is_anonymous 32",