8180181: Get rid of FAST_DISPATCH from interpreter
authormgerdin
Thu, 11 May 2017 16:33:18 +0200
changeset 46461 7155d5ff2d07
parent 46460 d25a320cd821
child 46462 f92a713126b1
8180181: Get rid of FAST_DISPATCH from interpreter Reviewed-by: coleenp, tschatzl
hotspot/src/cpu/s390/vm/interp_masm_s390.cpp
hotspot/src/cpu/s390/vm/templateInterpreterGenerator_s390.cpp
hotspot/src/cpu/sparc/vm/abstractInterpreter_sparc.cpp
hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp
hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp
hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp
hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp
--- a/hotspot/src/cpu/s390/vm/interp_masm_s390.cpp	Thu May 11 16:17:31 2017 -0700
+++ b/hotspot/src/cpu/s390/vm/interp_masm_s390.cpp	Thu May 11 16:33:18 2017 +0200
@@ -107,24 +107,15 @@
   // TODO: Maybe implement +VerifyActivationFrameSize here.
   // verify_thread(); // Too slow. We will just verify on method entry & exit.
   verify_oop(Z_tos, state);
-#ifdef FAST_DISPATCH
-  if (table == Interpreter::dispatch_table(state)) {
-    // Use IdispatchTables.
-    add(Lbyte_code, Interpreter::distance_from_dispatch_table(state), Lbyte_code);
-                                                        // Add offset to correct dispatch table.
-    sll(Lbyte_code, LogBytesPerWord, Lbyte_code);       // Multiply by wordSize.
-    ld_ptr(IdispatchTables, Lbyte_code, G3_scratch);    // Get entry addr.
-  } else
-#endif
-  {
-    // Dispatch table to use.
-    load_absolute_address(Z_tmp_1, (address) table);  // Z_tmp_1 = table;
+
+  // Dispatch table to use.
+  load_absolute_address(Z_tmp_1, (address) table);  // Z_tmp_1 = table;
 
-    // 0 <= Z_bytecode < 256 => Use a 32 bit shift, because it is shorter than sllg.
-    // Z_bytecode must have been loaded zero-extended for this approach to be correct.
-    z_sll(Z_bytecode, LogBytesPerWord, Z_R0);   // Multiply by wordSize.
-    z_lg(Z_tmp_1, 0, Z_bytecode, Z_tmp_1);      // Get entry addr.
-  }
+  // 0 <= Z_bytecode < 256 => Use a 32 bit shift, because it is shorter than sllg.
+  // Z_bytecode must have been loaded zero-extended for this approach to be correct.
+  z_sll(Z_bytecode, LogBytesPerWord, Z_R0);   // Multiply by wordSize.
+  z_lg(Z_tmp_1, 0, Z_bytecode, Z_tmp_1);      // Get entry addr.
+
   z_br(Z_tmp_1);
 }
 
