src/share/vm/opto/memnode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7119644 Sdiff src/share/vm/opto

src/share/vm/opto/memnode.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1510 
1511   // Try to guess loaded type from pointer type
1512   if (tp->base() == Type::AryPtr) {
1513     const Type *t = tp->is_aryptr()->elem();
1514     // Don't do this for integer types. There is only potential profit if
1515     // the element type t is lower than _type; that is, for int types, if _type is
1516     // more restrictive than t.  This only happens here if one is short and the other
1517     // char (both 16 bits), and in those cases we've made an intentional decision
1518     // to use one kind of load over the other. See AndINode::Ideal and 4965907.
1519     // Also, do not try to narrow the type for a LoadKlass, regardless of offset.
1520     //
1521     // Yes, it is possible to encounter an expression like (LoadKlass p1:(AddP x x 8))
1522     // where the _gvn.type of the AddP is wider than 8.  This occurs when an earlier
1523     // copy p0 of (AddP x x 8) has been proven equal to p1, and the p0 has been
1524     // subsumed by p1.  If p1 is on the worklist but has not yet been re-transformed,
1525     // it is possible that p1 will have a type like Foo*[int+]:NotNull*+any.
1526     // In fact, that could have been the original type of p1, and p1 could have
1527     // had an original form like p1:(AddP x x (LShiftL quux 3)), where the
1528     // expression (LShiftL quux 3) independently optimized to the constant 8.
1529     if ((t->isa_int() == NULL) && (t->isa_long() == NULL)

1530         && Opcode() != Op_LoadKlass && Opcode() != Op_LoadNKlass) {
1531       // t might actually be lower than _type, if _type is a unique
1532       // concrete subclass of abstract class t.
1533       // Make sure the reference is not into the header, by comparing
1534       // the offset against the offset of the start of the array's data.
1535       // Different array types begin at slightly different offsets (12 vs. 16).
1536       // We choose T_BYTE as an example base type that is least restrictive
1537       // as to alignment, which will therefore produce the smallest
1538       // possible base offset.
1539       const int min_base_off = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1540       if ((uint)off >= (uint)min_base_off) {  // is the offset beyond the header?
1541         const Type* jt = t->join(_type);
1542         // In any case, do not allow the join, per se, to empty out the type.
1543         if (jt->empty() && !t->empty()) {
1544           // This can happen if a interface-typed array narrows to a class type.
1545           jt = _type;
1546         }
1547 
1548         if (EliminateAutoBox && adr->is_AddP()) {
1549           // The pointers in the autobox arrays are always non-null


   1 /*
   2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1510 
1511   // Try to guess loaded type from pointer type
1512   if (tp->base() == Type::AryPtr) {
1513     const Type *t = tp->is_aryptr()->elem();
1514     // Don't do this for integer types. There is only potential profit if
1515     // the element type t is lower than _type; that is, for int types, if _type is
1516     // more restrictive than t.  This only happens here if one is short and the other
1517     // char (both 16 bits), and in those cases we've made an intentional decision
1518     // to use one kind of load over the other. See AndINode::Ideal and 4965907.
1519     // Also, do not try to narrow the type for a LoadKlass, regardless of offset.
1520     //
1521     // Yes, it is possible to encounter an expression like (LoadKlass p1:(AddP x x 8))
1522     // where the _gvn.type of the AddP is wider than 8.  This occurs when an earlier
1523     // copy p0 of (AddP x x 8) has been proven equal to p1, and the p0 has been
1524     // subsumed by p1.  If p1 is on the worklist but has not yet been re-transformed,
1525     // it is possible that p1 will have a type like Foo*[int+]:NotNull*+any.
1526     // In fact, that could have been the original type of p1, and p1 could have
1527     // had an original form like p1:(AddP x x (LShiftL quux 3)), where the
1528     // expression (LShiftL quux 3) independently optimized to the constant 8.
1529     if ((t->isa_int() == NULL) && (t->isa_long() == NULL) 
1530         && (_type->isa_vect() == NULL)
1531         && Opcode() != Op_LoadKlass && Opcode() != Op_LoadNKlass) {
1532       // t might actually be lower than _type, if _type is a unique
1533       // concrete subclass of abstract class t.
1534       // Make sure the reference is not into the header, by comparing
1535       // the offset against the offset of the start of the array's data.
1536       // Different array types begin at slightly different offsets (12 vs. 16).
1537       // We choose T_BYTE as an example base type that is least restrictive
1538       // as to alignment, which will therefore produce the smallest
1539       // possible base offset.
1540       const int min_base_off = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1541       if ((uint)off >= (uint)min_base_off) {  // is the offset beyond the header?
1542         const Type* jt = t->join(_type);
1543         // In any case, do not allow the join, per se, to empty out the type.
1544         if (jt->empty() && !t->empty()) {
1545           // This can happen if a interface-typed array narrows to a class type.
1546           jt = _type;
1547         }
1548 
1549         if (EliminateAutoBox && adr->is_AddP()) {
1550           // The pointers in the autobox arrays are always non-null


src/share/vm/opto/memnode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File