提交 11ddab3b 编写于 作者: S sspitsyn

7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02

Summary: The JVMTI ResourceExhausted events must be generated in all places where OOME is thrown
Reviewed-by: acorn, coleenp, dcubed, dholmes, dsamersoff, jwilhelm, tonyp
Contributed-by: serguei.spitsyn@oracle.com
上级 3d00ab12
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -153,6 +153,7 @@ objArrayOop arrayKlass::allocate_arrayArray(int n, int length, TRAPS) { ...@@ -153,6 +153,7 @@ objArrayOop arrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
} }
if (length > arrayOopDesc::max_array_length(T_ARRAY)) { if (length > arrayOopDesc::max_array_length(T_ARRAY)) {
report_java_out_of_memory("Requested array size exceeds VM limit"); report_java_out_of_memory("Requested array size exceeds VM limit");
JvmtiExport::post_array_size_exhausted();
THROW_OOP_0(Universe::out_of_memory_error_array_size()); THROW_OOP_0(Universe::out_of_memory_error_array_size());
} }
int size = objArrayOopDesc::object_size(length); int size = objArrayOopDesc::object_size(length);
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -669,6 +669,7 @@ objArrayOop instanceKlass::allocate_objArray(int n, int length, TRAPS) { ...@@ -669,6 +669,7 @@ objArrayOop instanceKlass::allocate_objArray(int n, int length, TRAPS) {
if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
if (length > arrayOopDesc::max_array_length(T_OBJECT)) { if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
report_java_out_of_memory("Requested array size exceeds VM limit"); report_java_out_of_memory("Requested array size exceeds VM limit");
JvmtiExport::post_array_size_exhausted();
THROW_OOP_0(Universe::out_of_memory_error_array_size()); THROW_OOP_0(Universe::out_of_memory_error_array_size());
} }
int size = objArrayOopDesc::object_size(length); int size = objArrayOopDesc::object_size(length);
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -68,6 +68,7 @@ objArrayOop objArrayKlass::allocate(int length, TRAPS) { ...@@ -68,6 +68,7 @@ objArrayOop objArrayKlass::allocate(int length, TRAPS) {
return a; return a;
} else { } else {
report_java_out_of_memory("Requested array size exceeds VM limit"); report_java_out_of_memory("Requested array size exceeds VM limit");
JvmtiExport::post_array_size_exhausted();
THROW_OOP_0(Universe::out_of_memory_error_array_size()); THROW_OOP_0(Universe::out_of_memory_error_array_size());
} }
} else { } else {
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -93,6 +93,7 @@ typeArrayOop typeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) { ...@@ -93,6 +93,7 @@ typeArrayOop typeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) {
return t; return t;
} else { } else {
report_java_out_of_memory("Requested array size exceeds VM limit"); report_java_out_of_memory("Requested array size exceeds VM limit");
JvmtiExport::post_array_size_exhausted();
THROW_OOP_0(Universe::out_of_memory_error_array_size()); THROW_OOP_0(Universe::out_of_memory_error_array_size());
} }
} else { } else {
......
/* /*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -324,6 +324,12 @@ class JvmtiExport : public AllStatic { ...@@ -324,6 +324,12 @@ class JvmtiExport : public AllStatic {
record_vm_internal_object_allocation(object); record_vm_internal_object_allocation(object);
} }
} }
inline static void post_array_size_exhausted() {
if (should_post_resource_exhausted()) {
post_resource_exhausted(JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR,
"Requested array size exceeds VM limit");
}
}
static void cleanup_thread (JavaThread* thread) KERNEL_RETURN; static void cleanup_thread (JavaThread* thread) KERNEL_RETURN;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册