< prev index next >

src/share/vm/adlc/archDesc.cpp

Print this page

        

@@ -148,11 +148,11 @@
     _chainRules(cmpstr,hashstr, Form::arena),
     _cisc_spill_operand(NULL),
     _needs_clone_jvms(false) {
 
       // Initialize the opcode to MatchList table with NULLs
-      for( int i=0; i<_last_opcode; ++i ) {
+      for(uint i = 0; i < static_cast<uint>(Opcodes::_last_opcode); ++i ) {
         _mlistab[i] = NULL;
       }
 
       // Set-up the global tables
       initKeywords(_globalNames);    // Initialize the Name Table with keywords

@@ -172,11 +172,11 @@
       _internalOpCounter = 0;
       _cisc_spill_debug  = false;
       _short_branch_debug = false;
 
       // Initialize match rule flags
-      for (int i = 0; i < _last_opcode; i++) {
+      for (uint i = 0; i < static_cast<uint>(Opcodes::_last_opcode); i++) {
         _has_match_rule[i] = false;
       }
 
       // Error/Warning Counts
       _syntax_errs       = 0;

@@ -471,24 +471,25 @@
   if ( mrule->is_chain_rule(_globalNames) ) {
     return;
   }
 
   // Identify index position among ideal operands
-  intptr_t    index     = _last_opcode;
+  intptr_t    index     = static_cast<intptr_t>(Opcodes::_last_opcode);
   const char  *indexStr  = getMatchListIndex(*mrule);
   index  = (intptr_t)_idealIndex[indexStr];
   if (index == 0) {
     fprintf(stderr, "Ideal node missing: %s\n", indexStr);
     assert(index != 0, "Failed lookup of ideal node\n");
   }
 
   // Check that this will be placed appropriately in the DFA
-  if (index >= _last_opcode) {
+  if (index >= static_cast<intptr_t>(Opcodes::_last_opcode)) {
     fprintf(stderr, "Invalid match rule %s <-- ( %s )\n",
             resultStr ? resultStr : " ",
             rootOp    ? rootOp    : " ");
-    assert(index < _last_opcode, "Matching item not in ideal graph\n");
+    assert(index < static_cast<intptr_t>(Opcodes::_last_opcode),
+                                        "Matching item not in ideal graph\n");
     return;
   }
 
 
   // Walk the MatchRule, generating MatchList entries for each level

@@ -541,11 +542,11 @@
       (!form->ideal_only())) {
     return;
   }
 
   // Identify index position among ideal operands
-  intptr_t    index     = _last_opcode;
+  intptr_t    index     = static_cast<intptr_t>(Opcodes::_last_opcode);
   const char *indexStr  = node ? node->_opType : (char *) " ";
   index            = (intptr_t)_idealIndex[indexStr];
   if (index == 0) {
     fprintf(stderr, "error: operand \"%s\" not found\n", indexStr);
     assert(0, "fatal error");

@@ -967,16 +968,17 @@
 
 
 // Import predefined base types: Set = 1, RegI, RegP, ...
 void ArchDesc::initBaseOpTypes() {
   // Create OperandForm and assign type for each opcode.
-  for (int i = 1; i < _last_machine_leaf; ++i) {
+  for (uint i = 1; i < static_cast<uint>(Opcodes::_last_machine_leaf); ++i) {
     char *ident = (char *)NodeClassNames[i];
     constructOperand(ident, true);
   }
   // Create InstructForm and assign type for each ideal instruction.
-  for (int j = _last_machine_leaf+1; j < _last_opcode; ++j) {
+  for (uint j = static_cast<uint>(Opcodes::_last_machine_leaf) + 1;
+                           j < static_cast<uint>(Opcodes::_last_opcode); ++j) {
     char *ident = (char *)NodeClassNames[j];
     if (!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
         !strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
         !strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
         !strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||

@@ -1046,17 +1048,19 @@
     _globalNames.Insert(ident, eForm);
   }
 
   //
   // Build mapping from ideal names to ideal indices
-  int idealIndex = 0;
-  for (idealIndex = 1; idealIndex < _last_machine_leaf; ++idealIndex) {
+  uint idealIndex = 0;
+  for (idealIndex = 1;
+       idealIndex < static_cast<uint>(Opcodes::_last_machine_leaf);
+       ++idealIndex) {
     const char *idealName = NodeClassNames[idealIndex];
     _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
   }
-  for (idealIndex = _last_machine_leaf+1;
-       idealIndex < _last_opcode; ++idealIndex) {
+  for (idealIndex = static_cast<uint>(Opcodes::_last_machine_leaf) + 1;
+       idealIndex < static_cast<uint>(Opcodes::_last_opcode); ++idealIndex) {
     const char *idealName = NodeClassNames[idealIndex];
     _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
   }
 
 }

@@ -1153,11 +1157,12 @@
 
   // Build mapping from ideal names to ideal indices
   fprintf(fp_cpp, "\n");
   fprintf(fp_cpp, "// Mapping from machine-independent opcode to boolean\n");
   fprintf(fp_cpp, "const        char must_clone[] = {\n");
-  for (int idealIndex = 0; idealIndex < _last_opcode; ++idealIndex) {
+  for (uint idealIndex = 0;
+         idealIndex < static_cast<uint>(Opcodes::_last_opcode); ++idealIndex) {
     int         must_clone = 0;
     const char *idealName = NodeClassNames[idealIndex];
     // Previously selected constants for cloning
     // !!!!!
     // These are the current machine-dependent clones

@@ -1183,11 +1188,11 @@
       // instruction.  The must_clone flag prevents the constant from
       // floating up out of loops.
       must_clone = 1;
     }
     fprintf(fp_cpp, "  %d%s // %s: %d\n", must_clone,
-      (idealIndex != (_last_opcode - 1)) ? "," : " // no trailing comma",
+      (idealIndex != (static_cast<uint>(Opcodes::_last_opcode) - 1)) ? "," : " // no trailing comma",
       idealName, idealIndex);
   }
   // Finish defining table
   fprintf(fp_cpp, "};\n");
 }
< prev index next >