< prev index next >

src/share/vm/opto/parseHelper.cpp

Print this page


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


 266 
 267   PreserveJVMState pjvms(this);
 268   record_for_igvn(merge);
 269   set_control(merge);
 270 
 271   uncommon_trap(Deoptimization::Reason_uninitialized,
 272                 Deoptimization::Action_reinterpret,
 273                 klass);
 274 }
 275 
 276 
 277 //------------------------------do_new-----------------------------------------
 278 void Parse::do_new() {
 279   kill_dead_locals();
 280 
 281   bool will_link;
 282   ciInstanceKlass* klass = iter().get_klass(will_link)->as_instance_klass();
 283   assert(will_link, "_new: typeflow responsibility");
 284 
 285   // Should initialize, or throw an InstantiationError?
 286   if (!klass->is_initialized() && !klass->is_being_initialized() ||
 287       klass->is_abstract() || klass->is_interface() ||
 288       klass->name() == ciSymbol::java_lang_Class() ||
 289       iter().is_unresolved_klass()) {
 290     uncommon_trap(Deoptimization::Reason_uninitialized,
 291                   Deoptimization::Action_reinterpret,
 292                   klass);
 293     return;
 294   }
 295   if (klass->is_being_initialized()) {
 296     emit_guard_for_new(klass);
 297   }
 298 
 299   Node* kls = makecon(TypeKlassPtr::make(klass));
 300   Node* obj = new_instance(kls);
 301 
 302   // Push resultant oop onto stack
 303   push(obj);
 304 
 305   // Keep track of whether opportunities exist for StringBuilder
 306   // optimizations.


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


 266 
 267   PreserveJVMState pjvms(this);
 268   record_for_igvn(merge);
 269   set_control(merge);
 270 
 271   uncommon_trap(Deoptimization::Reason_uninitialized,
 272                 Deoptimization::Action_reinterpret,
 273                 klass);
 274 }
 275 
 276 
 277 //------------------------------do_new-----------------------------------------
 278 void Parse::do_new() {
 279   kill_dead_locals();
 280 
 281   bool will_link;
 282   ciInstanceKlass* klass = iter().get_klass(will_link)->as_instance_klass();
 283   assert(will_link, "_new: typeflow responsibility");
 284 
 285   // Should initialize, or throw an InstantiationError?
 286   if ((!klass->is_initialized() && !klass->is_being_initialized()) ||
 287       klass->is_abstract() || klass->is_interface() ||
 288       klass->name() == ciSymbol::java_lang_Class() ||
 289       iter().is_unresolved_klass()) {
 290     uncommon_trap(Deoptimization::Reason_uninitialized,
 291                   Deoptimization::Action_reinterpret,
 292                   klass);
 293     return;
 294   }
 295   if (klass->is_being_initialized()) {
 296     emit_guard_for_new(klass);
 297   }
 298 
 299   Node* kls = makecon(TypeKlassPtr::make(klass));
 300   Node* obj = new_instance(kls);
 301 
 302   // Push resultant oop onto stack
 303   push(obj);
 304 
 305   // Keep track of whether opportunities exist for StringBuilder
 306   // optimizations.


< prev index next >