< prev index next >

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Print this page
rev 61943 : 8248048: ZGC: AArch64: SIGILL in load barrier register spilling
Reviewed-by: adinn, aph


2116   }
2117 
2118   assert(words_pushed == count, "oops, pushed != count");
2119 
2120   return count;
2121 }
2122 
2123 // Push lots of registers in the bit set supplied.  Don't push sp.
2124 // Return the number of words pushed
2125 int MacroAssembler::push_fp(unsigned int bitset, Register stack) {
2126   int words_pushed = 0;
2127 
2128   // Scan bitset to accumulate register pairs
2129   unsigned char regs[32];
2130   int count = 0;
2131   for (int reg = 0; reg <= 31; reg++) {
2132     if (1 & bitset)
2133       regs[count++] = reg;
2134     bitset >>= 1;
2135   }
2136 
2137   if (count == 0) {
2138     return 0;
2139   }
2140 
2141   if (count == 1) {
2142     strq(as_FloatRegister(regs[0]), Address(pre(stack, -wordSize * 2)));
2143     return 1;
2144   }
2145 
2146   bool odd = (count & 1) == 1;
2147   int push_slots = count + (odd ? 1 : 0);
2148 
2149   // Always pushing full 128 bit registers.
2150   stpq(as_FloatRegister(regs[0]), as_FloatRegister(regs[1]), Address(pre(stack, -push_slots * wordSize * 2)));

2151   words_pushed += 2;
2152 
2153   for (int i = 2; i + 1 < count; i += 2) {
2154     stpq(as_FloatRegister(regs[i]), as_FloatRegister(regs[i+1]), Address(stack, i * wordSize * 2));
2155     words_pushed += 2;
2156   }
2157 
2158   if (odd) {
2159     strq(as_FloatRegister(regs[count - 1]), Address(stack, (count - 1) * wordSize * 2));
2160     words_pushed++;
2161   }
2162 
2163   assert(words_pushed == count, "oops, pushed(%d) != count(%d)", words_pushed, count);
2164   return count;
2165 }
2166 
2167 int MacroAssembler::pop_fp(unsigned int bitset, Register stack) {
2168   int words_pushed = 0;
2169 
2170   // Scan bitset to accumulate register pairs
2171   unsigned char regs[32];
2172   int count = 0;
2173   for (int reg = 0; reg <= 31; reg++) {
2174     if (1 & bitset)
2175       regs[count++] = reg;
2176     bitset >>= 1;
2177   }


2178 
2179   if (count == 0) {
2180     return 0;
2181   }
2182 
2183   if (count == 1) {
2184     ldrq(as_FloatRegister(regs[0]), Address(post(stack, wordSize * 2)));
2185     return 1;
2186   }
2187 
2188   bool odd = (count & 1) == 1;
2189   int push_slots = count + (odd ? 1 : 0);
2190 
2191   if (odd) {
2192     ldrq(as_FloatRegister(regs[count - 1]), Address(stack, (count - 1) * wordSize * 2));
2193     words_pushed++;
2194   }
2195 
2196   for (int i = 2; i + 1 < count; i += 2) {
2197     ldpq(as_FloatRegister(regs[i]), as_FloatRegister(regs[i+1]), Address(stack, i * wordSize * 2));
2198     words_pushed += 2;
2199   }
2200 
2201   ldpq(as_FloatRegister(regs[0]), as_FloatRegister(regs[1]), Address(post(stack, push_slots * wordSize * 2)));
2202   words_pushed += 2;

2203 
2204   assert(words_pushed == count, "oops, pushed(%d) != count(%d)", words_pushed, count);
2205 
2206   return count;
2207 }
2208 
2209 #ifdef ASSERT
2210 void MacroAssembler::verify_heapbase(const char* msg) {
2211 #if 0
2212   assert (UseCompressedOops || UseCompressedClassPointers, "should be compressed");
2213   assert (Universe::heap() != NULL, "java heap should be initialized");
2214   if (!UseCompressedOops || Universe::ptr_base() == NULL) {
2215     // rheapbase is allocated as general register
2216     return;
2217   }
2218   if (CheckCompressedOops) {
2219     Label ok;
2220     push(1 << rscratch1->encoding(), sp); // cmpptr trashes rscratch1
2221     cmpptr(rheapbase, ExternalAddress((address)CompressedOops::ptrs_base_addr()));
2222     br(Assembler::EQ, ok);
2223     stop(msg);
2224     bind(ok);




2116   }
2117 
2118   assert(words_pushed == count, "oops, pushed != count");
2119 
2120   return count;
2121 }
2122 
2123 // Push lots of registers in the bit set supplied.  Don't push sp.
2124 // Return the number of words pushed
2125 int MacroAssembler::push_fp(unsigned int bitset, Register stack) {
2126   int words_pushed = 0;
2127 
2128   // Scan bitset to accumulate register pairs
2129   unsigned char regs[32];
2130   int count = 0;
2131   for (int reg = 0; reg <= 31; reg++) {
2132     if (1 & bitset)
2133       regs[count++] = reg;
2134     bitset >>= 1;
2135   }
2136   regs[count++] = zr->encoding_nocheck();
2137   count &= ~1;  // Only push an even number of regs










2138 
2139   // Always pushing full 128 bit registers.
2140   if (count) {
2141     stpq(as_FloatRegister(regs[0]), as_FloatRegister(regs[1]), Address(pre(stack, -count * wordSize * 2)));
2142     words_pushed += 2;
2143   }
2144   for (int i = 2; i < count; i += 2) {
2145     stpq(as_FloatRegister(regs[i]), as_FloatRegister(regs[i+1]), Address(stack, i * wordSize * 2));
2146     words_pushed += 2;
2147   }
2148 
2149   assert(words_pushed == count, "oops, pushed != count");





2150   return count;
2151 }
2152 
2153 int MacroAssembler::pop_fp(unsigned int bitset, Register stack) {
2154   int words_pushed = 0;
2155 
2156   // Scan bitset to accumulate register pairs
2157   unsigned char regs[32];
2158   int count = 0;
2159   for (int reg = 0; reg <= 31; reg++) {
2160     if (1 & bitset)
2161       regs[count++] = reg;
2162     bitset >>= 1;
2163   }
2164   regs[count++] = zr->encoding_nocheck();
2165   count &= ~1;
2166 
2167   for (int i = 2; i < count; i += 2) {

















2168     ldpq(as_FloatRegister(regs[i]), as_FloatRegister(regs[i+1]), Address(stack, i * wordSize * 2));
2169     words_pushed += 2;
2170   }
2171   if (count) {
2172     ldpq(as_FloatRegister(regs[0]), as_FloatRegister(regs[1]), Address(post(stack, count * wordSize * 2)));
2173     words_pushed += 2;
2174   }
2175 
2176   assert(words_pushed == count, "oops, pushed != count");
2177 
2178   return count;
2179 }
2180 
2181 #ifdef ASSERT
2182 void MacroAssembler::verify_heapbase(const char* msg) {
2183 #if 0
2184   assert (UseCompressedOops || UseCompressedClassPointers, "should be compressed");
2185   assert (Universe::heap() != NULL, "java heap should be initialized");
2186   if (!UseCompressedOops || Universe::ptr_base() == NULL) {
2187     // rheapbase is allocated as general register
2188     return;
2189   }
2190   if (CheckCompressedOops) {
2191     Label ok;
2192     push(1 << rscratch1->encoding(), sp); // cmpptr trashes rscratch1
2193     cmpptr(rheapbase, ExternalAddress((address)CompressedOops::ptrs_base_addr()));
2194     br(Assembler::EQ, ok);
2195     stop(msg);
2196     bind(ok);


< prev index next >