Wed, 18 Apr 2018 22:35:28 +0000
Merge
.hgtags | file | annotate | diff | comparison | revisions | |
src/share/vm/oops/klass.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Mon Apr 02 15:36:07 2018 -0700 1.2 +++ b/.hgtags Wed Apr 18 22:35:28 2018 +0000 1.3 @@ -1140,6 +1140,7 @@ 1.4 a17bab9405474602b18cd62e060a09b17d6413ac jdk8u171-b00 1.5 ebfd57cc21e6b7f0c22b17c666b6b28c9340e207 jdk8u171-b01 1.6 1acd7c1b80241def8fac90f70b0df16356adad47 jdk8u171-b02 1.7 +5587cde50bbc2aa031aefb47eaa36b041f5e7c4b jdk8u181-b00 1.8 5587cde50bbc2aa031aefb47eaa36b041f5e7c4b jdk8u171-b03 1.9 99ef466523302cfbd00496cf6575a00c8637b884 jdk8u171-b04 1.10 08326a76b14888908523cf2bb1105de63b43544d jdk8u171-b05 1.11 @@ -1163,3 +1164,6 @@ 1.12 aafd1bb21e2636ba982d3eae162f5c635a1df03a jdk8u172-b09 1.13 dcd3ace969fcde4eedaddba629647656289d4264 jdk8u172-b10 1.14 083a9d6562100353708e4b73656282b21a78f714 jdk8u172-b11 1.15 +6e2be123a2e1c7671086c767e79ffe8ad5d4f9ca jdk8u181-b01 1.16 +1d0b6fcff115a57ca02081da84589630ba282789 jdk8u181-b02 1.17 +1127faef22f14d56cdd6c0c8bded598f492c2611 jdk8u181-b03
2.1 --- a/src/os/linux/vm/os_linux.hpp Mon Apr 02 15:36:07 2018 -0700 2.2 +++ b/src/os/linux/vm/os_linux.hpp Wed Apr 18 22:35:28 2018 +0000 2.3 @@ -285,8 +285,8 @@ 2.4 static void set_numa_bitmask_isbitset(numa_bitmask_isbitset_func_t func) { _numa_bitmask_isbitset = func; } 2.5 static void set_numa_distance(numa_distance_func_t func) { _numa_distance = func; } 2.6 static void set_numa_all_nodes(unsigned long* ptr) { _numa_all_nodes = ptr; } 2.7 - static void set_numa_all_nodes_ptr(struct bitmask **ptr) { _numa_all_nodes_ptr = *ptr; } 2.8 - static void set_numa_nodes_ptr(struct bitmask **ptr) { _numa_nodes_ptr = *ptr; } 2.9 + static void set_numa_all_nodes_ptr(struct bitmask **ptr) { _numa_all_nodes_ptr = (ptr == NULL ? NULL : *ptr); } 2.10 + static void set_numa_nodes_ptr(struct bitmask **ptr) { _numa_nodes_ptr = (ptr == NULL ? NULL : *ptr); } 2.11 static int sched_getcpu_syscall(void); 2.12 public: 2.13 static int sched_getcpu() { return _sched_getcpu != NULL ? _sched_getcpu() : -1; } 2.14 @@ -330,6 +330,18 @@ 2.15 static bool isnode_in_existing_nodes(unsigned int n) { 2.16 if (_numa_bitmask_isbitset != NULL && _numa_nodes_ptr != NULL) { 2.17 return _numa_bitmask_isbitset(_numa_nodes_ptr, n); 2.18 + } else if (_numa_bitmask_isbitset != NULL && _numa_all_nodes_ptr != NULL) { 2.19 + // Not all libnuma API v2 implement numa_nodes_ptr, so it's not possible 2.20 + // to trust the API version for checking its absence. On the other hand, 2.21 + // numa_nodes_ptr found in libnuma 2.0.9 and above is the only way to get 2.22 + // a complete view of all numa nodes in the system, hence numa_nodes_ptr 2.23 + // is used to handle CPU and nodes on architectures (like PowerPC) where 2.24 + // there can exist nodes with CPUs but no memory or vice-versa and the 2.25 + // nodes may be non-contiguous. For most of the architectures, like 2.26 + // x86_64, numa_node_ptr presents the same node set as found in 2.27 + // numa_all_nodes_ptr so it's possible to use numa_all_nodes_ptr as a 2.28 + // substitute. 2.29 + return _numa_bitmask_isbitset(_numa_all_nodes_ptr, n); 2.30 } else 2.31 return 0; 2.32 }
3.1 --- a/src/share/vm/code/codeBlob.cpp Mon Apr 02 15:36:07 2018 -0700 3.2 +++ b/src/share/vm/code/codeBlob.cpp Wed Apr 18 22:35:28 2018 +0000 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 1998, 2014, 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 @@ -289,6 +289,28 @@ 3.11 return blob; 3.12 } 3.13 3.14 +VtableBlob::VtableBlob(const char* name, int size) : 3.15 + BufferBlob(name, size) { 3.16 +} 3.17 + 3.18 +VtableBlob* VtableBlob::create(const char* name, int buffer_size) { 3.19 + ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock 3.20 + 3.21 + VtableBlob* blob = NULL; 3.22 + unsigned int size = sizeof(VtableBlob); 3.23 + // align the size to CodeEntryAlignment 3.24 + size = align_code_offset(size); 3.25 + size += round_to(buffer_size, oopSize); 3.26 + assert(name != NULL, "must provide a name"); 3.27 + { 3.28 + MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); 3.29 + blob = new (size) VtableBlob(name, size); 3.30 + } 3.31 + // Track memory usage statistic after releasing CodeCache_lock 3.32 + MemoryService::track_code_cache_memory_usage(); 3.33 + 3.34 + return blob; 3.35 +} 3.36 3.37 //---------------------------------------------------------------------------------------------------- 3.38 // Implementation of MethodHandlesAdapterBlob
4.1 --- a/src/share/vm/code/codeBlob.hpp Mon Apr 02 15:36:07 2018 -0700 4.2 +++ b/src/share/vm/code/codeBlob.hpp Wed Apr 18 22:35:28 2018 +0000 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 1998, 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 @@ -101,6 +101,7 @@ 4.11 virtual bool is_exception_stub() const { return false; } 4.12 virtual bool is_safepoint_stub() const { return false; } 4.13 virtual bool is_adapter_blob() const { return false; } 4.14 + virtual bool is_vtable_blob() const { return false; } 4.15 virtual bool is_method_handles_adapter_blob() const { return false; } 4.16 4.17 virtual bool is_compiled_by_c2() const { return false; } 4.18 @@ -202,6 +203,7 @@ 4.19 class BufferBlob: public CodeBlob { 4.20 friend class VMStructs; 4.21 friend class AdapterBlob; 4.22 + friend class VtableBlob; 4.23 friend class MethodHandlesAdapterBlob; 4.24 4.25 private: 4.26 @@ -246,6 +248,18 @@ 4.27 virtual bool is_adapter_blob() const { return true; } 4.28 }; 4.29 4.30 +//--------------------------------------------------------------------------------------------------- 4.31 +class VtableBlob: public BufferBlob { 4.32 +private: 4.33 + VtableBlob(const char*, int); 4.34 + 4.35 +public: 4.36 + // Creation 4.37 + static VtableBlob* create(const char* name, int buffer_size); 4.38 + 4.39 + // Typing 4.40 + virtual bool is_vtable_blob() const { return true; } 4.41 +}; 4.42 4.43 //---------------------------------------------------------------------------------------------------- 4.44 // MethodHandlesAdapterBlob: used to hold MethodHandles adapters
5.1 --- a/src/share/vm/code/compiledIC.cpp Mon Apr 02 15:36:07 2018 -0700 5.2 +++ b/src/share/vm/code/compiledIC.cpp Wed Apr 18 22:35:28 2018 +0000 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 1997, 2017, 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 @@ -232,7 +232,7 @@ 5.11 assert(k->verify_itable_index(itable_index), "sanity check"); 5.12 #endif //ASSERT 5.13 CompiledICHolder* holder = new CompiledICHolder(call_info->resolved_method()->method_holder(), 5.14 - call_info->resolved_klass()()); 5.15 + call_info->resolved_klass()(), false); 5.16 holder->claim(); 5.17 InlineCacheBuffer::create_transition_stub(this, holder, entry); 5.18 } else { 5.19 @@ -270,7 +270,7 @@ 5.20 assert(!is_optimized(), "an optimized call cannot be megamorphic"); 5.21 5.22 // Cannot rely on cached_value. It is either an interface or a method. 5.23 - return VtableStubs::is_entry_point(ic_destination()); 5.24 + return VtableStubs::entry_point(ic_destination()) != NULL; 5.25 } 5.26 5.27 bool CompiledIC::is_call_to_compiled() const { 5.28 @@ -534,9 +534,11 @@ 5.29 return true; 5.30 } 5.31 // itable stubs also use CompiledICHolder 5.32 - if (VtableStubs::is_entry_point(entry) && VtableStubs::stub_containing(entry)->is_itable_stub()) { 5.33 - return true; 5.34 + if (cb != NULL && cb->is_vtable_blob()) { 5.35 + VtableStub* s = VtableStubs::entry_point(entry); 5.36 + return (s != NULL) && s->is_itable_stub(); 5.37 } 5.38 + 5.39 return false; 5.40 } 5.41
6.1 --- a/src/share/vm/code/vtableStubs.cpp Mon Apr 02 15:36:07 2018 -0700 6.2 +++ b/src/share/vm/code/vtableStubs.cpp Wed Apr 18 22:35:28 2018 +0000 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 1997, 2014, 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 @@ -60,7 +60,7 @@ 6.11 6.12 // There is a dependency on the name of the blob in src/share/vm/prims/jvmtiCodeBlobEvents.cpp 6.13 // If changing the name, update the other file accordingly. 6.14 - BufferBlob* blob = BufferBlob::create("vtable chunks", bytes); 6.15 + VtableBlob* blob = VtableBlob::create("vtable chunks", bytes); 6.16 if (blob == NULL) { 6.17 return NULL; 6.18 } 6.19 @@ -167,17 +167,18 @@ 6.20 _number_of_vtable_stubs++; 6.21 } 6.22 6.23 - 6.24 -bool VtableStubs::is_entry_point(address pc) { 6.25 +VtableStub* VtableStubs::entry_point(address pc) { 6.26 MutexLocker ml(VtableStubs_lock); 6.27 VtableStub* stub = (VtableStub*)(pc - VtableStub::entry_offset()); 6.28 uint hash = VtableStubs::hash(stub->is_vtable_stub(), stub->index()); 6.29 VtableStub* s; 6.30 for (s = _table[hash]; s != NULL && s != stub; s = s->next()) {} 6.31 - return s == stub; 6.32 + if (s == stub) { 6.33 + return s; 6.34 + } 6.35 + return NULL; 6.36 } 6.37 6.38 - 6.39 bool VtableStubs::contains(address pc) { 6.40 // simple solution for now - we may want to use 6.41 // a faster way if this function is called often
7.1 --- a/src/share/vm/code/vtableStubs.hpp Mon Apr 02 15:36:07 2018 -0700 7.2 +++ b/src/share/vm/code/vtableStubs.hpp Wed Apr 18 22:35:28 2018 +0000 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 1997, 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 @@ -126,7 +126,7 @@ 7.11 public: 7.12 static address find_vtable_stub(int vtable_index) { return find_stub(true, vtable_index); } 7.13 static address find_itable_stub(int itable_index) { return find_stub(false, itable_index); } 7.14 - static bool is_entry_point(address pc); // is pc a vtable stub entry point? 7.15 + static VtableStub* entry_point(address pc); // vtable stub entry point for a pc 7.16 static bool contains(address pc); // is pc within any stub? 7.17 static VtableStub* stub_containing(address pc); // stub containing pc or NULL 7.18 static int number_of_vtable_stubs() { return _number_of_vtable_stubs; }
8.1 --- a/src/share/vm/oops/compiledICHolder.cpp Mon Apr 02 15:36:07 2018 -0700 8.2 +++ b/src/share/vm/oops/compiledICHolder.cpp Wed Apr 18 22:35:28 2018 +0000 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 @@ -24,30 +24,12 @@ 8.11 8.12 #include "precompiled.hpp" 8.13 #include "oops/compiledICHolder.hpp" 8.14 -#include "oops/klass.hpp" 8.15 -#include "oops/method.hpp" 8.16 #include "oops/oop.inline2.hpp" 8.17 8.18 volatile int CompiledICHolder::_live_count; 8.19 volatile int CompiledICHolder::_live_not_claimed_count; 8.20 8.21 8.22 -bool CompiledICHolder::is_loader_alive(BoolObjectClosure* is_alive) { 8.23 - if (_holder_metadata->is_method()) { 8.24 - if (!((Method*)_holder_metadata)->method_holder()->is_loader_alive(is_alive)) { 8.25 - return false; 8.26 - } 8.27 - } else if (_holder_metadata->is_klass()) { 8.28 - if (!((Klass*)_holder_metadata)->is_loader_alive(is_alive)) { 8.29 - return false; 8.30 - } 8.31 - } 8.32 - if (!_holder_klass->is_loader_alive(is_alive)) { 8.33 - return false; 8.34 - } 8.35 - return true; 8.36 -} 8.37 - 8.38 // Printing 8.39 8.40 void CompiledICHolder::print_on(outputStream* st) const {
9.1 --- a/src/share/vm/oops/compiledICHolder.hpp Mon Apr 02 15:36:07 2018 -0700 9.2 +++ b/src/share/vm/oops/compiledICHolder.hpp Wed Apr 18 22:35:28 2018 +0000 9.3 @@ -1,5 +1,5 @@ 9.4 /* 9.5 - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. 9.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. 9.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.8 * 9.9 * This code is free software; you can redistribute it and/or modify it 9.10 @@ -26,6 +26,8 @@ 9.11 #define SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP 9.12 9.13 #include "oops/oop.hpp" 9.14 +#include "oops/klass.hpp" 9.15 +#include "oops/method.hpp" 9.16 9.17 // A CompiledICHolder* is a helper object for the inline cache implementation. 9.18 // It holds: 9.19 @@ -48,11 +50,12 @@ 9.20 Metadata* _holder_metadata; 9.21 Klass* _holder_klass; // to avoid name conflict with oopDesc::_klass 9.22 CompiledICHolder* _next; 9.23 + bool _is_metadata_method; 9.24 9.25 public: 9.26 // Constructor 9.27 - CompiledICHolder(Metadata* metadata, Klass* klass) 9.28 - : _holder_metadata(metadata), _holder_klass(klass) { 9.29 + CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method = true) 9.30 + : _holder_metadata(metadata), _holder_klass(klass), _is_metadata_method(is_method) { 9.31 #ifdef ASSERT 9.32 Atomic::inc(&_live_count); 9.33 Atomic::inc(&_live_not_claimed_count); 9.34 @@ -82,7 +85,16 @@ 9.35 CompiledICHolder* next() { return _next; } 9.36 void set_next(CompiledICHolder* n) { _next = n; } 9.37 9.38 - bool is_loader_alive(BoolObjectClosure* is_alive); 9.39 + inline bool is_loader_alive(BoolObjectClosure* is_alive) { 9.40 + Klass* k = _is_metadata_method ? ((Method*)_holder_metadata)->method_holder() : (Klass*)_holder_metadata; 9.41 + if (!k->is_loader_alive(is_alive)) { 9.42 + return false; 9.43 + } 9.44 + if (!_holder_klass->is_loader_alive(is_alive)) { 9.45 + return false; 9.46 + } 9.47 + return true; 9.48 + } 9.49 9.50 // Verify 9.51 void verify_on(outputStream* st);
10.1 --- a/src/share/vm/opto/ifnode.cpp Mon Apr 02 15:36:07 2018 -0700 10.2 +++ b/src/share/vm/opto/ifnode.cpp Wed Apr 18 22:35:28 2018 +0000 10.3 @@ -453,6 +453,9 @@ 10.4 // offset. Return 2 if we had to negate the test. Index is NULL if the check 10.5 // is versus a constant. 10.6 int IfNode::is_range_check(Node* &range, Node* &index, jint &offset) { 10.7 + if (outcnt() != 2) { 10.8 + return 0; 10.9 + } 10.10 Node* b = in(1); 10.11 if (b == NULL || !b->is_Bool()) return 0; 10.12 BoolNode* bn = b->as_Bool();