< prev index next >

src/hotspot/share/opto/compile.cpp

Print this page
@@ -633,10 +633,11 @@
                    _igv_idx(0),
                    _trace_opto_output(directive->TraceOptoOutputOption),
  #endif
                    _has_method_handle_invokes(false),
                    _clinit_barrier_on_entry(false),
+                   _has_clinit_barriers(false),
                    _stress_seed(0),
                    _comp_arena(mtCompiler),
                    _barrier_set_state(BarrierSet::barrier_set()->barrier_set_c2()->create_barrier_state(comp_arena())),
                    _env(ci_env),
                    _directive(directive),

@@ -913,10 +914,11 @@
      _igv_idx(0),
      _trace_opto_output(directive->TraceOptoOutputOption),
  #endif
      _has_method_handle_invokes(false),
      _clinit_barrier_on_entry(false),
+     _has_clinit_barriers(false),
      _stress_seed(0),
      _comp_arena(mtCompiler),
      _barrier_set_state(BarrierSet::barrier_set()->barrier_set_c2()->create_barrier_state(comp_arena())),
      _env(ci_env),
      _directive(directive),

@@ -1074,12 +1076,16 @@
    set_use_cmove(UseCMoveUnconditionally /* || do_vector_loop()*/); //TODO: consider do_vector_loop() mandate use_cmove unconditionally
    NOT_PRODUCT(if (use_cmove() && Verbose && has_method()) {tty->print("Compile::Init: use CMove without profitability tests for method %s\n",  method()->name()->as_quoted_ascii());})
  
    _max_node_limit = _directive->MaxNodeLimitOption;
  
-   if (VM_Version::supports_fast_class_init_checks() && has_method() && !is_osr_compilation() && method()->needs_clinit_barrier()) {
+   if (VM_Version::supports_fast_class_init_checks() && has_method() && !is_osr_compilation() &&
+       (method()->needs_clinit_barrier() || (do_clinit_barriers() && method()->is_static()))) {
      set_clinit_barrier_on_entry(true);
+     if (do_clinit_barriers()) {
+       set_has_clinit_barriers(true); // Entry clinit barrier is in prolog code.
+     }
    }
    if (debug_info()->recording_non_safepoints()) {
      set_node_note_array(new(comp_arena()) GrowableArray<Node_Notes*>
                          (comp_arena(), 8, 0, nullptr));
      set_default_node_notes(Node_Notes::make(this));

@@ -4122,10 +4128,13 @@
  // Report if there are too many traps at the current method and bci.
  // Return true if there was a trap, and/or PerMethodTrapLimit is exceeded.
  bool Compile::too_many_traps(ciMethod* method,
                               int bci,
                               Deoptimization::DeoptReason reason) {
+   if (method->has_trap_at(bci)) {
+     return true;
+   }
    ciMethodData* md = method->method_data();
    if (md->is_empty()) {
      // Assume the trap has not occurred, or that it occurred only
      // because of a transient condition during start-up in the interpreter.
      return false;

@@ -4236,14 +4245,14 @@
  bool Compile::needs_clinit_barrier(ciField* field, ciMethod* accessing_method) {
    return field->is_static() && needs_clinit_barrier(field->holder(), accessing_method);
  }
  
  bool Compile::needs_clinit_barrier(ciInstanceKlass* holder, ciMethod* accessing_method) {
-   if (holder->is_initialized()) {
+   if (holder->is_initialized() && !do_clinit_barriers()) {
      return false;
    }
-   if (holder->is_being_initialized()) {
+   if (holder->is_being_initialized() || do_clinit_barriers()) {
      if (accessing_method->holder() == holder) {
        // Access inside a class. The barrier can be elided when access happens in <clinit>,
        // <init>, or a static method. In all those cases, there was an initialization
        // barrier on the holder klass passed.
        if (accessing_method->is_static_initializer() ||

@@ -4622,11 +4631,11 @@
    }
  }
  
  void Compile::log_late_inline(CallGenerator* cg) {
    if (log() != nullptr) {
-     log()->head("late_inline method='%d'  inline_id='" JLONG_FORMAT "'", log()->identify(cg->method()),
+     log()->head("late_inline method='%d' inline_id='" JLONG_FORMAT "'", log()->identify(cg->method()),
                  cg->unique_id());
      JVMState* p = cg->call_node()->jvms();
      while (p != nullptr) {
        log()->elem("jvms bci='%d' method='%d'", p->bci(), log()->identify(p->method()));
        p = p->caller();
< prev index next >