< prev index next >

src/hotspot/share/opto/parse1.cpp

Print this page
@@ -1152,13 +1152,22 @@
  
    // clear current replaced nodes that are of no use from here on (map was cloned in build_exits).
    _caller->map()->delete_replaced_nodes();
  
    // If this is an inlined method, we may have to do a receiver null check.
-   if (_caller->has_method() && is_normal_parse() && !method()->is_static()) {
+   if (_caller->has_method() && is_normal_parse()) {
      GraphKit kit(_caller);
-     kit.null_check_receiver_before_call(method());
+     if (!method()->is_static()) {
+       kit.null_check_receiver_before_call(method());
+     } else if (C->do_clinit_barriers() && C->needs_clinit_barrier(method()->holder(), _caller->method())) {
+       ciMethod* declared_method = kit.method()->get_method_at_bci(kit.bci());
+       const int nargs = declared_method->arg_size();
+       kit.inc_sp(nargs);
+       Node* holder = makecon(TypeKlassPtr::make(method()->holder(), Type::trust_interfaces));
+       kit.guard_klass_is_initialized(holder);
+       kit.dec_sp(nargs);
+     }
      _caller = kit.transfer_exceptions_into_jvms();
      if (kit.stopped()) {
        _exits.add_exception_states_from(_caller);
        _exits.set_jvms(_caller);
        return nullptr;

@@ -2188,10 +2197,13 @@
    set_control( _gvn.transform(result_rgn) );
  }
  
  // Add check to deoptimize once holder klass is fully initialized.
  void Parse::clinit_deopt() {
+   if (method()->holder()->is_initialized()) {
+     return; // in case do_clinit_barriers() is true
+   }
    assert(C->has_method(), "only for normal compilations");
    assert(depth() == 1, "only for main compiled method");
    assert(is_normal_parse(), "no barrier needed on osr entry");
    assert(!method()->holder()->is_not_initialized(), "initialization should have been started");
  
< prev index next >