hotspot/src/share/vm/opto/memnode.cpp
changeset 2150 0d91d17158cc
parent 2131 98f9cef66a34
child 2154 72a9b7284ccf
equal deleted inserted replaced
2149:3d362637b307 2150:0d91d17158cc
     1 /*
     1 /*
     2  * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   776          "use LoadKlassNode instead");
   776          "use LoadKlassNode instead");
   777   assert(!(adr_type->isa_aryptr() &&
   777   assert(!(adr_type->isa_aryptr() &&
   778            adr_type->offset() == arrayOopDesc::length_offset_in_bytes()),
   778            adr_type->offset() == arrayOopDesc::length_offset_in_bytes()),
   779          "use LoadRangeNode instead");
   779          "use LoadRangeNode instead");
   780   switch (bt) {
   780   switch (bt) {
   781   case T_BOOLEAN:
   781   case T_BOOLEAN: return new (C, 3) LoadUBNode(ctl, mem, adr, adr_type, rt->is_int()    );
   782   case T_BYTE:    return new (C, 3) LoadBNode (ctl, mem, adr, adr_type, rt->is_int()    );
   782   case T_BYTE:    return new (C, 3) LoadBNode (ctl, mem, adr, adr_type, rt->is_int()    );
   783   case T_INT:     return new (C, 3) LoadINode (ctl, mem, adr, adr_type, rt->is_int()    );
   783   case T_INT:     return new (C, 3) LoadINode (ctl, mem, adr, adr_type, rt->is_int()    );
   784   case T_CHAR:    return new (C, 3) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int()    );
   784   case T_CHAR:    return new (C, 3) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int()    );
   785   case T_SHORT:   return new (C, 3) LoadSNode (ctl, mem, adr, adr_type, rt->is_int()    );
   785   case T_SHORT:   return new (C, 3) LoadSNode (ctl, mem, adr, adr_type, rt->is_int()    );
   786   case T_LONG:    return new (C, 3) LoadLNode (ctl, mem, adr, adr_type, rt->is_long()   );
   786   case T_LONG:    return new (C, 3) LoadLNode (ctl, mem, adr, adr_type, rt->is_long()   );
  1614   }
  1614   }
  1615   // Identity call will handle the case where truncation is not needed.
  1615   // Identity call will handle the case where truncation is not needed.
  1616   return LoadNode::Ideal(phase, can_reshape);
  1616   return LoadNode::Ideal(phase, can_reshape);
  1617 }
  1617 }
  1618 
  1618 
       
  1619 //--------------------------LoadUBNode::Ideal-------------------------------------
       
  1620 //
       
  1621 //  If the previous store is to the same address as this load,
       
  1622 //  and the value stored was larger than a byte, replace this load
       
  1623 //  with the value stored truncated to a byte.  If no truncation is
       
  1624 //  needed, the replacement is done in LoadNode::Identity().
       
  1625 //
       
  1626 Node* LoadUBNode::Ideal(PhaseGVN* phase, bool can_reshape) {
       
  1627   Node* mem = in(MemNode::Memory);
       
  1628   Node* value = can_see_stored_value(mem, phase);
       
  1629   if (value && !phase->type(value)->higher_equal(_type))
       
  1630     return new (phase->C, 3) AndINode(value, phase->intcon(0xFF));
       
  1631   // Identity call will handle the case where truncation is not needed.
       
  1632   return LoadNode::Ideal(phase, can_reshape);
       
  1633 }
       
  1634 
  1619 //--------------------------LoadUSNode::Ideal-------------------------------------
  1635 //--------------------------LoadUSNode::Ideal-------------------------------------
  1620 //
  1636 //
  1621 //  If the previous store is to the same address as this load,
  1637 //  If the previous store is to the same address as this load,
  1622 //  and the value stored was larger than a char, replace this load
  1638 //  and the value stored was larger than a char, replace this load
  1623 //  with the value stored truncated to a char.  If no truncation is
  1639 //  with the value stored truncated to a char.  If no truncation is