Skip to content

Commit 1875b28

Browse files
author
Tom Rodriguez
committed
8314061: [JVMCI] DeoptimizeALot stress logic breaks deferred barriers
Reviewed-by: thartmann, dnsimon
1 parent bd1b942 commit 1875b28

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/hotspot/share/jvmci/jvmciRuntime.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array_common(JavaThread* current, Klass*
174174
RetryableAllocationMark ram(current, null_on_fail);
175175
obj = oopFactory::new_objArray(elem_klass, length, CHECK);
176176
}
177-
current->set_vm_result(obj);
178177
// This is pretty rare but this runtime patch is stressful to deoptimization
179178
// if we deoptimize here so force a deopt to stress the path.
180179
if (DeoptimizeALot) {
181180
static int deopts = 0;
182181
// Alternate between deoptimizing and raising an error (which will also cause a deopt)
183182
if (deopts++ % 2 == 0) {
184183
if (null_on_fail) {
185-
return;
184+
// Drop the allocation
185+
obj = nullptr;
186186
} else {
187187
ResourceMark rm(current);
188188
THROW(vmSymbols::java_lang_OutOfMemoryError());
@@ -191,6 +191,7 @@ JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array_common(JavaThread* current, Klass*
191191
deopt_caller();
192192
}
193193
}
194+
current->set_vm_result(obj);
194195
JRT_BLOCK_END;
195196
SharedRuntime::on_slowpath_allocation_exit(current);
196197
JRT_END

0 commit comments

Comments
 (0)