Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
8af2050f
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看板
提交
8af2050f
编写于
3月 04, 2016
作者:
A
aeriksso
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8129419: heapDumper.cpp: assert(length_in_bytes > 0) failed: nothing to copy
Reviewed-by: dsamersoff, dcubed
上级
3d7376d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
61 addition
and
60 deletion
+61
-60
src/os/solaris/vm/os_solaris.cpp
src/os/solaris/vm/os_solaris.cpp
+8
-1
src/share/vm/services/heapDumper.cpp
src/share/vm/services/heapDumper.cpp
+53
-59
未找到文件。
src/os/solaris/vm/os_solaris.cpp
浏览文件 @
8af2050f
...
...
@@ -6248,7 +6248,14 @@ bool os::is_headless_jre() {
}
size_t
os
::
write
(
int
fd
,
const
void
*
buf
,
unsigned
int
nBytes
)
{
INTERRUPTIBLE_RETURN_INT
(
::
write
(
fd
,
buf
,
nBytes
),
os
::
Solaris
::
clear_interrupted
);
Thread
*
t
=
ThreadLocalStorage
::
thread
();
if
(
t
->
is_Java_thread
())
{
INTERRUPTIBLE_RETURN_INT
(
::
write
(
fd
,
buf
,
nBytes
),
os
::
Solaris
::
clear_interrupted
);
}
else
{
size_t
res
;
RESTARTABLE
((
size_t
)
::
write
(
fd
,
buf
,
(
size_t
)
nBytes
),
res
);
return
res
;
}
}
int
os
::
close
(
int
fd
)
{
...
...
src/share/vm/services/heapDumper.cpp
浏览文件 @
8af2050f
...
...
@@ -376,11 +376,11 @@ class DumpWriter : public StackObj {
};
int
_fd
;
// file descriptor (-1 if dump file not open)
jlong
_bytes_written
;
// number of byte written to dump file
j
u
long
_bytes_written
;
// number of byte written to dump file
char
*
_buffer
;
// internal buffer
in
t
_size
;
in
t
_pos
;
size_
t
_size
;
size_
t
_pos
;
char
*
_error
;
// error message when I/O fails
...
...
@@ -388,14 +388,14 @@ class DumpWriter : public StackObj {
int
file_descriptor
()
const
{
return
_fd
;
}
char
*
buffer
()
const
{
return
_buffer
;
}
int
buffer_size
()
const
{
return
_size
;
}
int
position
()
const
{
return
_pos
;
}
void
set_position
(
int
pos
)
{
_pos
=
pos
;
}
size_t
buffer_size
()
const
{
return
_size
;
}
size_t
position
()
const
{
return
_pos
;
}
void
set_position
(
size_t
pos
)
{
_pos
=
pos
;
}
void
set_error
(
const
char
*
error
)
{
_error
=
(
char
*
)
os
::
strdup
(
error
);
}
// all I/O go through this function
void
write_internal
(
void
*
s
,
in
t
len
);
void
write_internal
(
void
*
s
,
size_
t
len
);
public:
DumpWriter
(
const
char
*
path
);
...
...
@@ -406,14 +406,14 @@ class DumpWriter : public StackObj {
void
flush
();
// total number of bytes written to the disk
j
long
bytes_written
()
const
{
return
_bytes_written
;
}
j
ulong
bytes_written
()
const
{
return
_bytes_written
;
}
// adjust the number of bytes written to disk (used to keep the count
// of the number of bytes written in case of rewrites)
void
adjust_bytes_written
(
jlong
n
)
{
_bytes_written
+=
n
;
}
void
adjust_bytes_written
(
jlong
n
)
{
_bytes_written
+=
n
;
}
// number of (buffered) bytes as yet unwritten to the dump file
jlong
bytes_unwritten
()
const
{
return
(
jlong
)
position
();
}
size_t
bytes_unwritten
()
const
{
return
position
();
}
char
*
error
()
const
{
return
_error
;
}
...
...
@@ -421,7 +421,7 @@ class DumpWriter : public StackObj {
void
seek_to_offset
(
jlong
pos
);
// writer functions
void
write_raw
(
void
*
s
,
in
t
len
);
void
write_raw
(
void
*
s
,
size_
t
len
);
void
write_u1
(
u1
x
)
{
write_raw
((
void
*
)
&
x
,
1
);
}
void
write_u2
(
u2
x
);
void
write_u4
(
u4
x
);
...
...
@@ -468,35 +468,40 @@ void DumpWriter::close() {
// flush and close dump file
if
(
is_open
())
{
flush
();
::
close
(
file_descriptor
());
os
::
close
(
file_descriptor
());
set_file_descriptor
(
-
1
);
}
}
// write directly to the file
void
DumpWriter
::
write_internal
(
void
*
s
,
in
t
len
)
{
void
DumpWriter
::
write_internal
(
void
*
s
,
size_
t
len
)
{
if
(
is_open
())
{
int
n
=
::
write
(
file_descriptor
(),
s
,
len
);
if
(
n
>
0
)
{
_bytes_written
+=
n
;
}
if
(
n
!=
len
)
{
const
char
*
pos
=
(
char
*
)
s
;
ssize_t
n
=
0
;
while
(
len
>
0
)
{
uint
tmp
=
(
uint
)
MIN2
(
len
,
(
size_t
)
UINT_MAX
);
n
=
os
::
write
(
file_descriptor
(),
pos
,
tmp
);
if
(
n
<
0
)
{
// EINTR cannot happen here, os::write will take care of that
set_error
(
strerror
(
errno
));
}
else
{
set_error
(
"file size limit"
);
os
::
close
(
file_descriptor
());
set_file_descriptor
(
-
1
);
return
;
}
::
close
(
file_descriptor
());
set_file_descriptor
(
-
1
);
_bytes_written
+=
n
;
pos
+=
n
;
len
-=
n
;
}
}
}
// write raw bytes
void
DumpWriter
::
write_raw
(
void
*
s
,
in
t
len
)
{
void
DumpWriter
::
write_raw
(
void
*
s
,
size_
t
len
)
{
if
(
is_open
())
{
// flush buffer to make
t
oom
if
((
position
()
+
len
)
>=
buffer_size
())
{
// flush buffer to make
r
oom
if
((
position
()
+
len
)
>=
buffer_size
())
{
flush
();
}
...
...
@@ -519,13 +524,12 @@ void DumpWriter::flush() {
}
}
jlong
DumpWriter
::
current_offset
()
{
if
(
is_open
())
{
// the offset is the file offset plus whatever we have buffered
jlong
offset
=
os
::
current_file_offset
(
file_descriptor
());
assert
(
offset
>=
0
,
"lseek failed"
);
return
offset
+
(
jlong
)
position
();
return
offset
+
position
();
}
else
{
return
(
jlong
)
-
1
;
}
...
...
@@ -774,7 +778,7 @@ u4 DumperSupport::instance_size(Klass* k) {
HandleMark
hm
;
instanceKlassHandle
ikh
=
instanceKlassHandle
(
Thread
::
current
(),
k
);
int
size
=
0
;
u4
size
=
0
;
for
(
FieldStream
fld
(
ikh
,
false
,
false
);
!
fld
.
eos
();
fld
.
next
())
{
if
(
!
fld
.
access_flags
().
is_static
())
{
...
...
@@ -799,7 +803,7 @@ u4 DumperSupport::instance_size(Klass* k) {
}
}
}
return
(
u4
)
size
;
return
size
;
}
// dumps static fields of the given class
...
...
@@ -1031,8 +1035,7 @@ void DumperSupport::dump_prim_array(DumpWriter* writer, typeArrayOop array) {
}
// If the byte ordering is big endian then we can copy most types directly
int
length_in_bytes
=
array
->
length
()
*
type2aelembytes
(
type
);
assert
(
length_in_bytes
>
0
,
"nothing to copy"
);
u4
length_in_bytes
=
(
u4
)
array
->
length
()
*
type2aelembytes
(
type
);
switch
(
type
)
{
case
T_INT
:
{
...
...
@@ -1285,22 +1288,18 @@ void HeapObjectDumper::do_object(oop o) {
}
}
// create a HPROF_GC_INSTANCE record for each object
if
(
o
->
is_instance
())
{
// create a HPROF_GC_INSTANCE record for each object
DumperSupport
::
dump_instance
(
writer
(),
o
);
mark_end_of_record
();
}
else
{
}
else
if
(
o
->
is_objArray
())
{
// create a HPROF_GC_OBJ_ARRAY_DUMP record for each object array
if
(
o
->
is_objArray
())
{
DumperSupport
::
dump_object_array
(
writer
(),
objArrayOop
(
o
));
mark_end_of_record
();
}
else
{
// create a HPROF_GC_PRIM_ARRAY_DUMP record for each type array
if
(
o
->
is_typeArray
())
{
DumperSupport
::
dump_prim_array
(
writer
(),
typeArrayOop
(
o
));
mark_end_of_record
();
}
}
DumperSupport
::
dump_object_array
(
writer
(),
objArrayOop
(
o
));
mark_end_of_record
();
}
else
if
(
o
->
is_typeArray
())
{
// create a HPROF_GC_PRIM_ARRAY_DUMP record for each type array
DumperSupport
::
dump_prim_array
(
writer
(),
typeArrayOop
(
o
));
mark_end_of_record
();
}
}
...
...
@@ -1448,11 +1447,11 @@ void VM_HeapDumper::write_current_dump_record_length() {
assert
(
dump_start
()
>=
0
,
"no dump start recorded"
);
// calculate the size of the dump record
jlong
dump_end
=
writer
()
->
current_offset
();
jlong
dump_len
=
(
dump_end
-
dump_start
()
-
4
);
j
u
long
dump_end
=
writer
()
->
current_offset
();
j
u
long
dump_len
=
(
dump_end
-
dump_start
()
-
4
);
// record length must fit in a u4
if
(
dump_len
>
(
jlong
)(
4L
*
(
jlong
)
G
)
)
{
if
(
dump_len
>
max_juint
)
{
warning
(
"record is too large"
);
}
...
...
@@ -1461,7 +1460,7 @@ void VM_HeapDumper::write_current_dump_record_length() {
writer
()
->
write_u4
((
u4
)
dump_len
);
// adjust the total size written to keep the bytes written correct.
writer
()
->
adjust_bytes_written
(
-
((
long
)
sizeof
(
u4
)));
writer
()
->
adjust_bytes_written
(
-
((
j
long
)
sizeof
(
u4
)));
// seek to dump end so we can continue
writer
()
->
seek_to_offset
(
dump_end
);
...
...
@@ -1477,12 +1476,12 @@ void VM_HeapDumper::check_segment_length() {
if
(
writer
()
->
is_open
())
{
if
(
is_segmented_dump
())
{
// don't use current_offset that would be too expensive on a per record basis
jlong
dump_end
=
writer
()
->
bytes_written
()
+
writer
()
->
bytes_unwritten
();
assert
(
dump_end
==
writer
()
->
current_offset
(),
"checking"
);
jlong
dump_len
=
(
dump_end
-
dump_start
()
-
4
);
assert
(
dump_len
>=
0
&&
dump_len
<=
max_juint
,
"bad dump length"
);
j
u
long
dump_end
=
writer
()
->
bytes_written
()
+
writer
()
->
bytes_unwritten
();
assert
(
dump_end
==
(
julong
)
writer
()
->
current_offset
(),
"checking"
);
j
u
long
dump_len
=
(
dump_end
-
dump_start
()
-
4
);
assert
(
dump_len
<=
max_juint
,
"bad dump length"
);
if
(
dump_len
>
(
jlong
)
HeapDumpSegmentSize
)
{
if
(
dump_len
>
HeapDumpSegmentSize
)
{
write_current_dump_record_length
();
write_dump_header
();
}
...
...
@@ -1868,13 +1867,8 @@ int HeapDumper::dump(const char* path) {
if
(
print_to_tty
())
{
timer
()
->
stop
();
if
(
error
()
==
NULL
)
{
char
msg
[
256
];
sprintf
(
msg
,
"Heap dump file created [%s bytes in %3.3f secs]"
,
JLONG_FORMAT
,
timer
()
->
seconds
());
PRAGMA_DIAG_PUSH
PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
tty
->
print_cr
(
msg
,
writer
.
bytes_written
());
PRAGMA_DIAG_POP
tty
->
print_cr
(
"Heap dump file created ["
JULONG_FORMAT
" bytes in %3.3f secs]"
,
writer
.
bytes_written
(),
timer
()
->
seconds
());
}
else
{
tty
->
print_cr
(
"Dump file is incomplete: %s"
,
writer
.
error
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录