Skip to content

Commit

Permalink
8234274: [BACKOUT] JDK-8204128 NMT might report incorrect numbers for…
Browse files Browse the repository at this point in the history
… Compiler area

Reviewed-by: zgu
  • Loading branch information
Daniel D. Daugherty committed Nov 16, 2019
1 parent 5968ac4 commit e9e1948
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 104 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/memory/arena.cpp
Expand Up @@ -325,7 +325,7 @@ void Arena::destruct_contents() {
// change the size
void Arena::set_size_in_bytes(size_t size) {
if (_size_in_bytes != size) {
ssize_t delta = size - size_in_bytes();
long delta = (long)(size - size_in_bytes());
_size_in_bytes = size;
MemTracker::record_arena_size_change(delta, _flags);
}
Expand Down
18 changes: 0 additions & 18 deletions src/hotspot/share/prims/whitebox.cpp
Expand Up @@ -797,21 +797,6 @@ WB_ENTRY(jint, WB_NMTGetHashSize(JNIEnv* env, jobject o))
assert(hash_size > 0, "NMT hash_size should be > 0");
return (jint)hash_size;
WB_END

WB_ENTRY(jlong, WB_NMTNewArena(JNIEnv* env, jobject o, jlong init_size))
Arena* arena = new (mtTest) Arena(mtTest, size_t(init_size));
return (jlong)arena;
WB_END

WB_ENTRY(void, WB_NMTFreeArena(JNIEnv* env, jobject o, jlong arena))
Arena* a = (Arena*)arena;
delete a;
WB_END

WB_ENTRY(void, WB_NMTArenaMalloc(JNIEnv* env, jobject o, jlong arena, jlong size))
Arena* a = (Arena*)arena;
a->Amalloc(size_t(size));
WB_END
#endif // INCLUDE_NMT

static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
Expand Down Expand Up @@ -2259,9 +2244,6 @@ static JNINativeMethod methods[] = {
{CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory },
{CC"NMTChangeTrackingLevel", CC"()Z", (void*)&WB_NMTChangeTrackingLevel},
{CC"NMTGetHashSize", CC"()I", (void*)&WB_NMTGetHashSize },
{CC"NMTNewArena", CC"(J)J", (void*)&WB_NMTNewArena },
{CC"NMTFreeArena", CC"(J)V", (void*)&WB_NMTFreeArena },
{CC"NMTArenaMalloc", CC"(JJ)V", (void*)&WB_NMTArenaMalloc },
#endif // INCLUDE_NMT
{CC"deoptimizeFrames", CC"(Z)I", (void*)&WB_DeoptimizeFrames },
{CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll },
Expand Down
7 changes: 3 additions & 4 deletions src/hotspot/share/services/mallocTracker.hpp
Expand Up @@ -70,9 +70,8 @@ class MemoryCounter {
}
}

inline void resize(ssize_t sz) {
inline void resize(long sz) {
if (sz != 0) {
assert(sz >= 0 || _size >= size_t(-sz), "Must be");
Atomic::add(size_t(sz), &_size);
DEBUG_ONLY(_peak_size = MAX2(_size, _peak_size);)
}
Expand Down Expand Up @@ -114,7 +113,7 @@ class MallocMemory {
_arena.deallocate(0);
}

inline void record_arena_size_change(ssize_t sz) {
inline void record_arena_size_change(long sz) {
_arena.resize(sz);
}

Expand Down Expand Up @@ -362,7 +361,7 @@ class MallocTracker : AllStatic {
MallocMemorySummary::record_arena_free(flags);
}

static inline void record_arena_size_change(ssize_t size, MEMFLAGS flags) {
static inline void record_arena_size_change(int size, MEMFLAGS flags) {
MallocMemorySummary::record_arena_size_change(size, flags);
}
private:
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/services/memTracker.hpp
Expand Up @@ -63,7 +63,7 @@ class MemTracker : AllStatic {

static inline void record_new_arena(MEMFLAGS flag) { }
static inline void record_arena_free(MEMFLAGS flag) { }
static inline void record_arena_size_change(ssize_t diff, MEMFLAGS flag) { }
static inline void record_arena_size_change(int diff, MEMFLAGS flag) { }
static inline void record_virtual_memory_reserve(void* addr, size_t size, const NativeCallStack& stack,
MEMFLAGS flag = mtNone) { }
static inline void record_virtual_memory_reserve_and_commit(void* addr, size_t size,
Expand Down Expand Up @@ -203,7 +203,7 @@ class MemTracker : AllStatic {

// Record arena size change. Arena size is the size of all arena
// chuncks that backing up the arena.
static inline void record_arena_size_change(ssize_t diff, MEMFLAGS flag) {
static inline void record_arena_size_change(int diff, MEMFLAGS flag) {
if (tracking_level() < NMT_summary) return;
MallocTracker::record_arena_size_change(diff, flag);
}
Expand Down
1 change: 0 additions & 1 deletion test/hotspot/jtreg/ProblemList.txt
Expand Up @@ -90,7 +90,6 @@ gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java 8193639 solaris-all
# :hotspot_runtime

runtime/jni/terminatedThread/TestTerminatedThread.java 8219652 aix-ppc64
runtime/nmt/HugeArenaTracking.java 8234270 windows-x64
runtime/ReservedStack/ReservedStackTest.java 8231031 generic-all

#############################################################################
Expand Down
75 changes: 0 additions & 75 deletions test/hotspot/jtreg/runtime/NMT/HugeArenaTracking.java

This file was deleted.

3 changes: 0 additions & 3 deletions test/lib/sun/hotspot/WhiteBox.java
Expand Up @@ -222,9 +222,6 @@ public Object[] parseCommandLine(String commandline, char delim, Dia
public native long NMTMallocWithPseudoStackAndType(long size, int index, int type);
public native boolean NMTChangeTrackingLevel();
public native int NMTGetHashSize();
public native long NMTNewArena(long initSize);
public native void NMTFreeArena(long arena);
public native void NMTArenaMalloc(long arena, long size);

// Compiler
public native int matchesMethod(Executable method, String pattern);
Expand Down

0 comments on commit e9e1948

Please sign in to comment.