Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
b61520b3
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b61520b3
编写于
6月 27, 2013
作者:
E
ehelin
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
ce187425
22f308c4
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
310 addition
and
27 deletion
+310
-27
make/linux/makefiles/vm.make
make/linux/makefiles/vm.make
+4
-0
make/solaris/makefiles/vm.make
make/solaris/makefiles/vm.make
+4
-0
src/os/solaris/vm/os_solaris.inline.hpp
src/os/solaris/vm/os_solaris.inline.hpp
+3
-3
src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp
...hare/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp
+11
-0
src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp
...hare/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp
+2
-0
src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp
src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp
+1
-1
src/share/vm/memory/metaspace.cpp
src/share/vm/memory/metaspace.cpp
+2
-14
src/share/vm/memory/universe.cpp
src/share/vm/memory/universe.cpp
+1
-0
src/share/vm/services/management.cpp
src/share/vm/services/management.cpp
+0
-6
src/share/vm/services/memoryManager.cpp
src/share/vm/services/memoryManager.cpp
+4
-0
src/share/vm/services/memoryManager.hpp
src/share/vm/services/memoryManager.hpp
+10
-0
src/share/vm/services/memoryPool.cpp
src/share/vm/services/memoryPool.cpp
+38
-0
src/share/vm/services/memoryPool.hpp
src/share/vm/services/memoryPool.hpp
+17
-0
src/share/vm/services/memoryService.cpp
src/share/vm/services/memoryService.cpp
+22
-3
src/share/vm/services/memoryService.hpp
src/share/vm/services/memoryService.hpp
+4
-0
test/gc/metaspace/TestMetaspaceMemoryPool.java
test/gc/metaspace/TestMetaspaceMemoryPool.java
+126
-0
test/gc/parallelScavenge/AdaptiveGCBoundary.java
test/gc/parallelScavenge/AdaptiveGCBoundary.java
+61
-0
未找到文件。
make/linux/makefiles/vm.make
浏览文件 @
b61520b3
...
@@ -107,6 +107,10 @@ CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
...
@@ -107,6 +107,10 @@ CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
# File specific flags
# File specific flags
CXXFLAGS
+=
$
(
CXXFLAGS/BYFILE
)
CXXFLAGS
+=
$
(
CXXFLAGS/BYFILE
)
# Large File Support
ifneq
($(LP64), 1)
CXXFLAGS/
ostream.o
+=
-D_FILE_OFFSET_BITS
=
64
endif
# ifneq ($(LP64), 1)
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
CFLAGS
+=
$
(
CFLAGS_WARN/BYFILE
)
CFLAGS
+=
$
(
CFLAGS_WARN/BYFILE
)
...
...
make/solaris/makefiles/vm.make
浏览文件 @
b61520b3
...
@@ -95,6 +95,10 @@ CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
...
@@ -95,6 +95,10 @@ CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
# File specific flags
# File specific flags
CXXFLAGS
+=
$
(
CXXFLAGS/BYFILE
)
CXXFLAGS
+=
$
(
CXXFLAGS/BYFILE
)
# Large File Support
ifneq
($(LP64), 1)
CXXFLAGS/
ostream.o
+=
-D_FILE_OFFSET_BITS
=
64
endif
# ifneq ($(LP64), 1)
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
CFLAGS
+=
$(CFLAGS_WARN)
CFLAGS
+=
$(CFLAGS_WARN)
...
...
src/os/solaris/vm/os_solaris.inline.hpp
浏览文件 @
b61520b3
...
@@ -89,7 +89,7 @@ inline int os::readdir_buf_size(const char *path) {
...
@@ -89,7 +89,7 @@ inline int os::readdir_buf_size(const char *path) {
inline
struct
dirent
*
os
::
readdir
(
DIR
*
dirp
,
dirent
*
dbuf
)
{
inline
struct
dirent
*
os
::
readdir
(
DIR
*
dirp
,
dirent
*
dbuf
)
{
assert
(
dirp
!=
NULL
,
"just checking"
);
assert
(
dirp
!=
NULL
,
"just checking"
);
#if defined(_LP64) || defined(_GNU_SOURCE)
#if defined(_LP64) || defined(_GNU_SOURCE)
|| _FILE_OFFSET_BITS==64
dirent
*
p
;
dirent
*
p
;
int
status
;
int
status
;
...
@@ -98,9 +98,9 @@ inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf) {
...
@@ -98,9 +98,9 @@ inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf) {
return
NULL
;
return
NULL
;
}
else
}
else
return
p
;
return
p
;
#else // defined(_LP64) || defined(_GNU_SOURCE)
#else // defined(_LP64) || defined(_GNU_SOURCE)
|| _FILE_OFFSET_BITS==64
return
::
readdir_r
(
dirp
,
dbuf
);
return
::
readdir_r
(
dirp
,
dbuf
);
#endif // defined(_LP64) || defined(_GNU_SOURCE)
#endif // defined(_LP64) || defined(_GNU_SOURCE)
|| _FILE_OFFSET_BITS==64
}
}
inline
int
os
::
closedir
(
DIR
*
dirp
)
{
inline
int
os
::
closedir
(
DIR
*
dirp
)
{
...
...
src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp
浏览文件 @
b61520b3
...
@@ -70,6 +70,17 @@ ASPSOldGen::ASPSOldGen(PSVirtualSpace* vs,
...
@@ -70,6 +70,17 @@ ASPSOldGen::ASPSOldGen(PSVirtualSpace* vs,
_virtual_space
=
vs
;
_virtual_space
=
vs
;
}
}
void
ASPSOldGen
::
initialize_work
(
const
char
*
perf_data_name
,
int
level
)
{
PSOldGen
::
initialize_work
(
perf_data_name
,
level
);
// The old gen can grow to gen_size_limit(). _reserve reflects only
// the current maximum that can be committed.
assert
(
_reserved
.
byte_size
()
<=
gen_size_limit
(),
"Consistency check"
);
initialize_performance_counters
(
perf_data_name
,
level
);
}
void
ASPSOldGen
::
reset_after_change
()
{
void
ASPSOldGen
::
reset_after_change
()
{
_reserved
=
MemRegion
((
HeapWord
*
)
virtual_space
()
->
low_boundary
(),
_reserved
=
MemRegion
((
HeapWord
*
)
virtual_space
()
->
low_boundary
(),
(
HeapWord
*
)
virtual_space
()
->
high_boundary
());
(
HeapWord
*
)
virtual_space
()
->
high_boundary
());
...
...
src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp
浏览文件 @
b61520b3
...
@@ -50,6 +50,8 @@ class ASPSOldGen : public PSOldGen {
...
@@ -50,6 +50,8 @@ class ASPSOldGen : public PSOldGen {
size_t
max_gen_size
()
{
return
_reserved
.
byte_size
();
}
size_t
max_gen_size
()
{
return
_reserved
.
byte_size
();
}
void
set_gen_size_limit
(
size_t
v
)
{
_gen_size_limit
=
v
;
}
void
set_gen_size_limit
(
size_t
v
)
{
_gen_size_limit
=
v
;
}
virtual
void
initialize_work
(
const
char
*
perf_data_name
,
int
level
);
// After a shrink or expand reset the generation
// After a shrink or expand reset the generation
void
reset_after_change
();
void
reset_after_change
();
...
...
src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp
浏览文件 @
b61520b3
...
@@ -110,7 +110,7 @@ class PSOldGen : public CHeapObj<mtGC> {
...
@@ -110,7 +110,7 @@ class PSOldGen : public CHeapObj<mtGC> {
virtual
void
initialize
(
ReservedSpace
rs
,
size_t
alignment
,
virtual
void
initialize
(
ReservedSpace
rs
,
size_t
alignment
,
const
char
*
perf_data_name
,
int
level
);
const
char
*
perf_data_name
,
int
level
);
void
initialize_virtual_space
(
ReservedSpace
rs
,
size_t
alignment
);
void
initialize_virtual_space
(
ReservedSpace
rs
,
size_t
alignment
);
void
initialize_work
(
const
char
*
perf_data_name
,
int
level
);
v
irtual
v
oid
initialize_work
(
const
char
*
perf_data_name
,
int
level
);
virtual
void
initialize_performance_counters
(
const
char
*
perf_data_name
,
int
level
);
virtual
void
initialize_performance_counters
(
const
char
*
perf_data_name
,
int
level
);
MemRegion
reserved
()
const
{
return
_reserved
;
}
MemRegion
reserved
()
const
{
return
_reserved
;
}
...
...
src/share/vm/memory/metaspace.cpp
浏览文件 @
b61520b3
...
@@ -1556,19 +1556,7 @@ bool Metadebug::test_metadata_failure() {
...
@@ -1556,19 +1556,7 @@ bool Metadebug::test_metadata_failure() {
// ChunkManager methods
// ChunkManager methods
// Verification of _free_chunks_total and _free_chunks_count does not
// work with the CMS collector because its use of additional locks
// complicate the mutex deadlock detection but it can still be useful
// for detecting errors in the chunk accounting with other collectors.
size_t
ChunkManager
::
free_chunks_total
()
{
size_t
ChunkManager
::
free_chunks_total
()
{
#ifdef ASSERT
if
(
!
UseConcMarkSweepGC
&&
!
SpaceManager
::
expand_lock
()
->
is_locked
())
{
MutexLockerEx
cl
(
SpaceManager
::
expand_lock
(),
Mutex
::
_no_safepoint_check_flag
);
slow_locked_verify_free_chunks_total
();
}
#endif
return
_free_chunks_total
;
return
_free_chunks_total
;
}
}
...
@@ -2608,14 +2596,14 @@ void MetaspaceAux::print_metaspace_change(size_t prev_metadata_used) {
...
@@ -2608,14 +2596,14 @@ void MetaspaceAux::print_metaspace_change(size_t prev_metadata_used) {
"->"
SIZE_FORMAT
"->"
SIZE_FORMAT
"("
SIZE_FORMAT
")"
,
"("
SIZE_FORMAT
")"
,
prev_metadata_used
,
prev_metadata_used
,
allocated_
capacity
_bytes
(),
allocated_
used
_bytes
(),
reserved_in_bytes
());
reserved_in_bytes
());
}
else
{
}
else
{
gclog_or_tty
->
print
(
" "
SIZE_FORMAT
"K"
gclog_or_tty
->
print
(
" "
SIZE_FORMAT
"K"
"->"
SIZE_FORMAT
"K"
"->"
SIZE_FORMAT
"K"
"("
SIZE_FORMAT
"K)"
,
"("
SIZE_FORMAT
"K)"
,
prev_metadata_used
/
K
,
prev_metadata_used
/
K
,
allocated_
capacity
_bytes
()
/
K
,
allocated_
used
_bytes
()
/
K
,
reserved_in_bytes
()
/
K
);
reserved_in_bytes
()
/
K
);
}
}
...
...
src/share/vm/memory/universe.cpp
浏览文件 @
b61520b3
...
@@ -1127,6 +1127,7 @@ bool universe_post_init() {
...
@@ -1127,6 +1127,7 @@ bool universe_post_init() {
// Initialize performance counters for metaspaces
// Initialize performance counters for metaspaces
MetaspaceCounters
::
initialize_performance_counters
();
MetaspaceCounters
::
initialize_performance_counters
();
MemoryService
::
add_metaspace_memory_pools
();
GC_locker
::
unlock
();
// allow gc after bootstrapping
GC_locker
::
unlock
();
// allow gc after bootstrapping
...
...
src/share/vm/services/management.cpp
浏览文件 @
b61520b3
...
@@ -894,12 +894,6 @@ JVM_ENTRY(jobject, jmm_GetMemoryUsage(JNIEnv* env, jboolean heap))
...
@@ -894,12 +894,6 @@ JVM_ENTRY(jobject, jmm_GetMemoryUsage(JNIEnv* env, jboolean heap))
}
}
}
}
// In our current implementation, we make sure that all non-heap
// pools have defined init and max sizes. Heap pools do not matter,
// as we never use total_init and total_max for them.
assert
(
heap
||
!
has_undefined_init_size
,
"Undefined init size"
);
assert
(
heap
||
!
has_undefined_max_size
,
"Undefined max size"
);
MemoryUsage
usage
((
heap
?
InitialHeapSize
:
total_init
),
MemoryUsage
usage
((
heap
?
InitialHeapSize
:
total_init
),
total_used
,
total_used
,
total_committed
,
total_committed
,
...
...
src/share/vm/services/memoryManager.cpp
浏览文件 @
b61520b3
...
@@ -61,6 +61,10 @@ MemoryManager* MemoryManager::get_code_cache_memory_manager() {
...
@@ -61,6 +61,10 @@ MemoryManager* MemoryManager::get_code_cache_memory_manager() {
return
(
MemoryManager
*
)
new
CodeCacheMemoryManager
();
return
(
MemoryManager
*
)
new
CodeCacheMemoryManager
();
}
}
MemoryManager
*
MemoryManager
::
get_metaspace_memory_manager
()
{
return
(
MemoryManager
*
)
new
MetaspaceMemoryManager
();
}
GCMemoryManager
*
MemoryManager
::
get_copy_memory_manager
()
{
GCMemoryManager
*
MemoryManager
::
get_copy_memory_manager
()
{
return
(
GCMemoryManager
*
)
new
CopyMemoryManager
();
return
(
GCMemoryManager
*
)
new
CopyMemoryManager
();
}
}
...
...
src/share/vm/services/memoryManager.hpp
浏览文件 @
b61520b3
...
@@ -56,6 +56,7 @@ public:
...
@@ -56,6 +56,7 @@ public:
enum
Name
{
enum
Name
{
Abstract
,
Abstract
,
CodeCache
,
CodeCache
,
Metaspace
,
Copy
,
Copy
,
MarkSweepCompact
,
MarkSweepCompact
,
ParNew
,
ParNew
,
...
@@ -88,6 +89,7 @@ public:
...
@@ -88,6 +89,7 @@ public:
// Static factory methods to get a memory manager of a specific type
// Static factory methods to get a memory manager of a specific type
static
MemoryManager
*
get_code_cache_memory_manager
();
static
MemoryManager
*
get_code_cache_memory_manager
();
static
MemoryManager
*
get_metaspace_memory_manager
();
static
GCMemoryManager
*
get_copy_memory_manager
();
static
GCMemoryManager
*
get_copy_memory_manager
();
static
GCMemoryManager
*
get_msc_memory_manager
();
static
GCMemoryManager
*
get_msc_memory_manager
();
static
GCMemoryManager
*
get_parnew_memory_manager
();
static
GCMemoryManager
*
get_parnew_memory_manager
();
...
@@ -108,6 +110,14 @@ public:
...
@@ -108,6 +110,14 @@ public:
const
char
*
name
()
{
return
"CodeCacheManager"
;
}
const
char
*
name
()
{
return
"CodeCacheManager"
;
}
};
};
class
MetaspaceMemoryManager
:
public
MemoryManager
{
public:
MetaspaceMemoryManager
()
:
MemoryManager
()
{}
MemoryManager
::
Name
kind
()
{
return
MemoryManager
::
Metaspace
;
}
const
char
*
name
()
{
return
"Metaspace Manager"
;
}
};
class
GCStatInfo
:
public
ResourceObj
{
class
GCStatInfo
:
public
ResourceObj
{
private:
private:
size_t
_index
;
size_t
_index
;
...
...
src/share/vm/services/memoryPool.cpp
浏览文件 @
b61520b3
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "classfile/vmSymbols.hpp"
#include "memory/metaspace.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/javaCalls.hpp"
...
@@ -33,6 +34,7 @@
...
@@ -33,6 +34,7 @@
#include "services/memoryManager.hpp"
#include "services/memoryManager.hpp"
#include "services/memoryPool.hpp"
#include "services/memoryPool.hpp"
#include "utilities/macros.hpp"
#include "utilities/macros.hpp"
#include "utilities/globalDefinitions.hpp"
MemoryPool
::
MemoryPool
(
const
char
*
name
,
MemoryPool
::
MemoryPool
(
const
char
*
name
,
PoolType
type
,
PoolType
type
,
...
@@ -256,3 +258,39 @@ MemoryUsage CodeHeapPool::get_memory_usage() {
...
@@ -256,3 +258,39 @@ MemoryUsage CodeHeapPool::get_memory_usage() {
return
MemoryUsage
(
initial_size
(),
used
,
committed
,
maxSize
);
return
MemoryUsage
(
initial_size
(),
used
,
committed
,
maxSize
);
}
}
MetaspacePool
::
MetaspacePool
()
:
MemoryPool
(
"Metaspace"
,
NonHeap
,
capacity_in_bytes
(),
calculate_max_size
(),
true
,
false
)
{
}
MemoryUsage
MetaspacePool
::
get_memory_usage
()
{
size_t
committed
=
align_size_down_
(
capacity_in_bytes
(),
os
::
vm_page_size
());
return
MemoryUsage
(
initial_size
(),
used_in_bytes
(),
committed
,
max_size
());
}
size_t
MetaspacePool
::
used_in_bytes
()
{
return
MetaspaceAux
::
allocated_used_bytes
(
Metaspace
::
NonClassType
);
}
size_t
MetaspacePool
::
capacity_in_bytes
()
const
{
return
MetaspaceAux
::
allocated_capacity_bytes
(
Metaspace
::
NonClassType
);
}
size_t
MetaspacePool
::
calculate_max_size
()
const
{
return
FLAG_IS_CMDLINE
(
MaxMetaspaceSize
)
?
MaxMetaspaceSize
:
max_uintx
;
}
CompressedKlassSpacePool
::
CompressedKlassSpacePool
()
:
MemoryPool
(
"Compressed Class Space"
,
NonHeap
,
capacity_in_bytes
(),
ClassMetaspaceSize
,
true
,
false
)
{
}
size_t
CompressedKlassSpacePool
::
used_in_bytes
()
{
return
MetaspaceAux
::
allocated_used_bytes
(
Metaspace
::
ClassType
);
}
size_t
CompressedKlassSpacePool
::
capacity_in_bytes
()
const
{
return
MetaspaceAux
::
allocated_capacity_bytes
(
Metaspace
::
ClassType
);
}
MemoryUsage
CompressedKlassSpacePool
::
get_memory_usage
()
{
size_t
committed
=
align_size_down_
(
capacity_in_bytes
(),
os
::
vm_page_size
());
return
MemoryUsage
(
initial_size
(),
used_in_bytes
(),
committed
,
max_size
());
}
src/share/vm/services/memoryPool.hpp
浏览文件 @
b61520b3
...
@@ -222,4 +222,21 @@ public:
...
@@ -222,4 +222,21 @@ public:
size_t
used_in_bytes
()
{
return
_codeHeap
->
allocated_capacity
();
}
size_t
used_in_bytes
()
{
return
_codeHeap
->
allocated_capacity
();
}
};
};
class
MetaspacePool
:
public
MemoryPool
{
size_t
calculate_max_size
()
const
;
size_t
capacity_in_bytes
()
const
;
public:
MetaspacePool
();
MemoryUsage
get_memory_usage
();
size_t
used_in_bytes
();
};
class
CompressedKlassSpacePool
:
public
MemoryPool
{
size_t
capacity_in_bytes
()
const
;
public:
CompressedKlassSpacePool
();
MemoryUsage
get_memory_usage
();
size_t
used_in_bytes
();
};
#endif // SHARE_VM_SERVICES_MEMORYPOOL_HPP
#endif // SHARE_VM_SERVICES_MEMORYPOOL_HPP
src/share/vm/services/memoryService.cpp
浏览文件 @
b61520b3
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include "memory/memRegion.hpp"
#include "memory/memRegion.hpp"
#include "memory/tenuredGeneration.hpp"
#include "memory/tenuredGeneration.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/globals.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/javaCalls.hpp"
#include "services/classLoadingService.hpp"
#include "services/classLoadingService.hpp"
#include "services/lowMemoryDetector.hpp"
#include "services/lowMemoryDetector.hpp"
...
@@ -60,9 +61,11 @@ GrowableArray<MemoryPool*>* MemoryService::_pools_list =
...
@@ -60,9 +61,11 @@ GrowableArray<MemoryPool*>* MemoryService::_pools_list =
GrowableArray
<
MemoryManager
*>*
MemoryService
::
_managers_list
=
GrowableArray
<
MemoryManager
*>*
MemoryService
::
_managers_list
=
new
(
ResourceObj
::
C_HEAP
,
mtInternal
)
GrowableArray
<
MemoryManager
*>
(
init_managers_list_size
,
true
);
new
(
ResourceObj
::
C_HEAP
,
mtInternal
)
GrowableArray
<
MemoryManager
*>
(
init_managers_list_size
,
true
);
GCMemoryManager
*
MemoryService
::
_minor_gc_manager
=
NULL
;
GCMemoryManager
*
MemoryService
::
_minor_gc_manager
=
NULL
;
GCMemoryManager
*
MemoryService
::
_major_gc_manager
=
NULL
;
GCMemoryManager
*
MemoryService
::
_major_gc_manager
=
NULL
;
MemoryPool
*
MemoryService
::
_code_heap_pool
=
NULL
;
MemoryPool
*
MemoryService
::
_code_heap_pool
=
NULL
;
MemoryPool
*
MemoryService
::
_metaspace_pool
=
NULL
;
MemoryPool
*
MemoryService
::
_compressed_class_pool
=
NULL
;
class
GcThreadCountClosure
:
public
ThreadClosure
{
class
GcThreadCountClosure
:
public
ThreadClosure
{
private:
private:
...
@@ -399,6 +402,22 @@ void MemoryService::add_code_heap_memory_pool(CodeHeap* heap) {
...
@@ -399,6 +402,22 @@ void MemoryService::add_code_heap_memory_pool(CodeHeap* heap) {
_managers_list
->
append
(
mgr
);
_managers_list
->
append
(
mgr
);
}
}
void
MemoryService
::
add_metaspace_memory_pools
()
{
MemoryManager
*
mgr
=
MemoryManager
::
get_metaspace_memory_manager
();
_metaspace_pool
=
new
MetaspacePool
();
mgr
->
add_pool
(
_metaspace_pool
);
_pools_list
->
append
(
_metaspace_pool
);
if
(
UseCompressedKlassPointers
)
{
_compressed_class_pool
=
new
CompressedKlassSpacePool
();
mgr
->
add_pool
(
_compressed_class_pool
);
_pools_list
->
append
(
_compressed_class_pool
);
}
_managers_list
->
append
(
mgr
);
}
MemoryManager
*
MemoryService
::
get_memory_manager
(
instanceHandle
mh
)
{
MemoryManager
*
MemoryService
::
get_memory_manager
(
instanceHandle
mh
)
{
for
(
int
i
=
0
;
i
<
_managers_list
->
length
();
i
++
)
{
for
(
int
i
=
0
;
i
<
_managers_list
->
length
();
i
++
)
{
MemoryManager
*
mgr
=
_managers_list
->
at
(
i
);
MemoryManager
*
mgr
=
_managers_list
->
at
(
i
);
...
...
src/share/vm/services/memoryService.hpp
浏览文件 @
b61520b3
...
@@ -73,6 +73,9 @@ private:
...
@@ -73,6 +73,9 @@ private:
// Code heap memory pool
// Code heap memory pool
static
MemoryPool
*
_code_heap_pool
;
static
MemoryPool
*
_code_heap_pool
;
static
MemoryPool
*
_metaspace_pool
;
static
MemoryPool
*
_compressed_class_pool
;
static
void
add_generation_memory_pool
(
Generation
*
gen
,
static
void
add_generation_memory_pool
(
Generation
*
gen
,
MemoryManager
*
major_mgr
,
MemoryManager
*
major_mgr
,
MemoryManager
*
minor_mgr
);
MemoryManager
*
minor_mgr
);
...
@@ -121,6 +124,7 @@ private:
...
@@ -121,6 +124,7 @@ private:
public:
public:
static
void
set_universe_heap
(
CollectedHeap
*
heap
);
static
void
set_universe_heap
(
CollectedHeap
*
heap
);
static
void
add_code_heap_memory_pool
(
CodeHeap
*
heap
);
static
void
add_code_heap_memory_pool
(
CodeHeap
*
heap
);
static
void
add_metaspace_memory_pools
();
static
MemoryPool
*
get_memory_pool
(
instanceHandle
pool
);
static
MemoryPool
*
get_memory_pool
(
instanceHandle
pool
);
static
MemoryManager
*
get_memory_manager
(
instanceHandle
mgr
);
static
MemoryManager
*
get_memory_manager
(
instanceHandle
mgr
);
...
...
test/gc/metaspace/TestMetaspaceMemoryPool.java
0 → 100644
浏览文件 @
b61520b3
/*
* Copyright (c) 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.util.List
;
import
java.lang.management.ManagementFactory
;
import
java.lang.management.MemoryManagerMXBean
;
import
java.lang.management.MemoryPoolMXBean
;
import
java.lang.management.MemoryUsage
;
import
java.lang.management.RuntimeMXBean
;
import
java.lang.management.ManagementFactory
;
/* @test TestMetaspaceMemoryPool
* @bug 8000754
* @summary Tests that a MemoryPoolMXBeans is created for metaspace and that a
* MemoryManagerMXBean is created.
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops TestMetaspaceMemoryPool
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:MaxMetaspaceSize=60m TestMetaspaceMemoryPool
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedKlassPointers TestMetaspaceMemoryPool
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedKlassPointers -XX:ClassMetaspaceSize=60m TestMetaspaceMemoryPool
*/
public
class
TestMetaspaceMemoryPool
{
public
static
void
main
(
String
[]
args
)
{
verifyThatMetaspaceMemoryManagerExists
();
verifyMemoryPool
(
getMemoryPool
(
"Metaspace"
),
isFlagDefined
(
"MaxMetaspaceSize"
));
if
(
runsOn64bit
())
{
if
(
usesCompressedOops
())
{
MemoryPoolMXBean
cksPool
=
getMemoryPool
(
"Compressed Class Space"
);
verifyMemoryPool
(
cksPool
,
true
);
}
}
}
private
static
boolean
runsOn64bit
()
{
return
!
System
.
getProperty
(
"sun.arch.data.model"
).
equals
(
"32"
);
}
private
static
boolean
usesCompressedOops
()
{
return
isFlagDefined
(
"+UseCompressedOops"
);
}
private
static
boolean
isFlagDefined
(
String
name
)
{
RuntimeMXBean
runtimeMxBean
=
ManagementFactory
.
getRuntimeMXBean
();
List
<
String
>
args
=
runtimeMxBean
.
getInputArguments
();
for
(
String
arg
:
args
)
{
if
(
arg
.
startsWith
(
"-XX:"
+
name
))
{
return
true
;
}
}
return
false
;
}
private
static
void
verifyThatMetaspaceMemoryManagerExists
()
{
List
<
MemoryManagerMXBean
>
managers
=
ManagementFactory
.
getMemoryManagerMXBeans
();
for
(
MemoryManagerMXBean
manager
:
managers
)
{
if
(
manager
.
getName
().
equals
(
"Metaspace Manager"
))
{
return
;
}
}
throw
new
RuntimeException
(
"Expected to find a metaspace memory manager"
);
}
private
static
MemoryPoolMXBean
getMemoryPool
(
String
name
)
{
List
<
MemoryPoolMXBean
>
pools
=
ManagementFactory
.
getMemoryPoolMXBeans
();
for
(
MemoryPoolMXBean
pool
:
pools
)
{
if
(
pool
.
getName
().
equals
(
name
))
{
return
pool
;
}
}
throw
new
RuntimeException
(
"Expected to find a memory pool with name "
+
name
);
}
private
static
void
verifyMemoryPool
(
MemoryPoolMXBean
pool
,
boolean
isMaxDefined
)
{
MemoryUsage
mu
=
pool
.
getUsage
();
assertDefined
(
mu
.
getInit
(),
"init"
);
assertDefined
(
mu
.
getUsed
(),
"used"
);
assertDefined
(
mu
.
getCommitted
(),
"committed"
);
if
(
isMaxDefined
)
{
assertDefined
(
mu
.
getMax
(),
"max"
);
}
else
{
assertUndefined
(
mu
.
getMax
(),
"max"
);
}
}
private
static
void
assertDefined
(
long
value
,
String
name
)
{
assertTrue
(
value
!=
-
1
,
"Expected "
+
name
+
" to be defined"
);
}
private
static
void
assertUndefined
(
long
value
,
String
name
)
{
assertEquals
(
value
,
-
1
,
"Expected "
+
name
+
" to be undefined"
);
}
private
static
void
assertEquals
(
long
actual
,
long
expected
,
String
msg
)
{
assertTrue
(
actual
==
expected
,
msg
);
}
private
static
void
assertTrue
(
boolean
condition
,
String
msg
)
{
if
(!
condition
)
{
throw
new
RuntimeException
(
msg
);
}
}
}
test/gc/parallelScavenge/AdaptiveGCBoundary.java
0 → 100644
浏览文件 @
b61520b3
/*
* Copyright (c) 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test AdaptiveGCBoundary
* @summary UseAdaptiveGCBoundary is broken
* @bug 8014546
* @key gc
* @key regression
* @library /testlibrary
* @run main/othervm AdaptiveGCBoundary
* @author jon.masamitsu@oracle.com
*/
import
com.oracle.java.testlibrary.*
;
public
class
AdaptiveGCBoundary
{
public
static
void
main
(
String
args
[])
throws
Exception
{
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-showversion"
,
"-XX:+UseParallelGC"
,
"-XX:+UseAdaptiveGCBoundary"
,
"-XX:+PrintCommandLineFlags"
,
SystemGCCaller
.
class
.
getName
()
);
OutputAnalyzer
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldContain
(
"+UseAdaptiveGCBoundary"
);
output
.
shouldNotContain
(
"error"
);
output
.
shouldHaveExitValue
(
0
);
}
static
class
SystemGCCaller
{
public
static
void
main
(
String
[]
args
)
{
System
.
gc
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录