Merge

Thu, 12 Dec 2013 11:22:26 -0800

author
anoll
date
Thu, 12 Dec 2013 11:22:26 -0800
changeset 6176
bc8b01f98ae3
parent 6171
e3995ab44393
parent 6175
62084ffe573b
child 6179
2a21bf819fea

Merge

     1.1 --- a/src/share/vm/code/compiledIC.cpp	Thu Dec 12 16:13:44 2013 +0100
     1.2 +++ b/src/share/vm/code/compiledIC.cpp	Thu Dec 12 11:22:26 2013 -0800
     1.3 @@ -418,7 +418,7 @@
     1.4                                             TRAPS) {
     1.5    nmethod* method_code = method->code();
     1.6    address entry = NULL;
     1.7 -  if (method_code != NULL) {
     1.8 +  if (method_code != NULL && method_code->is_in_use()) {
     1.9      // Call to compiled code
    1.10      if (static_bound || is_optimized) {
    1.11        entry      = method_code->verified_entry_point();
    1.12 @@ -545,7 +545,7 @@
    1.13  void CompiledStaticCall::compute_entry(methodHandle m, StaticCallInfo& info) {
    1.14    nmethod* m_code = m->code();
    1.15    info._callee = m;
    1.16 -  if (m_code != NULL) {
    1.17 +  if (m_code != NULL && m_code->is_in_use()) {
    1.18      info._to_interpreter = false;
    1.19      info._entry  = m_code->verified_entry_point();
    1.20    } else {
     2.1 --- a/src/share/vm/code/nmethod.cpp	Thu Dec 12 16:13:44 2013 +0100
     2.2 +++ b/src/share/vm/code/nmethod.cpp	Thu Dec 12 11:22:26 2013 -0800
     2.3 @@ -459,7 +459,7 @@
     2.4  
     2.5  // Fill in default values for various flag fields
     2.6  void nmethod::init_defaults() {
     2.7 -  _state                      = alive;
     2.8 +  _state                      = in_use;
     2.9    _marked_for_reclamation     = 0;
    2.10    _has_flushed_dependencies   = 0;
    2.11    _has_unsafe_access          = 0;
    2.12 @@ -1660,8 +1660,8 @@
    2.13            CompiledICHolder* cichk_oop = ic->cached_icholder();
    2.14            if (cichk_oop->holder_method()->method_holder()->is_loader_alive(is_alive) &&
    2.15                cichk_oop->holder_klass()->is_loader_alive(is_alive)) {
    2.16 -              continue;
    2.17 -            }
    2.18 +            continue;
    2.19 +          }
    2.20          } else {
    2.21            Metadata* ic_oop = ic->cached_metadata();
    2.22            if (ic_oop != NULL) {
    2.23 @@ -1677,8 +1677,8 @@
    2.24                ShouldNotReachHere();
    2.25              }
    2.26            }
    2.27 -          }
    2.28 -          ic->set_to_clean();
    2.29 +        }
    2.30 +        ic->set_to_clean();
    2.31        }
    2.32      }
    2.33    }
    2.34 @@ -2393,8 +2393,8 @@
    2.35  
    2.36  void nmethod::verify_interrupt_point(address call_site) {
    2.37    // Verify IC only when nmethod installation is finished.
    2.38 -  bool is_installed = (method()->code() == this) // nmethod is in state 'alive' and installed
    2.39 -                      || !this->is_in_use();     // nmethod is installed, but not in 'alive' state
    2.40 +  bool is_installed = (method()->code() == this) // nmethod is in state 'in_use' and installed
    2.41 +                      || !this->is_in_use();     // nmethod is installed, but not in 'in_use' state
    2.42    if (is_installed) {
    2.43      Thread *cur = Thread::current();
    2.44      if (CompiledIC_lock->owner() == cur ||
     3.1 --- a/src/share/vm/code/nmethod.hpp	Thu Dec 12 16:13:44 2013 +0100
     3.2 +++ b/src/share/vm/code/nmethod.hpp	Thu Dec 12 11:22:26 2013 -0800
     3.3 @@ -184,11 +184,12 @@
     3.4    bool _oops_are_stale;  // indicates that it's no longer safe to access oops section
     3.5  #endif
     3.6  
     3.7 -  enum { alive        = 0,
     3.8 -         not_entrant  = 1, // uncommon trap has happened but activations may still exist
     3.9 -         zombie       = 2,
    3.10 -         unloaded     = 3 };
    3.11 -
    3.12 +  enum { in_use       = 0,   // executable nmethod
    3.13 +         not_entrant  = 1,   // marked for deoptimization but activations may still exist,
    3.14 +                             // will be transformed to zombie when all activations are gone
    3.15 +         zombie       = 2,   // no activations exist, nmethod is ready for purge
    3.16 +         unloaded     = 3 }; // there should be no activations, should not be called,
    3.17 +                             // will be transformed to zombie immediately
    3.18  
    3.19    jbyte _scavenge_root_state;
    3.20  
    3.21 @@ -407,8 +408,8 @@
    3.22    address verified_entry_point() const            { return _verified_entry_point;    } // if klass is correct
    3.23  
    3.24    // flag accessing and manipulation
    3.25 -  bool  is_in_use() const                         { return _state == alive; }
    3.26 -  bool  is_alive() const                          { return _state == alive || _state == not_entrant; }
    3.27 +  bool  is_in_use() const                         { return _state == in_use; }
    3.28 +  bool  is_alive() const                          { return _state == in_use || _state == not_entrant; }
    3.29    bool  is_not_entrant() const                    { return _state == not_entrant; }
    3.30    bool  is_zombie() const                         { return _state == zombie; }
    3.31    bool  is_unloaded() const                       { return _state == unloaded;   }
     4.1 --- a/src/share/vm/opto/memnode.cpp	Thu Dec 12 16:13:44 2013 +0100
     4.2 +++ b/src/share/vm/opto/memnode.cpp	Thu Dec 12 11:22:26 2013 -0800
     4.3 @@ -2071,6 +2071,11 @@
     4.4        if (t != NULL) {
     4.5          // constant oop => constant klass
     4.6          if (offset == java_lang_Class::array_klass_offset_in_bytes()) {
     4.7 +          if (t->is_void()) {
     4.8 +            // We cannot create a void array.  Since void is a primitive type return null
     4.9 +            // klass.  Users of this result need to do a null check on the returned klass.
    4.10 +            return TypePtr::NULL_PTR;
    4.11 +          }
    4.12            return TypeKlassPtr::make(ciArrayKlass::make(t));
    4.13          }
    4.14          if (!t->is_klass()) {
     5.1 --- a/src/share/vm/runtime/sharedRuntime.cpp	Thu Dec 12 16:13:44 2013 +0100
     5.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp	Thu Dec 12 11:22:26 2013 -0800
     5.3 @@ -1178,12 +1178,12 @@
     5.4    CodeBlob* caller_cb = caller_frame.cb();
     5.5    guarantee(caller_cb != NULL && caller_cb->is_nmethod(), "must be called from nmethod");
     5.6    nmethod* caller_nm = caller_cb->as_nmethod_or_null();
     5.7 +
     5.8    // make sure caller is not getting deoptimized
     5.9    // and removed before we are done with it.
    5.10    // CLEANUP - with lazy deopt shouldn't need this lock
    5.11    nmethodLocker caller_lock(caller_nm);
    5.12  
    5.13 -
    5.14    // determine call info & receiver
    5.15    // note: a) receiver is NULL for static calls
    5.16    //       b) an exception is thrown if receiver is NULL for non-static calls
    5.17 @@ -1198,6 +1198,11 @@
    5.18           (!is_virtual && invoke_code == Bytecodes::_invokedynamic) ||
    5.19           ( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode");
    5.20  
    5.21 +  // We do not patch the call site if the caller nmethod has been made non-entrant.
    5.22 +  if (!caller_nm->is_in_use()) {
    5.23 +    return callee_method;
    5.24 +  }
    5.25 +
    5.26  #ifndef PRODUCT
    5.27    // tracing/debugging/statistics
    5.28    int *addr = (is_optimized) ? (&_resolve_opt_virtual_ctr) :
    5.29 @@ -1237,6 +1242,10 @@
    5.30    // Make sure the callee nmethod does not get deoptimized and removed before
    5.31    // we are done patching the code.
    5.32    nmethod* callee_nm = callee_method->code();
    5.33 +  if (callee_nm != NULL && !callee_nm->is_in_use()) {
    5.34 +    // Patch call site to C2I adapter if callee nmethod is deoptimized or unloaded.
    5.35 +    callee_nm = NULL;
    5.36 +  }
    5.37    nmethodLocker nl_callee(callee_nm);
    5.38  #ifdef ASSERT
    5.39    address dest_entry_point = callee_nm == NULL ? 0 : callee_nm->entry_point(); // used below
    5.40 @@ -1258,15 +1267,24 @@
    5.41    {
    5.42      MutexLocker ml_patch(CompiledIC_lock);
    5.43  
    5.44 +    // Lock blocks for safepoint during which both nmethods can change state.
    5.45 +
    5.46      // Now that we are ready to patch if the Method* was redefined then
    5.47      // don't update call site and let the caller retry.
    5.48 -
    5.49 -    if (!callee_method->is_old()) {
    5.50 +    // Don't update call site if caller nmethod has been made non-entrant
    5.51 +    // as it is a waste of time.
    5.52 +    // Don't update call site if callee nmethod was unloaded or deoptimized.
    5.53 +    // Don't update call site if callee nmethod was replaced by an other nmethod
    5.54 +    // which may happen when multiply alive nmethod (tiered compilation)
    5.55 +    // will be supported.
    5.56 +    if (!callee_method->is_old() && caller_nm->is_in_use() &&
    5.57 +        (callee_nm == NULL || callee_nm->is_in_use() && (callee_method->code() == callee_nm))) {
    5.58  #ifdef ASSERT
    5.59        // We must not try to patch to jump to an already unloaded method.
    5.60        if (dest_entry_point != 0) {
    5.61 -        assert(CodeCache::find_blob(dest_entry_point) != NULL,
    5.62 -               "should not unload nmethod while locked");
    5.63 +        CodeBlob* cb = CodeCache::find_blob(dest_entry_point);
    5.64 +        assert((cb != NULL) && cb->is_nmethod() && (((nmethod*)cb) == callee_nm),
    5.65 +               "should not call unloaded nmethod");
    5.66        }
    5.67  #endif
    5.68        if (is_virtual) {
     6.1 --- a/test/compiler/7141637/SpreadNullArg.java	Thu Dec 12 16:13:44 2013 +0100
     6.2 +++ b/test/compiler/7141637/SpreadNullArg.java	Thu Dec 12 11:22:26 2013 -0800
     6.3 @@ -46,13 +46,17 @@
     6.4        mh_spread_target =
     6.5          MethodHandles.lookup().findStatic(SpreadNullArg.class, "target_spread_arg", mt_ref_arg);
     6.6        result = (int) mh_spreadInvoker.invokeExact(mh_spread_target, (Object[]) null);
     6.7 -    } catch(NullPointerException e) {
     6.8 -      // Expected exception - do nothing!
     6.9 -    } catch(Throwable e) {
    6.10 +      throw new Error("Expected IllegalArgumentException was not thrown");
    6.11 +    } catch (IllegalArgumentException e) {
    6.12 +      System.out.println("Expected exception : " + e);
    6.13 +    } catch (Throwable e) {
    6.14        throw new Error(e);
    6.15      }
    6.16  
    6.17 -    if (result != 42) throw new Error("Expected NullPointerException was not thrown");
    6.18 +    if (result != 42) {
    6.19 +      throw new Error("result [" + result
    6.20 +        + "] != 42 : Expected IllegalArgumentException was not thrown?");
    6.21 +    }
    6.22    }
    6.23  
    6.24    public static int target_spread_arg(Integer i1) {
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/compiler/reflection/ArrayNewInstanceOfVoid.java	Thu Dec 12 11:22:26 2013 -0800
     7.3 @@ -0,0 +1,44 @@
     7.4 +/*
     7.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.
    7.11 + *
    7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.15 + * version 2 for more details (a copy is included in the LICENSE file that
    7.16 + * accompanied this code).
    7.17 + *
    7.18 + * You should have received a copy of the GNU General Public License version
    7.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.21 + *
    7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.23 + * or visit www.oracle.com if you need additional information or have any
    7.24 + * questions.
    7.25 + */
    7.26 +
    7.27 +/*
    7.28 + * @test
    7.29 + * @bug 8029366
    7.30 + * @summary ShouldNotReachHere error when creating an array with component type of void
    7.31 + */
    7.32 +
    7.33 +public class ArrayNewInstanceOfVoid {
    7.34 +    public static void main(String[] args) {
    7.35 +        for (int i = 0; i < 100_000; i++) {
    7.36 +            test();
    7.37 +        }
    7.38 +    }
    7.39 +
    7.40 +    private static void test() {
    7.41 +        try {
    7.42 +            java.lang.reflect.Array.newInstance(void.class, 2);
    7.43 +        } catch (IllegalArgumentException e) {
    7.44 +            // expected
    7.45 +        }
    7.46 +    }
    7.47 +}
     8.1 --- a/test/compiler/regalloc/C1ObjectSpillInLogicOp.java	Thu Dec 12 16:13:44 2013 +0100
     8.2 +++ b/test/compiler/regalloc/C1ObjectSpillInLogicOp.java	Thu Dec 12 11:22:26 2013 -0800
     8.3 @@ -34,8 +34,9 @@
     8.4   */
     8.5  
     8.6  import java.util.concurrent.atomic.*;
     8.7 -class C1ObjectSpillInLogicOp {
     8.8 -  static public void main(String[] args) {
     8.9 +
    8.10 +public class C1ObjectSpillInLogicOp {
    8.11 +  public static void main(String[] args) {
    8.12      AtomicReferenceArray<Integer> x = new AtomicReferenceArray(128);
    8.13      Integer y = new Integer(0);
    8.14      for (int i = 0; i < 50000; i++) {

mercurial