diff src/share/vm/adlc/formssel.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 89152779163c 78bbf4d43a14
children
line wrap: on
line diff
--- a/src/share/vm/adlc/formssel.cpp	Thu Oct 16 10:21:29 2014 +0200
+++ b/src/share/vm/adlc/formssel.cpp	Wed Oct 15 16:02:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,31 +32,33 @@
     _localNames(cmpstr, hashstr, Form::arena),
     _effects(cmpstr, hashstr, Form::arena),
     _is_mach_constant(false),
+    _needs_constant_base(false),
     _has_call(false)
 {
       _ftype = Form::INS;
 
-      _matrule   = NULL;
-      _insencode = NULL;
-      _constant  = NULL;
-      _opcode    = NULL;
-      _size      = NULL;
-      _attribs   = NULL;
-      _predicate = NULL;
-      _exprule   = NULL;
-      _rewrule   = NULL;
-      _format    = NULL;
-      _peephole  = NULL;
-      _ins_pipe  = NULL;
-      _uniq_idx  = NULL;
-      _num_uniq  = 0;
-      _cisc_spill_operand = Not_cisc_spillable;// Which operand may cisc-spill
+      _matrule              = NULL;
+      _insencode            = NULL;
+      _constant             = NULL;
+      _is_postalloc_expand  = false;
+      _opcode               = NULL;
+      _size                 = NULL;
+      _attribs              = NULL;
+      _predicate            = NULL;
+      _exprule              = NULL;
+      _rewrule              = NULL;
+      _format               = NULL;
+      _peephole             = NULL;
+      _ins_pipe             = NULL;
+      _uniq_idx             = NULL;
+      _num_uniq             = 0;
+      _cisc_spill_operand   = Not_cisc_spillable;// Which operand may cisc-spill
       _cisc_spill_alternate = NULL;            // possible cisc replacement
-      _cisc_reg_mask_name = NULL;
-      _is_cisc_alternate = false;
-      _is_short_branch = false;
-      _short_branch_form = NULL;
-      _alignment = 1;
+      _cisc_reg_mask_name   = NULL;
+      _is_cisc_alternate    = false;
+      _is_short_branch      = false;
+      _short_branch_form    = NULL;
+      _alignment            = 1;
 }
 
 InstructForm::InstructForm(const char *id, InstructForm *instr, MatchRule *rule)
@@ -64,31 +66,33 @@
     _localNames(instr->_localNames),
     _effects(instr->_effects),
     _is_mach_constant(false),
+    _needs_constant_base(false),
     _has_call(false)
 {
       _ftype = Form::INS;
 
-      _matrule   = rule;
-      _insencode = instr->_insencode;
-      _constant  = instr->_constant;
-      _opcode    = instr->_opcode;
-      _size      = instr->_size;
-      _attribs   = instr->_attribs;
-      _predicate = instr->_predicate;
-      _exprule   = instr->_exprule;
-      _rewrule   = instr->_rewrule;
-      _format    = instr->_format;
-      _peephole  = instr->_peephole;
-      _ins_pipe  = instr->_ins_pipe;
-      _uniq_idx  = instr->_uniq_idx;
-      _num_uniq  = instr->_num_uniq;
-      _cisc_spill_operand = Not_cisc_spillable;// Which operand may cisc-spill
-      _cisc_spill_alternate = NULL;            // possible cisc replacement
-      _cisc_reg_mask_name = NULL;
-      _is_cisc_alternate = false;
-      _is_short_branch = false;
-      _short_branch_form = NULL;
-      _alignment = 1;
+      _matrule               = rule;
+      _insencode             = instr->_insencode;
+      _constant              = instr->_constant;
+      _is_postalloc_expand   = instr->_is_postalloc_expand;
+      _opcode                = instr->_opcode;
+      _size                  = instr->_size;
+      _attribs               = instr->_attribs;
+      _predicate             = instr->_predicate;
+      _exprule               = instr->_exprule;
+      _rewrule               = instr->_rewrule;
+      _format                = instr->_format;
+      _peephole              = instr->_peephole;
+      _ins_pipe              = instr->_ins_pipe;
+      _uniq_idx              = instr->_uniq_idx;
+      _num_uniq              = instr->_num_uniq;
+      _cisc_spill_operand    = Not_cisc_spillable; // Which operand may cisc-spill
+      _cisc_spill_alternate  = NULL;               // possible cisc replacement
+      _cisc_reg_mask_name    = NULL;
+      _is_cisc_alternate     = false;
+      _is_short_branch       = false;
+      _short_branch_form     = NULL;
+      _alignment             = 1;
      // Copy parameters
      const char *name;
      instr->_parameters.reset();
@@ -157,6 +161,11 @@
   return ( _exprule != NULL );
 }
 
