Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions src/hotspot/share/gc/shared/memAllocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,17 @@ class InternalOOMEMark: public StackObj {

public:
explicit InternalOOMEMark(JavaThread* thread) {
if (thread != nullptr) {
_outer = thread->is_in_internal_oome_mark();
thread->set_is_in_internal_oome_mark(true);
_thread = thread;
} else {
_outer = false;
_thread = nullptr;
}
assert(thread != nullptr, "nullptr is not supported");
_outer = thread->is_in_internal_oome_mark();
thread->set_is_in_internal_oome_mark(true);
_thread = thread;
}

~InternalOOMEMark() {
if (_thread != nullptr) {
// Check that only InternalOOMEMark sets
// JavaThread::_is_in_internal_oome_mark
assert(_thread->is_in_internal_oome_mark(), "must be");
_thread->set_is_in_internal_oome_mark(_outer);
}
// Check that only InternalOOMEMark sets
// JavaThread::_is_in_internal_oome_mark
assert(_thread->is_in_internal_oome_mark(), "must be");
_thread->set_is_in_internal_oome_mark(_outer);
}

JavaThread* thread() const { return _thread; }
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance_or_null(JavaThread* current, Kl
if (!h->is_initialized()) {
// Cannot re-execute class initialization without side effects
// so return without attempting the initialization
current->set_vm_result(nullptr);
return;
}
// allocate instance and return via TLS
Expand Down Expand Up @@ -201,6 +202,7 @@ JRT_ENTRY(void, JVMCIRuntime::dynamic_new_instance_or_null(JavaThread* current,
if (!klass->is_initialized()) {
// Cannot re-execute class initialization without side effects
// so return without attempting the initialization
current->set_vm_result(nullptr);
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/jvmci/jvmciRuntime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,9 @@ class JVMCIRuntime: public CHeapObj<mtJVMCI> {

// The following routines are called from compiled JVMCI code

// When allocation fails, these stubs return null and have no pending exception. Compiled code
// can use these stubs if a failed allocation will be retried (e.g., by deoptimizing and
// re-executing in the interpreter).
// When allocation fails, these stubs return null and have no pending OutOfMemoryError exception.
// Compiled code can use these stubs if a failed allocation will be retried (e.g., by deoptimizing
// and re-executing in the interpreter).
static void new_instance_or_null(JavaThread* thread, Klass* klass);
static void new_array_or_null(JavaThread* thread, Klass* klass, jint length);
static void new_multi_array_or_null(JavaThread* thread, Klass* klass, int rank, jint* dims);
Expand Down