changeset 50023:bdb627563075

8202640: Small C1 cleanups for BarrierSetC1 Reviewed-by: kvn, neliasso
author eosterlund
date Sat, 05 May 2018 22:19:19 +0200
parents 653343de5e7a
children 7238cb613dc5
files src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp src/hotspot/cpu/x86/c1_Runtime1_x86.cpp src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp src/hotspot/share/c1/c1_LIR.cpp src/hotspot/share/c1/c1_LIR.hpp
diffstat 6 files changed, 32 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp	Thu May 03 17:10:39 2018 +0200
+++ b/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp	Sat May 05 22:19:19 2018 +0200
@@ -236,12 +236,12 @@
 #define __ sasm->
 
 static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers = true) {
-  sasm->save_live_registers_no_oop_map(save_fpu_registers);
+  __ save_live_registers_no_oop_map(save_fpu_registers);
   return generate_oop_map(sasm, save_fpu_registers);
 }
 
 static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) {
-  sasm->restore_live_registers(restore_fpu_registers);
+  __ restore_live_registers(restore_fpu_registers);
 }
 
 
--- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp	Thu May 03 17:10:39 2018 +0200
+++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.hpp	Sat May 05 22:19:19 2018 +0200
@@ -123,7 +123,8 @@
 
   void load_parameter(int offset_in_words, Register reg);
 
-  void save_live_registers_no_oop_map(int num_rt_args, bool save_fpu_registers);
+  void save_live_registers_no_oop_map(bool save_fpu_registers);
+  void restore_live_registers_except_rax(bool restore_fpu_registers);
   void restore_live_registers(bool restore_fpu_registers);
 
 #endif // CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP
--- a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp	Thu May 03 17:10:39 2018 +0200
+++ b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp	Sat May 05 22:19:19 2018 +0200
@@ -411,7 +411,7 @@
 
 #define __ this->
 
-void C1_MacroAssembler::save_live_registers_no_oop_map(int num_rt_args, bool save_fpu_registers) {
+void C1_MacroAssembler::save_live_registers_no_oop_map(bool save_fpu_registers) {
   __ block_comment("save_live_registers");
 
   __ pusha();         // integer registers
@@ -551,23 +551,11 @@
   __ popa();
 }
 
-#undef __
-#define __ sasm->
 
-static OopMap* save_live_registers(StubAssembler* sasm, int num_rt_args,
-                                   bool save_fpu_registers = true) {
-  sasm->save_live_registers_no_oop_map(num_rt_args, save_fpu_registers);
-  return generate_oop_map(sasm, num_rt_args, save_fpu_registers);
-}
-
-static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) {
-  sasm->restore_live_registers(restore_fpu_registers);
-}
-
-static void restore_live_registers_except_rax(StubAssembler* sasm, bool restore_fpu_registers = true) {
+void C1_MacroAssembler::restore_live_registers_except_rax(bool restore_fpu_registers) {
   __ block_comment("restore_live_registers_except_rax");
 
-  restore_fpu(sasm, restore_fpu_registers);
+  restore_fpu(this, restore_fpu_registers);
 
 #ifdef _LP64
   __ movptr(r15, Address(rsp, 0));
@@ -600,6 +588,23 @@
 #endif // _LP64
 }
 
+#undef __
+#define __ sasm->
+
+static OopMap* save_live_registers(StubAssembler* sasm, int num_rt_args,
+                                   bool save_fpu_registers = true) {
+  __ save_live_registers_no_oop_map(save_fpu_registers);
+  return generate_oop_map(sasm, num_rt_args, save_fpu_registers);
+}
+
+static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) {
+  __ restore_live_registers(restore_fpu_registers);
+}
+
+static void restore_live_registers_except_rax(StubAssembler* sasm, bool restore_fpu_registers = true) {
+  sasm->restore_live_registers_except_rax(restore_fpu_registers);
+}
+
 
 void Runtime1::initialize_pd() {
   // nothing to do
--- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp	Thu May 03 17:10:39 2018 +0200
+++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp	Sat May 05 22:19:19 2018 +0200
@@ -496,7 +496,7 @@
 
   __ bind(runtime);
 
-  __ save_live_registers_no_oop_map(3, true);
+  __ save_live_registers_no_oop_map(true);
 
   // load the pre-value
   __ load_parameter(0, rcx);
@@ -575,7 +575,7 @@
 
   __ bind(runtime);
 
-  __ save_live_registers_no_oop_map(3, true);
+  __ save_live_registers_no_oop_map(true);
 
   __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
 
--- a/src/hotspot/share/c1/c1_LIR.cpp	Thu May 03 17:10:39 2018 +0200
+++ b/src/hotspot/share/c1/c1_LIR.cpp	Sat May 05 22:19:19 2018 +0200
@@ -917,10 +917,13 @@
       break;
     }
   default:
-    ShouldNotReachHere();
+    op->visit(this);
   }
 }
 
+void LIR_Op::visit(LIR_OpVisitState* state) {
+  ShouldNotReachHere();
+}
 
 void LIR_OpVisitState::do_stub(CodeStub* stub) {
   if (stub != NULL) {
--- a/src/hotspot/share/c1/c1_LIR.hpp	Thu May 03 17:10:39 2018 +0200
+++ b/src/hotspot/share/c1/c1_LIR.hpp	Sat May 05 22:19:19 2018 +0200
@@ -1096,6 +1096,7 @@
 #endif
 
   virtual const char * name() const PRODUCT_RETURN0;
+  virtual void visit(LIR_OpVisitState* state);
 
   int id()             const                  { return _id;     }
   void set_id(int id)                         { _id = id; }
@@ -1983,6 +1984,7 @@
   int           _line;
 #endif
 
+ public:
   void append(LIR_Op* op) {
     if (op->source() == NULL)
       op->set_source(_compilation->current_instruction());
@@ -2003,7 +2005,6 @@
 #endif
   }
 
- public:
   LIR_List(Compilation* compilation, BlockBegin* block = NULL);
 
 #ifdef ASSERT