< prev index next >

src/cpu/aarch64/vm/templateTable_aarch64.cpp

Print this page
rev 8300 : 8079507: aarch64: fails to build due to changes to template interpreter
Summary: fix by merging in changes from fix for 8074345
Reviewed-by: duke

@@ -500,14 +500,21 @@
 {
   __ ldrb(reg, at_bcp(offset));
   __ neg(reg, reg);
 }
 
-void TemplateTable::iload()
-{
+void TemplateTable::iload() {
+  iload_internal();
+}
+
+void TemplateTable::nofast_iload() {
+  iload_internal(may_not_rewrite);
+}
+
+void TemplateTable::iload_internal(RewriteControl rc) {
   transition(vtos, itos);
-  if (RewriteFrequentPairs) {
+  if (RewriteFrequentPairs && rc == may_rewrite) {
     // TODO : check x86 code for what to do here
     __ call_Unimplemented();
   } else {
     locals_index(r1);
     __ ldr(r0, iaddress(r1));

@@ -757,12 +764,19 @@
 {
   transition(vtos, atos);
   __ ldr(r0, iaddress(n));
 }
 
-void TemplateTable::aload_0()
-{
+void TemplateTable::aload_0() {
+  aload_0_internal();
+}
+
+void TemplateTable::nofast_aload_0() {
+  aload_0_internal(may_not_rewrite);
+}
+
+void TemplateTable::aload_0_internal(RewriteControl rc) {
   // According to bytecode histograms, the pairs:
   //
   // _aload_0, _fast_igetfield
   // _aload_0, _fast_agetfield
   // _aload_0, _fast_fgetfield

@@ -780,11 +794,11 @@
   // Also rewrite frequent pairs
   //   aload_0, aload_1
   //   aload_0, iload_1
   // These bytecodes with a small amount of code are most profitable
   // to rewrite
-  if (RewriteFrequentPairs) {
+  if (RewriteFrequentPairs && rc == may_rewrite) {
     __ call_Unimplemented();
   } else {
     aload(0);
   }
 }

@@ -2130,18 +2144,25 @@
                                             size_t index_size) {
   const Register temp = r19;
   assert_different_registers(Rcache, index, temp);
 
   Label resolved;
+
+  Bytecodes::Code code = bytecode();
+  switch (code) {
+  case Bytecodes::_nofast_getfield: code = Bytecodes::_getfield; break;
+  case Bytecodes::_nofast_putfield: code = Bytecodes::_putfield; break;
+  }
+
   assert(byte_no == f1_byte || byte_no == f2_byte, "byte_no out of range");
   __ get_cache_and_index_and_bytecode_at_bcp(Rcache, index, temp, byte_no, 1, index_size);
-  __ cmp(temp, (int) bytecode());  // have we resolved this bytecode?
+  __ cmp(temp, (int) code);  // have we resolved this bytecode?
   __ br(Assembler::EQ, resolved);
 
   // resolve first time through
   address entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_from_cache);
-  __ mov(temp, (int) bytecode());
+  __ mov(temp, (int) code);
   __ call_VM(noreg, entry, temp);
 
   // Update registers with resolved info
   __ get_cache_and_index_at_bcp(Rcache, index, 1, index_size);
   // n.b. unlike x86 Rcache is now rcpool plus the indexed offset

@@ -2255,11 +2276,11 @@
   __ pop_ptr(r);
   __ null_check(r);  // for field access must check obj.
   __ verify_oop(r);
 }
 
-void TemplateTable::getfield_or_static(int byte_no, bool is_static)
+void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteControl rc)
 {
   const Register cache = r2;
   const Register index = r3;
   const Register obj   = r4;
   const Register off   = r19;

@@ -2289,22 +2310,22 @@
 
   // btos
   __ load_signed_byte(r0, field);
   __ push(btos);
   // Rewrite bytecode to be faster
-  if (!is_static) {
+  if (!is_static && rc == may_rewrite) {
     patch_bytecode(Bytecodes::_fast_bgetfield, bc, r1);
   }
   __ b(Done);
 
   __ bind(notByte);
   __ cmp(flags, atos);
   __ br(Assembler::NE, notObj);
   // atos
   __ load_heap_oop(r0, field);
   __ push(atos);
-  if (!is_static) {
+  if (!is_static && rc == may_rewrite) {
     patch_bytecode(Bytecodes::_fast_agetfield, bc, r1);
   }
   __ b(Done);
 
   __ bind(notObj);

@@ -2312,11 +2333,11 @@
   __ br(Assembler::NE, notInt);
   // itos
   __ ldrw(r0, field);
   __ push(itos);
   // Rewrite bytecode to be faster
-  if (!is_static) {
+  if (!is_static && rc == may_rewrite) {
     patch_bytecode(Bytecodes::_fast_igetfield, bc, r1);
   }
   __ b(Done);
 
   __ bind(notInt);

@@ -2324,11 +2345,11 @@
   __ br(Assembler::NE, notChar);
   // ctos
   __ load_unsigned_short(r0, field);
   __ push(ctos);
   // Rewrite bytecode to be faster
-  if (!is_static) {
+  if (!is_static && rc == may_rewrite) {
     patch_bytecode(Bytecodes::_fast_cgetfield, bc, r1);
   }
   __ b(Done);
 
   __ bind(notChar);

@@ -2336,11 +2357,11 @@
   __ br(Assembler::NE, notShort);
   // stos
   __ load_signed_short(r0, field);
   __ push(stos);
   // Rewrite bytecode to be faster
-  if (!is_static) {
+  if (!is_static && rc == may_rewrite) {
     patch_bytecode(Bytecodes::_fast_sgetfield, bc, r1);
   }
   __ b(Done);
 
   __ bind(notShort);

@@ -2348,11 +2369,11 @@
   __ br(Assembler::NE, notLong);
   // ltos
   __ ldr(r0, field);
   __ push(ltos);
   // Rewrite bytecode to be faster
-  if (!is_static) {
+  if (!is_static && rc == may_rewrite) {
     patch_bytecode(Bytecodes::_fast_lgetfield, bc, r1);
   }
   __ b(Done);
 
   __ bind(notLong);

@@ -2360,11 +2381,11 @@
   __ br(Assembler::NE, notFloat);
   // ftos
   __ ldrs(v0, field);
   __ push(ftos);
   // Rewrite bytecode to be faster
-  if (!is_static) {
+  if (!is_static && rc == may_rewrite) {
     patch_bytecode(Bytecodes::_fast_fgetfield, bc, r1);
   }
   __ b(Done);
 
   __ bind(notFloat);

@@ -2374,11 +2395,11 @@
 #endif
   // dtos
   __ ldrd(v0, field);
   __ push(dtos);
   // Rewrite bytecode to be faster
-  if (!is_static) {
+  if (!is_static && rc == may_rewrite) {
     patch_bytecode(Bytecodes::_fast_dgetfield, bc, r1);
   }
 #ifdef ASSERT
   __ b(Done);
 

@@ -2396,10 +2417,14 @@
 void TemplateTable::getfield(int byte_no)
 {
   getfield_or_static(byte_no, false);
 }
 
+void TemplateTable::nofast_getfield(int byte_no) {
+  getfield_or_static(byte_no, false, may_not_rewrite);
+}
+
 void TemplateTable::getstatic(int byte_no)
 {
   getfield_or_static(byte_no, true);
 }
 

@@ -2459,11 +2484,11 @@
     __ get_cache_and_index_at_bcp(cache, index, 1);
     __ bind(L1);
   }
 }
 
-void TemplateTable::putfield_or_static(int byte_no, bool is_static) {
+void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteControl rc) {
   transition(vtos, vtos);
 
   const Register cache = r2;
   const Register index = r3;
   const Register obj   = r2;

@@ -2501,11 +2526,11 @@
   // btos
   {
     __ pop(btos);
     if (!is_static) pop_and_check_object(obj);
     __ strb(r0, field);
-    if (!is_static) {
+    if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_bputfield, bc, r1, true, byte_no);
     }
     __ b(Done);
   }
 

@@ -2517,11 +2542,11 @@
   {
     __ pop(atos);
     if (!is_static) pop_and_check_object(obj);
     // Store into the field
     do_oop_store(_masm, field, r0, _bs->kind(), false);
-    if (!is_static) {
+    if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_aputfield, bc, r1, true, byte_no);
     }
     __ b(Done);
   }
 

@@ -2532,11 +2557,11 @@
   // itos
   {
     __ pop(itos);
     if (!is_static) pop_and_check_object(obj);
     __ strw(r0, field);
-    if (!is_static) {
+    if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_iputfield, bc, r1, true, byte_no);
     }
     __ b(Done);
   }
 

@@ -2547,11 +2572,11 @@
   // ctos
   {
     __ pop(ctos);
     if (!is_static) pop_and_check_object(obj);
     __ strh(r0, field);
-    if (!is_static) {
+    if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_cputfield, bc, r1, true, byte_no);
     }
     __ b(Done);
   }
 

@@ -2562,11 +2587,11 @@
   // stos
   {
     __ pop(stos);
     if (!is_static) pop_and_check_object(obj);
     __ strh(r0, field);
-    if (!is_static) {
+    if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_sputfield, bc, r1, true, byte_no);
     }
     __ b(Done);
   }
 

@@ -2577,11 +2602,11 @@
   // ltos
   {
     __ pop(ltos);
     if (!is_static) pop_and_check_object(obj);
     __ str(r0, field);
-    if (!is_static) {
+    if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_lputfield, bc, r1, true, byte_no);
     }
     __ b(Done);
   }
 

@@ -2592,11 +2617,11 @@
   // ftos
   {
     __ pop(ftos);
     if (!is_static) pop_and_check_object(obj);
     __ strs(v0, field);
-    if (!is_static) {
+    if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_fputfield, bc, r1, true, byte_no);
     }
     __ b(Done);
   }
 

@@ -2609,11 +2634,11 @@
   // dtos
   {
     __ pop(dtos);
     if (!is_static) pop_and_check_object(obj);
     __ strd(v0, field);
-    if (!is_static) {
+    if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_dputfield, bc, r1, true, byte_no);
     }
   }
 
 #ifdef ASSERT

@@ -2636,10 +2661,14 @@
 void TemplateTable::putfield(int byte_no)
 {
   putfield_or_static(byte_no, false);
 }
 
+void TemplateTable::nofast_putfield(int byte_no) {
+  putfield_or_static(byte_no, false, may_not_rewrite);
+}
+
 void TemplateTable::putstatic(int byte_no) {
   putfield_or_static(byte_no, true);
 }
 
 void TemplateTable::jvmti_post_fast_field_mod()
< prev index next >