[aarch64-port-dev ] Some small cleanups

Andrew Haley aph at redhat.com
Tue May 13 15:54:49 UTC 2014


Remove dead code and replace obscure constants with RegSet expressions.

Andrew.


# HG changeset patch
# User aph
# Date 1399994902 -3600
#      Tue May 13 16:28:22 2014 +0100
# Node ID a1b63a9c0d1f98a50494405ef5d781630a0aa690
# Parent  92cd832e8f785bfbaaed282ad2a7e9f403232a63
Add RegSet::operator+=.

diff -r 92cd832e8f78 -r a1b63a9c0d1f src/cpu/aarch64/vm/register_aarch64.hpp
--- a/src/cpu/aarch64/vm/register_aarch64.hpp   Tue May 13 15:57:30 2014 +0100
+++ b/src/cpu/aarch64/vm/register_aarch64.hpp   Tue May 13 16:28:22 2014 +0100
@@ -244,16 +244,21 @@

   RegSet(Register r1) : _bitset(r1->bit()) { }

-  RegSet operator+(RegSet aSet) const {
+  RegSet operator+(const RegSet aSet) const {
     RegSet result(_bitset | aSet._bitset);
     return result;
   }

-  RegSet operator-(RegSet aSet) const {
+  RegSet operator-(const RegSet aSet) const {
     RegSet result(_bitset & ~aSet._bitset);
     return result;
   }

+  RegSet &operator+=(const RegSet aSet) {
+    *this = *this + aSet;
+    return *this;
+  }
+
   static RegSet of(Register r1) {
     return RegSet(r1);
   }
# HG changeset patch
# User aph
# Date 1399996165 -3600
#      Tue May 13 16:49:25 2014 +0100
# Node ID 4d1f5e7d102cc5a96572091644457cd28c594537
# Parent  a1b63a9c0d1f98a50494405ef5d781630a0aa690
Tidy up register usage in push/pop instructions.

diff -r a1b63a9c0d1f -r 4d1f5e7d102c src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp     Tue May 13 16:28:22 2014 +0100
+++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp     Tue May 13 16:49:25 2014 +0100
@@ -989,14 +989,15 @@
   assert(sub_klass != r2, "killed reg"); // killed by lea(r2, &pst_counter)

   // Get super_klass value into r0 (even if it was in r5 or r2).
-  bool pushed_r0 = false, pushed_r2 = !IS_A_TEMP(r2), pushed_r5 = !IS_A_TEMP(r5);
+  RegSet pushed_registers;
+  if (!IS_A_TEMP(r2))    pushed_registers += r2;
+  if (!IS_A_TEMP(r5))    pushed_registers += r5;

   if (super_klass != r0 || UseCompressedOops) {
-    if (!IS_A_TEMP(r0))
-      pushed_r0 = true;
+    if (!IS_A_TEMP(r0))   pushed_registers += r0;
   }

-  push(r0->bit(pushed_r0) | r2->bit(pushed_r2) | r5->bit(pushed_r5), sp);
+  push(pushed_registers, sp);

 #ifndef PRODUCT
   mov(rscratch2, (address)&SharedRuntime::_partial_subtype_ctr);
@@ -1019,7 +1020,7 @@
   repne_scan(r5, r0, r2, rscratch1);

   // Unspill the temp. registers:
-  pop(r0->bit(pushed_r0) | r2->bit(pushed_r2) | r5->bit(pushed_r5), sp);
+  pop(pushed_registers, sp);

   br(Assembler::NE, *L_failure);

diff -r a1b63a9c0d1f -r 4d1f5e7d102c src/os_cpu/linux_aarch64/vm/assembler_linux_aarch64.cpp
--- a/src/os_cpu/linux_aarch64/vm/assembler_linux_aarch64.cpp   Tue May 13 16:28:22 2014 +0100
+++ b/src/os_cpu/linux_aarch64/vm/assembler_linux_aarch64.cpp   Tue May 13 16:49:25 2014 +0100
@@ -22,20 +22,12 @@
  *
  */

-#ifndef OS_CPU_LINUX_AARCH64_VM_ASSEMBLER_LINUX_AARCH64_HPP
-#define OS_CPU_LINUX_AARCH64_VM_ASSEMBLER_LINUX_AARCH64_HPP
-
 #include "precompiled.hpp"
 #include "asm/macroAssembler.hpp"
 #include "asm/macroAssembler.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/threadLocalStorage.hpp"

-#if 0
-void MacroAssembler::int3() {
-  fixme()
-}
-#endif

 // get_thread can be called anywhere inside generated code so we need
 // to save whatever non-callee save context might get clobbered by the
@@ -47,7 +39,7 @@
   // void * pthread_getspecific(pthread_key_t key);

   // Save all call-clobbered regs except dst, plus r19 and r20.
-  unsigned int saved_regs = 0x401fffff & ~(1<<dst->encoding());
+  RegSet saved_regs = RegSet::range(r0, r20) + lr - dst;
   push(saved_regs, sp);
   mov(c_rarg0, ThreadLocalStorage::thread_index());
   mov(r19, CAST_FROM_FN_PTR(address, pthread_getspecific));
@@ -59,4 +51,3 @@
   pop(saved_regs, sp);
 }

-#endif // OS_CPU_LINUX_AARCH64_VM_ASSEMBLER_LINUX_AARCH64_HPP


More information about the aarch64-port-dev mailing list