Merge

Sun, 01 Apr 2018 22:52:47 -0700

author
asaha
date
Sun, 01 Apr 2018 22:52:47 -0700
changeset 9393
8410ee888646
parent 9386
c29a836dea38
parent 9392
e863aba6538b
child 9394
d5a33d109309

Merge

.hgtags file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Fri Mar 30 11:01:11 2018 -0700
     1.2 +++ b/.hgtags	Sun Apr 01 22:52:47 2018 -0700
     1.3 @@ -1137,6 +1137,7 @@
     1.4  9b3f207379cf6ecfb8603640269e31ff4e064294 jdk8u162-b35
     1.5  d2ebd6530396b0afc700cd1a8eaf1f7a7f9fce8d jdk8u162-b36
     1.6  700ad8745f3fdc5ba3702616fc5ed6a6248dfa78 jdk8u162-b37
     1.7 +405800ccc4c7b81475b01392f2145cc3675d1f86 jdk8u162-b38
     1.8  a17bab9405474602b18cd62e060a09b17d6413ac jdk8u171-b00
     1.9  ebfd57cc21e6b7f0c22b17c666b6b28c9340e207 jdk8u171-b01
    1.10  1acd7c1b80241def8fac90f70b0df16356adad47 jdk8u171-b02
     2.1 --- a/src/share/vm/code/codeBlob.cpp	Fri Mar 30 11:01:11 2018 -0700
     2.2 +++ b/src/share/vm/code/codeBlob.cpp	Sun Apr 01 22:52:47 2018 -0700
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -289,6 +289,28 @@
    2.11    return blob;
    2.12  }
    2.13  
    2.14 +VtableBlob::VtableBlob(const char* name, int size) :
    2.15 +  BufferBlob(name, size) {
    2.16 +}
    2.17 +
    2.18 +VtableBlob* VtableBlob::create(const char* name, int buffer_size) {
    2.19 +  ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
    2.20 +
    2.21 +  VtableBlob* blob = NULL;
    2.22 +  unsigned int size = sizeof(VtableBlob);
    2.23 +  // align the size to CodeEntryAlignment
    2.24 +  size = align_code_offset(size);
    2.25 +  size += round_to(buffer_size, oopSize);
    2.26 +  assert(name != NULL, "must provide a name");
    2.27 +  {
    2.28 +    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
    2.29 +    blob = new (size) VtableBlob(name, size);
    2.30 +  }
    2.31 +  // Track memory usage statistic after releasing CodeCache_lock
    2.32 +  MemoryService::track_code_cache_memory_usage();
    2.33 +
    2.34 +  return blob;
    2.35 +}
    2.36  
    2.37  //----------------------------------------------------------------------------------------------------
    2.38  // Implementation of MethodHandlesAdapterBlob
     3.1 --- a/src/share/vm/code/codeBlob.hpp	Fri Mar 30 11:01:11 2018 -0700
     3.2 +++ b/src/share/vm/code/codeBlob.hpp	Sun Apr 01 22:52:47 2018 -0700
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -101,6 +101,7 @@
    3.11    virtual bool is_exception_stub() const         { return false; }
    3.12    virtual bool is_safepoint_stub() const              { return false; }
    3.13    virtual bool is_adapter_blob() const                { return false; }
    3.14 +  virtual bool is_vtable_blob() const                 { return false; }
    3.15    virtual bool is_method_handles_adapter_blob() const { return false; }
    3.16  
    3.17    virtual bool is_compiled_by_c2() const         { return false; }
    3.18 @@ -202,6 +203,7 @@
    3.19  class BufferBlob: public CodeBlob {
    3.20    friend class VMStructs;
    3.21    friend class AdapterBlob;
    3.22 +  friend class VtableBlob;
    3.23    friend class MethodHandlesAdapterBlob;
    3.24  
    3.25   private:
    3.26 @@ -246,6 +248,18 @@
    3.27    virtual bool is_adapter_blob() const { return true; }
    3.28  };
    3.29  
    3.30 +//---------------------------------------------------------------------------------------------------
    3.31 +class VtableBlob: public BufferBlob {
    3.32 +private:
    3.33 +  VtableBlob(const char*, int);
    3.34 +
    3.35 +public:
    3.36 +  // Creation
    3.37 +  static VtableBlob* create(const char* name, int buffer_size);
    3.38 +
    3.39 +  // Typing
    3.40 +  virtual bool is_vtable_blob() const { return true; }
    3.41 +};
    3.42  
    3.43  //----------------------------------------------------------------------------------------------------
    3.44  // MethodHandlesAdapterBlob: used to hold MethodHandles adapters
     4.1 --- a/src/share/vm/code/compiledIC.cpp	Fri Mar 30 11:01:11 2018 -0700
     4.2 +++ b/src/share/vm/code/compiledIC.cpp	Sun Apr 01 22:52:47 2018 -0700
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -232,7 +232,7 @@
    4.11      assert(k->verify_itable_index(itable_index), "sanity check");
    4.12  #endif //ASSERT
    4.13      CompiledICHolder* holder = new CompiledICHolder(call_info->resolved_method()->method_holder(),
    4.14 -                                                    call_info->resolved_klass()());
    4.15 +                                                    call_info->resolved_klass()(), false);
    4.16      holder->claim();
    4.17      InlineCacheBuffer::create_transition_stub(this, holder, entry);
    4.18    } else {
    4.19 @@ -270,7 +270,7 @@
    4.20    assert(!is_optimized(), "an optimized call cannot be megamorphic");
    4.21  
    4.22    // Cannot rely on cached_value. It is either an interface or a method.
    4.23 -  return VtableStubs::is_entry_point(ic_destination());
    4.24 +  return VtableStubs::entry_point(ic_destination()) != NULL;
    4.25  }
    4.26  
    4.27  bool CompiledIC::is_call_to_compiled() const {
    4.28 @@ -534,9 +534,11 @@
    4.29      return true;
    4.30    }
    4.31    // itable stubs also use CompiledICHolder
    4.32 -  if (VtableStubs::is_entry_point(entry) && VtableStubs::stub_containing(entry)->is_itable_stub()) {
    4.33 -    return true;
    4.34 +  if (cb != NULL && cb->is_vtable_blob()) {
    4.35 +    VtableStub* s = VtableStubs::entry_point(entry);
    4.36 +    return (s != NULL) && s->is_itable_stub();
    4.37    }
    4.38 +
    4.39    return false;
    4.40  }
    4.41  
     5.1 --- a/src/share/vm/code/vtableStubs.cpp	Fri Mar 30 11:01:11 2018 -0700
     5.2 +++ b/src/share/vm/code/vtableStubs.cpp	Sun Apr 01 22:52:47 2018 -0700
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -60,7 +60,7 @@
    5.11  
    5.12     // There is a dependency on the name of the blob in src/share/vm/prims/jvmtiCodeBlobEvents.cpp
    5.13     // If changing the name, update the other file accordingly.
    5.14 -    BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
    5.15 +    VtableBlob* blob = VtableBlob::create("vtable chunks", bytes);
    5.16      if (blob == NULL) {
    5.17        return NULL;
    5.18      }
    5.19 @@ -167,17 +167,18 @@
    5.20    _number_of_vtable_stubs++;
    5.21  }
    5.22  
    5.23 -
    5.24 -bool VtableStubs::is_entry_point(address pc) {
    5.25 +VtableStub* VtableStubs::entry_point(address pc) {
    5.26    MutexLocker ml(VtableStubs_lock);
    5.27    VtableStub* stub = (VtableStub*)(pc - VtableStub::entry_offset());
    5.28    uint hash = VtableStubs::hash(stub->is_vtable_stub(), stub->index());
    5.29    VtableStub* s;
    5.30    for (s = _table[hash]; s != NULL && s != stub; s = s->next()) {}
    5.31 -  return s == stub;
    5.32 +  if (s == stub) {
    5.33 +    return s;
    5.34 +  }
    5.35 +  return NULL;
    5.36  }
    5.37  
    5.38 -
    5.39  bool VtableStubs::contains(address pc) {
    5.40    // simple solution for now - we may want to use
    5.41    // a faster way if this function is called often
     6.1 --- a/src/share/vm/code/vtableStubs.hpp	Fri Mar 30 11:01:11 2018 -0700
     6.2 +++ b/src/share/vm/code/vtableStubs.hpp	Sun Apr 01 22:52:47 2018 -0700
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -126,7 +126,7 @@
    6.11   public:
    6.12    static address     find_vtable_stub(int vtable_index) { return find_stub(true,  vtable_index); }
    6.13    static address     find_itable_stub(int itable_index) { return find_stub(false, itable_index); }
    6.14 -  static bool        is_entry_point(address pc);                     // is pc a vtable stub entry point?
    6.15 +  static VtableStub* entry_point(address pc);                        // vtable stub entry point for a pc
    6.16    static bool        contains(address pc);                           // is pc within any stub?
    6.17    static VtableStub* stub_containing(address pc);                    // stub containing pc or NULL
    6.18    static int         number_of_vtable_stubs() { return _number_of_vtable_stubs; }
     7.1 --- a/src/share/vm/oops/compiledICHolder.cpp	Fri Mar 30 11:01:11 2018 -0700
     7.2 +++ b/src/share/vm/oops/compiledICHolder.cpp	Sun Apr 01 22:52:47 2018 -0700
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -24,30 +24,12 @@
    7.11  
    7.12  #include "precompiled.hpp"
    7.13  #include "oops/compiledICHolder.hpp"
    7.14 -#include "oops/klass.hpp"
    7.15 -#include "oops/method.hpp"
    7.16  #include "oops/oop.inline2.hpp"
    7.17  
    7.18  volatile int CompiledICHolder::_live_count;
    7.19  volatile int CompiledICHolder::_live_not_claimed_count;
    7.20  
    7.21  
    7.22 -bool CompiledICHolder::is_loader_alive(BoolObjectClosure* is_alive) {
    7.23 -  if (_holder_metadata->is_method()) {
    7.24 -    if (!((Method*)_holder_metadata)->method_holder()->is_loader_alive(is_alive)) {
    7.25 -      return false;
    7.26 -    }
    7.27 -  } else if (_holder_metadata->is_klass()) {
    7.28 -    if (!((Klass*)_holder_metadata)->is_loader_alive(is_alive)) {
    7.29 -      return false;
    7.30 -    }
    7.31 -  }
    7.32 -  if (!_holder_klass->is_loader_alive(is_alive)) {
    7.33 -    return false;
    7.34 -  }
    7.35 -  return true;
    7.36 -}
    7.37 -
    7.38  // Printing
    7.39  
    7.40  void CompiledICHolder::print_on(outputStream* st) const {
     8.1 --- a/src/share/vm/oops/compiledICHolder.hpp	Fri Mar 30 11:01:11 2018 -0700
     8.2 +++ b/src/share/vm/oops/compiledICHolder.hpp	Sun Apr 01 22:52:47 2018 -0700
     8.3 @@ -1,5 +1,5 @@
     8.4  /*
     8.5 - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
     8.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     8.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8   *
     8.9   * This code is free software; you can redistribute it and/or modify it
    8.10 @@ -26,6 +26,8 @@
    8.11  #define SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
    8.12  
    8.13  #include "oops/oop.hpp"
    8.14 +#include "oops/klass.hpp"
    8.15 +#include "oops/method.hpp"
    8.16  
    8.17  // A CompiledICHolder* is a helper object for the inline cache implementation.
    8.18  // It holds:
    8.19 @@ -48,11 +50,12 @@
    8.20    Metadata* _holder_metadata;
    8.21    Klass*    _holder_klass;    // to avoid name conflict with oopDesc::_klass
    8.22    CompiledICHolder* _next;
    8.23 +  bool _is_metadata_method;
    8.24  
    8.25   public:
    8.26    // Constructor
    8.27 -  CompiledICHolder(Metadata* metadata, Klass* klass)
    8.28 -      : _holder_metadata(metadata), _holder_klass(klass) {
    8.29 +  CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method = true)
    8.30 +      : _holder_metadata(metadata), _holder_klass(klass), _is_metadata_method(is_method) {
    8.31  #ifdef ASSERT
    8.32      Atomic::inc(&_live_count);
    8.33      Atomic::inc(&_live_not_claimed_count);
    8.34 @@ -82,7 +85,16 @@
    8.35    CompiledICHolder* next()     { return _next; }
    8.36    void set_next(CompiledICHolder* n) { _next = n; }
    8.37  
    8.38 -  bool is_loader_alive(BoolObjectClosure* is_alive);
    8.39 +  inline bool is_loader_alive(BoolObjectClosure* is_alive) {
    8.40 +    Klass* k = _is_metadata_method ? ((Method*)_holder_metadata)->method_holder() : (Klass*)_holder_metadata;
    8.41 +    if (!k->is_loader_alive(is_alive)) {
    8.42 +      return false;
    8.43 +    }
    8.44 +    if (!_holder_klass->is_loader_alive(is_alive)) {
    8.45 +      return false;
    8.46 +    }
    8.47 +    return true;
    8.48 +  }
    8.49  
    8.50    // Verify
    8.51    void verify_on(outputStream* st);

mercurial