Skip to content

Commit

Permalink
8272094: compiler/codecache/TestStressCodeBuffers.java crashes with "…
Browse files Browse the repository at this point in the history
…failed to allocate space for trampoline"

Backport-of: 0948c097a855dcc9a8a437b4618d7c1922722eab
  • Loading branch information
GoeLin committed Oct 18, 2022
1 parent 2012a98 commit 39e6ebd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/hotspot/cpu/aarch64/aarch64.ad
Expand Up @@ -15207,7 +15207,11 @@ instruct clearArray_imm_reg(immL cnt, iRegP_R10 base, iRegL_R11 temp, Universe d
format %{ "ClearArray $cnt, $base" %}

ins_encode %{
__ zero_words($base$$Register, (uint64_t)$cnt$$constant);
address tpc = __ zero_words($base$$Register, (uint64_t)$cnt$$constant);
if (tpc == NULL) {
ciEnv::current()->record_failure("CodeCache is full");
return;
}
%}

ins_pipe(pipe_class_memory);
Expand Down
8 changes: 5 additions & 3 deletions src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
Expand Up @@ -4850,7 +4850,6 @@ address MacroAssembler::zero_words(Register ptr, Register cnt)
address tpc = trampoline_call(zero_blocks);
if (tpc == NULL) {
DEBUG_ONLY(reset_labels(around));
assert(false, "failed to allocate space for trampoline");
return NULL;
}
} else {
Expand Down Expand Up @@ -4884,10 +4883,11 @@ address MacroAssembler::zero_words(Register ptr, Register cnt)
// cnt: Immediate count in HeapWords.
//
// r10, r11, rscratch1, and rscratch2 are clobbered.
void MacroAssembler::zero_words(Register base, uint64_t cnt)
address MacroAssembler::zero_words(Register base, uint64_t cnt)
{
guarantee(zero_words_block_size < BlockZeroingLowLimit,
"increase BlockZeroingLowLimit");
address result = nullptr;
if (cnt <= (uint64_t)BlockZeroingLowLimit / BytesPerWord) {
#ifndef PRODUCT
{
Expand Down Expand Up @@ -4921,10 +4921,12 @@ void MacroAssembler::zero_words(Register base, uint64_t cnt)
stp(zr, zr, Address(base, i * wordSize));
}
BLOCK_COMMENT("} zero_words");
result = pc();
} else {
mov(r10, base); mov(r11, cnt);
zero_words(r10, r11);
result = zero_words(r10, r11);
}
return result;
}

// Zero blocks of memory by using DC ZVA.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp
Expand Up @@ -1262,7 +1262,7 @@ class MacroAssembler: public Assembler {
int elem_size);

void fill_words(Register base, Register cnt, Register value);
void zero_words(Register base, uint64_t cnt);
address zero_words(Register base, uint64_t cnt);
address zero_words(Register ptr, Register cnt);
void zero_dcache_blocks(Register base, Register cnt);

Expand Down

0 comments on commit 39e6ebd

Please sign in to comment.