Skip to content
Closed
Changes from all commits
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
5 changes: 3 additions & 2 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array_common(JavaThread* current, Klass*
RetryableAllocationMark ram(current, null_on_fail);
obj = oopFactory::new_objArray(elem_klass, length, CHECK);
}
current->set_vm_result(obj);
// This is pretty rare but this runtime patch is stressful to deoptimization
// if we deoptimize here so force a deopt to stress the path.
if (DeoptimizeALot) {
static int deopts = 0;
// Alternate between deoptimizing and raising an error (which will also cause a deopt)
if (deopts++ % 2 == 0) {
if (null_on_fail) {
return;
// Drop the allocation
obj = nullptr;
} else {
ResourceMark rm(current);
THROW(vmSymbols::java_lang_OutOfMemoryError());
Expand All @@ -191,6 +191,7 @@ JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array_common(JavaThread* current, Klass*
deopt_caller();
}
}
current->set_vm_result(obj);
JRT_BLOCK_END;
SharedRuntime::on_slowpath_allocation_exit(current);
JRT_END
Expand Down