+// This instruction has a late expand rule?
+bool InstructForm::postalloc_expands() const {
+  return _is_postalloc_expand;
+}
+
 // This instruction has a peephole rule?
 Peephole *InstructForm::peepholes() const {
   return _peephole;
@@ -639,6 +648,8 @@
   if( strcmp(_matrule->_opType,"MemBarReleaseLock") == 0 ) return true;
   if( strcmp(_matrule->_opType,"MemBarAcquireLock") == 0 ) return true;
   if( strcmp(_matrule->_opType,"MemBarStoreStore") == 0 ) return true;
+  if( strcmp(_matrule->_opType,"StoreFence") == 0 ) return true;
+  if( strcmp(_matrule->_opType,"LoadFence") == 0 ) return true;
 
   return false;
 }
@@ -649,6 +660,7 @@
   int USE_of_memory  = 0;
   int DEF_of_memory  = 0;
   const char*    last_memory_DEF = NULL; // to test DEF/USE pairing in asserts
+  const char*    last_memory_USE = NULL;
   Component     *unique          = NULL;
   Component     *comp            = NULL;
   ComponentList &components      = (ComponentList &)_components;
@@ -670,7 +682,16 @@
           assert(0 == strcmp(last_memory_DEF, comp->_name), "every memory DEF is followed by a USE of the same name");
           last_memory_DEF = NULL;
         }
-        USE_of_memory++;
+        // Handles same memory being used multiple times in the case of BMI1 instructions.
+        if (last_memory_USE != NULL) {
+          if (strcmp(comp->_name, last_memory_USE) != 0) {
+            USE_of_memory++;
+          }
+        } else {
+          USE_of_memory++;
+        }
+        last_memory_USE = comp->_name;
+
         if (DEF_of_memory == 0)  // defs take precedence
           unique = comp;
       } else {
@@ -1269,11 +1290,11 @@
     return;
   }
   if (strcmp(rep_var, "constantoffset") == 0) {
-    fprintf(fp, "st->print(\"#%%d\", constant_offset());\n");
+    fprintf(fp, "st->print(\"#%%d\", constant_offset_unchecked());\n");
     return;
   }
   if (strcmp(rep_var, "constantaddress") == 0) {
-    fprintf(fp, "st->print(\"constant table base + #%%d\", constant_offset());\n");
+    fprintf(fp, "st->print(\"constant table base + #%%d\", constant_offset_unchecked());\n");
     return;
   }
 
@@ -1301,7 +1322,7 @@
     OperandForm* oper = form->is_operand();
     if (oper != NULL && oper->is_bound_register()) {
       const RegDef* first = oper->get_RegClass()->find_first_elem();
-      fprintf(fp, "    st->print(\"%s\");\n", first->_regname);
+      fprintf(fp, "    st->print_raw(\"%s\");\n", first->_regname);
     } else {
       globalAD->syntax_err(_linenum, "In %s can't find format for %s %s", _ident, opc->_ident, rep_var);
     }
@@ -2509,7 +2530,7 @@
   case Form::idealP: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
   case Form::idealNKlass:
   case Form::idealN: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
-  case Form::idealL: fprintf(fp,"  st->print(\"#%%lld\", _c%d);\n", const_index); break;
+  case Form::idealL: fprintf(fp,"  st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", const_index); break;
   case Form::idealF: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
   case Form::idealD: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
   default:
@@ -4045,13 +4066,15 @@
 bool MatchRule::is_ideal_membar() const {
   if( !_opType ) return false;
   return
-    !strcmp(_opType,"MemBarAcquire"  ) ||
-    !strcmp(_opType,"MemBarRelease"  ) ||
+    !strcmp(_opType,"MemBarAcquire") ||
+    !strcmp(_opType,"MemBarRelease") ||
     !strcmp(_opType,"MemBarAcquireLock") ||
     !strcmp(_opType,"MemBarReleaseLock") ||
-    !strcmp(_opType,"MemBarVolatile" ) ||
-    !strcmp(_opType,"MemBarCPUOrder" ) ||
-    !strcmp(_opType,"MemBarStoreStore" );
+    !strcmp(_opType,"LoadFence" ) ||
+    !strcmp(_opType,"StoreFence") ||
+    !strcmp(_opType,"MemBarVolatile") ||
+    !strcmp(_opType,"MemBarCPUOrder") ||
+    !strcmp(_opType,"MemBarStoreStore");
 }
 
 bool MatchRule::is_ideal_loadPC() const {