src/share/vm/adlc/output_c.cpp

changeset 548
ba764ed4b6f2
parent 435
a61af66fc99e
child 631
d1605aabd0a1
     1.1 --- a/src/share/vm/adlc/output_c.cpp	Fri Apr 11 09:56:35 2008 -0400
     1.2 +++ b/src/share/vm/adlc/output_c.cpp	Sun Apr 13 17:43:42 2008 -0400
     1.3 @@ -1546,6 +1546,18 @@
     1.4  
     1.5      // Build a mapping from operand index to input edges
     1.6      fprintf(fp,"  unsigned idx0 = oper_input_base();\n");
     1.7 +
     1.8 +    // The order in which inputs are added to a node is very
     1.9 +    // strange.  Store nodes get a memory input before Expand is
    1.10 +    // called and all other nodes get it afterwards so
    1.11 +    // oper_input_base is wrong during expansion.  This code adjusts
    1.12 +    // is so that expansion will work correctly.
    1.13 +    bool missing_memory_edge = node->_matrule->needs_ideal_memory_edge(_globalNames) &&
    1.14 +                               node->is_ideal_store() == Form::none;
    1.15 +    if (missing_memory_edge) {
    1.16 +      fprintf(fp,"  idx0--; // Adjust base because memory edge hasn't been inserted yet\n");
    1.17 +    }
    1.18 +
    1.19      for( i = 0; i < node->num_opnds(); i++ ) {
    1.20        fprintf(fp,"  unsigned idx%d = idx%d + num%d;\n",
    1.21                i+1,i,i);
    1.22 @@ -1600,8 +1612,10 @@
    1.23          int node_mem_op = node->memory_operand(_globalNames);
    1.24          assert( node_mem_op != InstructForm::NO_MEMORY_OPERAND,
    1.25                  "expand rule member needs memory but top-level inst doesn't have any" );
    1.26 -        // Copy memory edge
    1.27 -        fprintf(fp,"  n%d->add_req(_in[1]);\t// Add memory edge\n", cnt);
    1.28 +        if (!missing_memory_edge) {
    1.29 +          // Copy memory edge
    1.30 +          fprintf(fp,"  n%d->add_req(_in[1]);\t// Add memory edge\n", cnt);
    1.31 +        }
    1.32        }
    1.33  
    1.34        // Iterate over the new instruction's operands
    1.35 @@ -2363,6 +2377,8 @@
    1.36    fprintf(fp,"uint  %sNode::size(PhaseRegAlloc *ra_) const {\n",
    1.37            inst._ident);
    1.38  
    1.39 +  fprintf(fp, " assert(VerifyOops || MachNode::size(ra_) <= %s, \"bad fixed size\");\n", inst._size);
    1.40 +
    1.41    //(2)
    1.42    // Print the size
    1.43    fprintf(fp, " return (VerifyOops ? MachNode::size(ra_) : %s);\n", inst._size);
    1.44 @@ -3426,6 +3442,8 @@
    1.45        fprintf(fp, "_leaf->get_int()");
    1.46      } else if ( (strcmp(optype,"ConP") == 0) ) {
    1.47        fprintf(fp, "_leaf->bottom_type()->is_ptr()");
    1.48 +    } else if ( (strcmp(optype,"ConN") == 0) ) {
    1.49 +      fprintf(fp, "_leaf->bottom_type()->is_narrowoop()");
    1.50      } else if ( (strcmp(optype,"ConF") == 0) ) {
    1.51        fprintf(fp, "_leaf->getf()");
    1.52      } else if ( (strcmp(optype,"ConD") == 0) ) {

mercurial