Skip to content
Permalink
Browse files
8274795: AArch64: avoid spilling and restoring r18 in macro assembler
Reviewed-by: aph
  • Loading branch information
lewurm authored and Andrew Haley committed Oct 14, 2021
1 parent 40d69f0 commit ede3f4e94c752a8457b7c24e001bd122845d2f6a
Showing 3 changed files with 12 additions and 17 deletions.
@@ -1855,15 +1855,6 @@ void MacroAssembler::increment(Address dst, int value)
str(rscratch1, dst);
}


void MacroAssembler::pusha() {
push(0x7fffffff, sp);
}

void MacroAssembler::popa() {
pop(0x7fffffff, sp);
}

// Push lots of registers in the bit set supplied. Don't push sp.
// Return the number of words pushed
int MacroAssembler::push(unsigned int bitset, Register stack) {
@@ -2505,7 +2496,7 @@ void MacroAssembler::pop_call_clobbered_registers_except(RegSet exclude) {

void MacroAssembler::push_CPU_state(bool save_vectors, bool use_sve,
int sve_vector_size_in_bytes) {
push(0x3fffffff, sp); // integer registers except lr & sp
push(RegSet::range(r0, r29), sp); // integer registers except lr & sp
if (save_vectors && use_sve && sve_vector_size_in_bytes > 16) {
sub(sp, sp, sve_vector_size_in_bytes * FloatRegisterImpl::number_of_registers);
for (int i = 0; i < FloatRegisterImpl::number_of_registers; i++) {
@@ -2543,7 +2534,14 @@ void MacroAssembler::pop_CPU_state(bool restore_vectors, bool use_sve,
reinitialize_ptrue();
}

pop(0x3fffffff, sp); // integer registers except lr & sp
// integer registers except lr & sp
pop(RegSet::range(r0, r17), sp);
#ifdef R18_RESERVED
ldp(zr, r19, Address(post(sp, 2 * wordSize)));
pop(RegSet::range(r20, r29), sp);
#else
pop(RegSet::range(r18_tls, r29), sp);
#endif
}

/**
@@ -1106,10 +1106,6 @@ class MacroAssembler: public Assembler {
void push(Register src);
void pop(Register dst);

// push all registers onto the stack
void pusha();
void popa();

void repne_scan(Register addr, Register value, Register count,
Register scratch);
void repne_scanw(Register addr, Register value, Register count,
@@ -1397,11 +1397,12 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
__ cmp(rscratch1, (u1)StackOverflow::stack_guard_yellow_reserved_disabled);
__ br(Assembler::NE, no_reguard);

__ pusha(); // XXX only save smashed registers
__ push_call_clobbered_registers();
__ mov(c_rarg0, rthread);
__ mov(rscratch2, CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages));
__ blr(rscratch2);
__ popa(); // XXX only restore smashed registers
__ pop_call_clobbered_registers();

__ bind(no_reguard);
}

5 comments on commit ede3f4e

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on ede3f4e Oct 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lewurm
Copy link
Member Author

@lewurm lewurm commented on ede3f4e Oct 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u

@openjdk
Copy link

@openjdk openjdk bot commented on ede3f4e Oct 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lewurm @lewurm the backport was successfully created on the branch lewurm-backport-ede3f4e9 in my personal fork of openjdk/jdk17u. To create a pull request with this backport targeting openjdk/jdk17u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit ede3f4e9 from the openjdk/jdk repository.

The commit being backported was authored by Bernhard Urban-Forster on 14 Oct 2021 and was reviewed by Andrew Haley.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u:

$ git fetch https://github.com/openjdk-bots/jdk17u lewurm-backport-ede3f4e9:lewurm-backport-ede3f4e9
$ git checkout lewurm-backport-ede3f4e9
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u lewurm-backport-ede3f4e9

@lewurm
Copy link
Member Author

@lewurm lewurm commented on ede3f4e Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on ede3f4e Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lewurm the backport was successfully created on the branch lewurm-backport-ede3f4e9 in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit ede3f4e9 from the openjdk/jdk repository.

The commit being backported was authored by Bernhard Urban-Forster on 14 Oct 2021 and was reviewed by Andrew Haley.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev lewurm-backport-ede3f4e9:lewurm-backport-ede3f4e9
$ git checkout lewurm-backport-ede3f4e9
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev lewurm-backport-ede3f4e9

Please sign in to comment.