< prev index next >

src/hotspot/share/opto/parse3.cpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2018, 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  *


 122       return;
 123     }
 124   }
 125 
 126   ciType* field_klass = field->type();
 127   bool is_vol = field->is_volatile();
 128 
 129   // Compute address and memory type.
 130   int offset = field->offset_in_bytes();
 131   const TypePtr* adr_type = C->alias_type(field)->adr_type();
 132   Node *adr = basic_plus_adr(obj, obj, offset);
 133 
 134   // Build the resultant type of the load
 135   const Type *type;
 136 
 137   bool must_assert_null = false;
 138 
 139   DecoratorSet decorators = IN_HEAP;
 140   decorators |= is_vol ? MO_SEQ_CST : MO_UNORDERED;
 141 
 142   bool is_obj = bt == T_OBJECT || bt == T_ARRAY;
 143 
 144   if (is_obj) {
 145     if (!field->type()->is_loaded()) {
 146       type = TypeInstPtr::BOTTOM;
 147       must_assert_null = true;
 148     } else if (field->is_static_constant()) {
 149       // This can happen if the constant oop is non-perm.
 150       ciObject* con = field->constant_value().as_object();
 151       // Do not "join" in the previous type; it doesn't add value,
 152       // and may yield a vacuous result if the field is of interface type.
 153       if (con->is_null_object()) {
 154         type = TypePtr::NULL_PTR;
 155       } else {
 156         type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
 157       }
 158       assert(type != NULL, "field singleton type must be consistent");
 159     } else {
 160       type = TypeOopPtr::make_from_klass(field_klass->as_klass());
 161     }
 162   } else {


 193     set_bci(iter().next_bci());
 194     null_assert(peek());
 195     set_bci(iter().cur_bci()); // put it back
 196   }
 197 }
 198 
 199 void Parse::do_put_xxx(Node* obj, ciField* field, bool is_field) {
 200   bool is_vol = field->is_volatile();
 201 
 202   // Compute address and memory type.
 203   int offset = field->offset_in_bytes();
 204   const TypePtr* adr_type = C->alias_type(field)->adr_type();
 205   Node* adr = basic_plus_adr(obj, obj, offset);
 206   BasicType bt = field->layout_type();
 207   // Value to be stored
 208   Node* val = type2size[bt] == 1 ? pop() : pop_pair();
 209 
 210   DecoratorSet decorators = IN_HEAP;
 211   decorators |= is_vol ? MO_SEQ_CST : MO_UNORDERED;
 212 
 213   bool is_obj = bt == T_OBJECT || bt == T_ARRAY;
 214 
 215   // Store the value.
 216   const Type* field_type;
 217   if (!field->type()->is_loaded()) {
 218     field_type = TypeInstPtr::BOTTOM;
 219   } else {
 220     if (is_obj) {
 221       field_type = TypeOopPtr::make_from_klass(field->type()->as_klass());
 222     } else {
 223       field_type = Type::BOTTOM;
 224     }
 225   }
 226   access_store_at(obj, adr, adr_type, val, field_type, bt, decorators);
 227 
 228   if (is_field) {
 229     // Remember we wrote a volatile field.
 230     // For not multiple copy atomic cpu (ppc64) a barrier should be issued
 231     // in constructors which have such stores. See do_exits() in parse1.cpp.
 232     if (is_vol) {
 233       set_wrote_volatile(true);


   1 /*
   2  * Copyright (c) 1998, 2019, 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  *


 122       return;
 123     }
 124   }
 125 
 126   ciType* field_klass = field->type();
 127   bool is_vol = field->is_volatile();
 128 
 129   // Compute address and memory type.
 130   int offset = field->offset_in_bytes();
 131   const TypePtr* adr_type = C->alias_type(field)->adr_type();
 132   Node *adr = basic_plus_adr(obj, obj, offset);
 133 
 134   // Build the resultant type of the load
 135   const Type *type;
 136 
 137   bool must_assert_null = false;
 138 
 139   DecoratorSet decorators = IN_HEAP;
 140   decorators |= is_vol ? MO_SEQ_CST : MO_UNORDERED;
 141 
 142   bool is_obj = is_reference_type(bt);
 143 
 144   if (is_obj) {
 145     if (!field->type()->is_loaded()) {
 146       type = TypeInstPtr::BOTTOM;
 147       must_assert_null = true;
 148     } else if (field->is_static_constant()) {
 149       // This can happen if the constant oop is non-perm.
 150       ciObject* con = field->constant_value().as_object();
 151       // Do not "join" in the previous type; it doesn't add value,
 152       // and may yield a vacuous result if the field is of interface type.
 153       if (con->is_null_object()) {
 154         type = TypePtr::NULL_PTR;
 155       } else {
 156         type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
 157       }
 158       assert(type != NULL, "field singleton type must be consistent");
 159     } else {
 160       type = TypeOopPtr::make_from_klass(field_klass->as_klass());
 161     }
 162   } else {


 193     set_bci(iter().next_bci());
 194     null_assert(peek());
 195     set_bci(iter().cur_bci()); // put it back
 196   }
 197 }
 198 
 199 void Parse::do_put_xxx(Node* obj, ciField* field, bool is_field) {
 200   bool is_vol = field->is_volatile();
 201 
 202   // Compute address and memory type.
 203   int offset = field->offset_in_bytes();
 204   const TypePtr* adr_type = C->alias_type(field)->adr_type();
 205   Node* adr = basic_plus_adr(obj, obj, offset);
 206   BasicType bt = field->layout_type();
 207   // Value to be stored
 208   Node* val = type2size[bt] == 1 ? pop() : pop_pair();
 209 
 210   DecoratorSet decorators = IN_HEAP;
 211   decorators |= is_vol ? MO_SEQ_CST : MO_UNORDERED;
 212 
 213   bool is_obj = is_reference_type(bt);
 214 
 215   // Store the value.
 216   const Type* field_type;
 217   if (!field->type()->is_loaded()) {
 218     field_type = TypeInstPtr::BOTTOM;
 219   } else {
 220     if (is_obj) {
 221       field_type = TypeOopPtr::make_from_klass(field->type()->as_klass());
 222     } else {
 223       field_type = Type::BOTTOM;
 224     }
 225   }
 226   access_store_at(obj, adr, adr_type, val, field_type, bt, decorators);
 227 
 228   if (is_field) {
 229     // Remember we wrote a volatile field.
 230     // For not multiple copy atomic cpu (ppc64) a barrier should be issued
 231     // in constructors which have such stores. See do_exits() in parse1.cpp.
 232     if (is_vol) {
 233       set_wrote_volatile(true);


< prev index next >