8209651: better TLS poll for x64 C2
authordlong
Wed, 22 Aug 2018 13:53:48 -0700
changeset 51501 535cce23fa8b
parent 51500 63b3d7989fde
child 51502 b5ca7ff199db
8209651: better TLS poll for x64 C2 Reviewed-by: kvn
src/hotspot/cpu/x86/x86_64.ad
--- a/src/hotspot/cpu/x86/x86_64.ad	Wed Aug 22 21:48:39 2018 +0200
+++ b/src/hotspot/cpu/x86/x86_64.ad	Wed Aug 22 13:53:48 2018 -0700
@@ -317,18 +317,6 @@
 // Singleton class for TLS pointer
 reg_class ptr_r15_reg(R15, R15_H);
 
-// The registers which can be used for
-// a thread local safepoint poll
-// * R12 is reserved for heap base
-// * R13 cannot be encoded for addressing without an offset byte
-// * R15 is reserved for the JavaThread
-reg_class ptr_rex_reg(R8,  R8_H,
-                      R9,  R9_H,
-                      R10, R10_H,
-                      R11, R11_H,
-                      R14, R14_H);
-
-
 // Class for all long registers (excluding RSP)
 reg_class long_reg_with_rbp(RAX, RAX_H,
                             RDX, RDX_H,
@@ -3557,16 +3545,6 @@
   interface(REG_INTER);
 %}
 
-operand rex_RegP()
-%{
-  constraint(ALLOC_IN_RC(ptr_rex_reg));
-  match(RegP);
-  match(rRegP);
-
-  format %{ %}
-  interface(REG_INTER);
-%}
-
 operand rRegL()
 %{
   constraint(ALLOC_IN_RC(long_reg));
@@ -12360,7 +12338,7 @@
   ins_pipe(ialu_reg_mem);
 %}
 
-instruct safePoint_poll_tls(rFlagsReg cr, rex_RegP poll)
+instruct safePoint_poll_tls(rFlagsReg cr, rRegP poll)
 %{
   predicate(SafepointMechanism::uses_thread_local_poll());
   match(SafePoint poll);
@@ -12369,13 +12347,12 @@
   format %{ "testl  rax, [$poll]\t"
             "# Safepoint: poll for GC" %}
   ins_cost(125);
-  size(3); /* setting an explicit size will cause debug builds to assert if size is incorrect */
+  size(4); /* setting an explicit size will cause debug builds to assert if size is incorrect */
   ins_encode %{
     __ relocate(relocInfo::poll_type);
     address pre_pc = __ pc();
     __ testl(rax, Address($poll$$Register, 0));
-    address post_pc = __ pc();
-    guarantee(pre_pc[0] == 0x41 && pre_pc[1] == 0x85, "must emit #rex test-ax [reg]");
+    assert(nativeInstruction_at(pre_pc)->is_safepoint_poll(), "must emit test %%eax [reg]");
   %}
   ins_pipe(ialu_reg_mem);
 %}