--- a/hotspot/src/cpu/s390/vm/templateInterpreterGenerator_s390.cpp	Thu May 11 16:17:31 2017 -0700
+++ b/hotspot/src/cpu/s390/vm/templateInterpreterGenerator_s390.cpp	Thu May 11 16:33:18 2017 +0200
@@ -1183,11 +1183,6 @@
   // native_call: assert that mdo == NULL
   const bool check_for_mdo = !native_call DEBUG_ONLY(|| native_call);
   if (ProfileInterpreter && check_for_mdo) {
-#ifdef FAST_DISPATCH
-    // FAST_DISPATCH and ProfileInterpreter are mutually exclusive since
-    // they both use I2.
-    assert(0, "FAST_DISPATCH and +ProfileInterpreter are mutually exclusive");
-#endif // FAST_DISPATCH
     Label get_continue;
 
     __ load_and_test_long(Rmdp, method_(method_data));
--- a/hotspot/src/cpu/sparc/vm/abstractInterpreter_sparc.cpp	Thu May 11 16:17:31 2017 -0700
+++ b/hotspot/src/cpu/sparc/vm/abstractInterpreter_sparc.cpp	Thu May 11 16:33:18 2017 +0200
@@ -281,9 +281,6 @@
   *interpreter_frame->register_addr(LcpoolCache) = (intptr_t) method->constants()->cache();
   // save the mirror in the interpreter frame
   *interpreter_frame->interpreter_frame_mirror_addr() = method->method_holder()->java_mirror();
-#ifdef FAST_DISPATCH
-  *interpreter_frame->register_addr(IdispatchTables) = (intptr_t) Interpreter::dispatch_table();
-#endif
 
 #ifdef ASSERT
   BasicObjectLock* mp = (BasicObjectLock*)monitors;
--- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu May 11 16:17:31 2017 -0700
+++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu May 11 16:33:18 2017 +0200
@@ -39,11 +39,6 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/thread.inline.hpp"
 
-#ifndef FAST_DISPATCH
-#define FAST_DISPATCH 1
-#endif
-#undef FAST_DISPATCH
-
 // Implementation of InterpreterMacroAssembler
 
 // This file specializes the assember with interpreter-specific macros
@@ -78,23 +73,12 @@
 // own dispatch. The dispatch address is computed and placed in IdispatchAddress
 void InterpreterMacroAssembler::dispatch_prolog(TosState state, int bcp_incr) {
   assert_not_delayed();
-#ifdef FAST_DISPATCH
-  // FAST_DISPATCH and ProfileInterpreter are mutually exclusive since
-  // they both use I2.
-  assert(!ProfileInterpreter, "FAST_DISPATCH and +ProfileInterpreter are mutually exclusive");
-  ldub(Lbcp, bcp_incr, Lbyte_code);                     // load next bytecode
-  add(Lbyte_code, Interpreter::distance_from_dispatch_table(state), Lbyte_code);
-                                                        // add offset to correct dispatch table
-  sll(Lbyte_code, LogBytesPerWord, Lbyte_code);         // multiply by wordSize
-  ld_ptr(IdispatchTables, Lbyte_code, IdispatchAddress);// get entry addr
-#else
   ldub( Lbcp, bcp_incr, Lbyte_code);                    // load next bytecode
   // dispatch table to use
   AddressLiteral tbl(Interpreter::dispatch_table(state));
   sll(Lbyte_code, LogBytesPerWord, Lbyte_code);         // multiply by wordSize
   set(tbl, G3_scratch);                                 // compute addr of table
   ld_ptr(G3_scratch, Lbyte_code, IdispatchAddress);     // get entry addr
-#endif
 }
 
 
@@ -281,23 +265,11 @@
   // %%%%% maybe implement +VerifyActivationFrameSize here
   //verify_thread(); //too slow; we will just verify on method entry & exit
   if (verify) interp_verify_oop(Otos_i, state, __FILE__, __LINE__);
-#ifdef FAST_DISPATCH
-  if (table == Interpreter::dispatch_table(state)) {
-    // use IdispatchTables
-    add(Lbyte_code, Interpreter::distance_from_dispatch_table(state), Lbyte_code);
-                                                        // add offset to correct dispatch table
-    sll(Lbyte_code, LogBytesPerWord, Lbyte_code);       // multiply by wordSize
-    ld_ptr(IdispatchTables, Lbyte_code, G3_scratch);    // get entry addr
-  } else {
-#endif
-    // dispatch table to use
-    AddressLiteral tbl(table);
-    sll(Lbyte_code, LogBytesPerWord, Lbyte_code);       // multiply by wordSize
-    set(tbl, G3_scratch);                               // compute addr of table
-    ld_ptr(G3_scratch, Lbyte_code, G3_scratch);         // get entry addr
-#ifdef FAST_DISPATCH
-  }
-#endif
+  // dispatch table to use
+  AddressLiteral tbl(table);
+  sll(Lbyte_code, LogBytesPerWord, Lbyte_code);       // multiply by wordSize
+  set(tbl, G3_scratch);                               // compute addr of table
+  ld_ptr(G3_scratch, Lbyte_code, G3_scratch);         // get entry addr
   jmp( G3_scratch, 0 );
   if (bcp_incr != 0)  delayed()->inc(Lbcp, bcp_incr);
   else                delayed()->nop();
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp	Thu May 11 16:17:31 2017 -0700
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp	Thu May 11 16:33:18 2017 +0200
@@ -156,7 +156,6 @@
 REGISTER_DECLARATION(Register, I5_savedSP       , I5); // Saved SP before bumping for locals.  This is simply
                                                        // a copy SP, so in 64-bit it's a biased value.  The bias
                                                        // is added and removed as needed in the frame code.
-REGISTER_DECLARATION(Register, IdispatchTables  , I4); // Base address of the bytecode dispatch tables
 REGISTER_DECLARATION(Register, IdispatchAddress , I3); // Register which saves the dispatch address for each bytecode
 REGISTER_DECLARATION(Register, ImethodDataPtr   , I2); // Pointer to the current method data
 
@@ -228,7 +227,6 @@
 #define O5_savedSP          AS_REGISTER(Register, O5_savedSP)
 #define IdispatchAddress    AS_REGISTER(Register, IdispatchAddress)
 #define ImethodDataPtr      AS_REGISTER(Register, ImethodDataPtr)
-#define IdispatchTables     AS_REGISTER(Register, IdispatchTables)
 
 #define Oexception          AS_REGISTER(Register, Oexception)
 #define Oissuing_pc         AS_REGISTER(Register, Oissuing_pc)
--- a/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp	Thu May 11 16:17:31 2017 -0700
+++ b/hotspot/src/cpu/sparc/vm/register_definitions_sparc.cpp	Thu May 11 16:33:18 2017 +0200
@@ -166,7 +166,6 @@
 REGISTER_DEFINITION(Register, O5_savedSP);
 REGISTER_DEFINITION(Register, IdispatchAddress);
 REGISTER_DEFINITION(Register, ImethodDataPtr);
-REGISTER_DEFINITION(Register, IdispatchTables);
 REGISTER_DEFINITION(Register, Lmethod);
 REGISTER_DEFINITION(Register, Llocals);
 REGISTER_DEFINITION(Register, Oexception);
--- a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp	Thu May 11 16:17:31 2017 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp	Thu May 11 16:33:18 2017 +0200
@@ -47,11 +47,6 @@
 #include "utilities/debug.hpp"
 #include "utilities/macros.hpp"
 
-#ifndef FAST_DISPATCH
-#define FAST_DISPATCH 1
-#endif
-#undef FAST_DISPATCH
-
 // Size of interpreter code.  Increase if too small.  Interpreter will
 // fail with a guarantee ("not enough space for interpreter generation");
 // if too small.
@@ -824,11 +819,6 @@
   __ sub(Gargs, BytesPerWord, Llocals);        // set Llocals
 
   if (ProfileInterpreter) {
-#ifdef FAST_DISPATCH
-    // FAST_DISPATCH and ProfileInterpreter are mutually exclusive since
-    // they both use I2.
-    assert(0, "FAST_DISPATCH and +ProfileInterpreter are mutually exclusive");
-#endif // FAST_DISPATCH
     __ set_method_data_pointer();
   }
 
@@ -1564,11 +1554,6 @@
 
   generate_fixed_frame(false);
 
-#ifdef FAST_DISPATCH
-  __ set((intptr_t)Interpreter::dispatch_table(), IdispatchTables);
-                                          // set bytecode dispatch table base
-#endif
-
   //
   // Code to initialize the extra (i.e. non-parm) locals
   //