Mercurial > hg > icedtea8-forest > hotspot
changeset 9735:eb9e617d6f64 jdk8u121-b33
8173631: Backout three hotspot fixes from 8u121-bpr repo
Reviewed-by: vkempik, shshahma
author | aefimov |
---|---|
date | Tue, 31 Jan 2017 16:31:09 +0300 |
parents | 4df68abf9cd5 |
children | 7f40be010a50 |
files | src/cpu/sparc/vm/macroAssembler_sparc.cpp src/cpu/sparc/vm/vm_version_sparc.cpp src/os/linux/vm/globals_linux.hpp src/os/linux/vm/os_linux.cpp src/share/vm/opto/cfgnode.hpp src/share/vm/opto/macro.cpp src/share/vm/opto/memnode.cpp src/share/vm/opto/phaseX.cpp src/share/vm/opto/type.hpp test/runtime/os/AvailableProcessors.java |
diffstat | 10 files changed, 16 insertions(+), 183 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp Wed Jan 25 09:56:19 2017 -0800 +++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp Tue Jan 31 16:31:09 2017 +0300 @@ -4261,7 +4261,6 @@ assert(UseBlockZeroing && VM_Version::has_block_zeroing(), "only works with BIS zeroing"); Register end = count; int cache_line_size = VM_Version::prefetch_data_size(); - assert(cache_line_size > 0, "cache line size should be known for this code"); // Minimum count when BIS zeroing can be used since // it needs membar which is expensive. int block_zero_size = MAX2(cache_line_size*3, (int)BlockZeroingLowLimit);
--- a/src/cpu/sparc/vm/vm_version_sparc.cpp Wed Jan 25 09:56:19 2017 -0800 +++ b/src/cpu/sparc/vm/vm_version_sparc.cpp Tue Jan 31 16:31:09 2017 +0300 @@ -74,7 +74,7 @@ AllocatePrefetchDistance = AllocatePrefetchStepSize; } - if (AllocatePrefetchStyle == 3 && (!has_blk_init() || cache_line_size <= 0)) { + if (AllocatePrefetchStyle == 3 && !has_blk_init()) { warning("BIS instructions are not available on this CPU"); FLAG_SET_DEFAULT(AllocatePrefetchStyle, 1); } @@ -138,7 +138,7 @@ FLAG_SET_DEFAULT(InteriorEntryAlignment, 4); } if (is_niagara_plus()) { - if (has_blk_init() && (cache_line_size > 0) && UseTLAB && + if (has_blk_init() && UseTLAB && FLAG_IS_DEFAULT(AllocatePrefetchInstr)) { // Use BIS instruction for TLAB allocation prefetch. FLAG_SET_ERGO(intx, AllocatePrefetchInstr, 1);
--- a/src/os/linux/vm/globals_linux.hpp Wed Jan 25 09:56:19 2017 -0800 +++ b/src/os/linux/vm/globals_linux.hpp Tue Jan 31 16:31:09 2017 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,10 +47,7 @@ "Load DLLs with executable-stack attribute in the VM Thread") \ \ product(bool, UseSHM, false, \ - "Use SYSV shared memory for large pages") \ - \ - diagnostic(bool, PrintActiveCpus, false, \ - "Print the number of CPUs detected in os::active_processor_count") + "Use SYSV shared memory for large pages") // // Defines Linux-specific default values. The flags are available on all
--- a/src/os/linux/vm/os_linux.cpp Wed Jan 25 09:56:19 2017 -0800 +++ b/src/os/linux/vm/os_linux.cpp Tue Jan 31 16:31:09 2017 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,14 +104,6 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC -#ifndef _GNU_SOURCE - #define _GNU_SOURCE - #include <sched.h> - #undef _GNU_SOURCE -#else - #include <sched.h> -#endif - // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling // getrusage() is prepared to handle the associated failure. #ifndef RUSAGE_THREAD @@ -5024,42 +5016,12 @@ } }; -static int os_cpu_count(const cpu_set_t* cpus) { - int count = 0; - // only look up to the number of configured processors - for (int i = 0; i < os::processor_count(); i++) { - if (CPU_ISSET(i, cpus)) { - count++; - } - } - return count; -} - -// Get the current number of available processors for this process. -// This value can change at any time during a process's lifetime. -// sched_getaffinity gives an accurate answer as it accounts for cpusets. -// If anything goes wrong we fallback to returning the number of online -// processors - which can be greater than the number available to the process. int os::active_processor_count() { - cpu_set_t cpus; // can represent at most 1024 (CPU_SETSIZE) processors - int cpus_size = sizeof(cpu_set_t); - int cpu_count = 0; - - // pid 0 means the current thread - which we have to assume represents the process - if (sched_getaffinity(0, cpus_size, &cpus) == 0) { - cpu_count = os_cpu_count(&cpus); - if (PrintActiveCpus) { - tty->print_cr("active_processor_count: sched_getaffinity processor count: %d", cpu_count); - } - } - else { - cpu_count = ::sysconf(_SC_NPROCESSORS_ONLN); - warning("sched_getaffinity failed (%s)- using online processor count (%d) " - "which may exceed available processors", strerror(errno), cpu_count); - } - - assert(cpu_count > 0 && cpu_count <= processor_count(), "sanity check"); - return cpu_count; + // Linux doesn't yet have a (official) notion of processor sets, + // so just return the number of online processors. + int online_cpus = ::sysconf(_SC_NPROCESSORS_ONLN); + assert(online_cpus > 0 && online_cpus <= processor_count(), "sanity check"); + return online_cpus; } void os::set_native_thread_name(const char *name) {
--- a/src/share/vm/opto/cfgnode.hpp Wed Jan 25 09:56:19 2017 -0800 +++ b/src/share/vm/opto/cfgnode.hpp Tue Jan 31 16:31:09 2017 +0300 @@ -119,9 +119,6 @@ // input in slot 0. class PhiNode : public TypeNode { const TypePtr* const _adr_type; // non-null only for Type::MEMORY nodes. - // The following fields are only used for data PhiNodes to indicate - // that the PhiNode represents the value of a known instance field. - int _inst_mem_id; // Instance memory id (node index of the memory Phi) const int _inst_id; // Instance id of the memory slice. const int _inst_index; // Alias index of the instance memory slice. // Array elements references have the same alias_idx but different offset. @@ -141,13 +138,11 @@ }; PhiNode( Node *r, const Type *t, const TypePtr* at = NULL, - const int imid = -1, const int iid = TypeOopPtr::InstanceTop, const int iidx = Compile::AliasIdxTop, const int ioffs = Type::OffsetTop ) : TypeNode(t,r->req()), _adr_type(at), - _inst_mem_id(imid), _inst_id(iid), _inst_index(iidx), _inst_offset(ioffs) @@ -192,14 +187,11 @@ virtual bool pinned() const { return in(0) != 0; } virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; } - void set_inst_mem_id(int inst_mem_id) { _inst_mem_id = inst_mem_id; } - const int inst_mem_id() const { return _inst_mem_id; } const int inst_id() const { return _inst_id; } const int inst_index() const { return _inst_index; } const int inst_offset() const { return _inst_offset; } - bool is_same_inst_field(const Type* tp, int mem_id, int id, int index, int offset) { + bool is_same_inst_field(const Type* tp, int id, int index, int offset) { return type()->basic_type() == tp->basic_type() && - inst_mem_id() == mem_id && inst_id() == id && inst_index() == index && inst_offset() == offset &&
--- a/src/share/vm/opto/macro.cpp Wed Jan 25 09:56:19 2017 -0800 +++ b/src/share/vm/opto/macro.cpp Tue Jan 31 16:31:09 2017 +0300 @@ -401,7 +401,7 @@ for (DUIterator_Fast kmax, k = region->fast_outs(kmax); k < kmax; k++) { Node* phi = region->fast_out(k); if (phi->is_Phi() && phi != mem && - phi->as_Phi()->is_same_inst_field(phi_type, (int)mem->_idx, instance_id, alias_idx, offset)) { + phi->as_Phi()->is_same_inst_field(phi_type, instance_id, alias_idx, offset)) { return phi; } } @@ -420,7 +420,7 @@ GrowableArray <Node *> values(length, length, NULL, false); // create a new Phi for the value - PhiNode *phi = new (C) PhiNode(mem->in(0), phi_type, NULL, mem->_idx, instance_id, alias_idx, offset); + PhiNode *phi = new (C) PhiNode(mem->in(0), phi_type, NULL, instance_id, alias_idx, offset); transform_later(phi); value_phis->push(phi, mem->_idx);
--- a/src/share/vm/opto/memnode.cpp Wed Jan 25 09:56:19 2017 -0800 +++ b/src/share/vm/opto/memnode.cpp Tue Jan 31 16:31:09 2017 +0300 @@ -1155,7 +1155,7 @@ for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) { Node* phi = region->fast_out(i); if (phi->is_Phi() && phi != mem && - phi->as_Phi()->is_same_inst_field(this_type, (int)mem->_idx, this_iid, this_index, this_offset)) { + phi->as_Phi()->is_same_inst_field(this_type, this_iid, this_index, this_offset)) { return phi; } } @@ -1400,7 +1400,7 @@ this_iid = base->_idx; } PhaseIterGVN* igvn = phase->is_IterGVN(); - Node* phi = new (C) PhiNode(region, this_type, NULL, mem->_idx, this_iid, this_index, this_offset); + Node* phi = new (C) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset); for (uint i = 1; i < region->req(); i++) { Node* x; Node* the_clone = NULL;
--- a/src/share/vm/opto/phaseX.cpp Wed Jan 25 09:56:19 2017 -0800 +++ b/src/share/vm/opto/phaseX.cpp Tue Jan 31 16:31:09 2017 +0300 @@ -481,8 +481,6 @@ uint current_idx = 0; // The current new node ID. Incremented after every assignment. for (uint i = 0; i < _useful.size(); i++) { Node* n = _useful.at(i); - // Sanity check that fails if we ever decide to execute this phase after EA - assert(!n->is_Phi() || n->as_Phi()->inst_mem_id() == -1, "should not be linked to data Phi"); const Type* type = gvn->type_or_null(n); new_type_array.map(current_idx, type); @@ -1380,18 +1378,6 @@ i -= num_edges; // we deleted 1 or more copies of this edge } - // Search for instance field data PhiNodes in the same region pointing to the old - // memory PhiNode and update their instance memory ids to point to the new node. - if (old->is_Phi() && old->as_Phi()->type()->has_memory() && old->in(0) != NULL) { - Node* region = old->in(0); - for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) { - PhiNode* phi = region->fast_out(i)->isa_Phi(); - if (phi != NULL && phi->inst_mem_id() == (int)old->_idx) { - phi->set_inst_mem_id((int)nn->_idx); - } - } - } - // Smash all inputs to 'old', isolating him completely Node *temp = new (C) Node(1); temp->init_req(0,nn); // Add a use to nn to prevent him from dying
--- a/src/share/vm/opto/type.hpp Wed Jan 25 09:56:19 2017 -0800 +++ b/src/share/vm/opto/type.hpp Tue Jan 31 16:31:09 2017 +0300 @@ -882,7 +882,7 @@ // If not InstanceTop or InstanceBot, indicates that this is // a particular instance of this type which is distinct. - // This is the node index of the allocation node creating this instance. + // This is the the node index of the allocation node creating this instance. int _instance_id; // Extra type information profiling gave us. We propagate it the
--- a/test/runtime/os/AvailableProcessors.java Wed Jan 25 09:56:19 2017 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -import java.io.File; -import com.oracle.java.testlibrary.ProcessTools; -import com.oracle.java.testlibrary.OutputAnalyzer; -import java.util.ArrayList; - -/* - * @test - * @bug 6515172 - * @summary Check that availableProcessors reports the correct value when running in a cpuset on linux - * @requires os.family == "linux" - * @library /testlibrary - * @build com.oracle.java.testlibrary.* - * @run driver AvailableProcessors - */ -public class AvailableProcessors { - - static final String SUCCESS_STRING = "Found expected processors: "; - - public static void main(String[] args) throws Throwable { - if (args.length > 0) - checkProcessors(Integer.parseInt(args[0])); - else { - // run ourselves under different cpu configurations - // using the taskset command - String taskset; - final String taskset1 = "/bin/taskset"; - final String taskset2 = "/usr/bin/taskset"; - if (new File(taskset1).exists()) - taskset = taskset1; - else if (new File(taskset2).exists()) - taskset = taskset2; - else { - System.out.println("Skipping test: could not find taskset command"); - return; - } - - int available = Runtime.getRuntime().availableProcessors(); - - if (available == 1) { - System.out.println("Skipping test: only one processor available"); - return; - } - - // Get the java command we want to execute - // Enable logging for easier failure diagnosis - ProcessBuilder master = - ProcessTools.createJavaProcessBuilder(false, - "-XX:+UnlockDiagnosticVMOptions", - "-XX:+PrintActiveCpus", - "AvailableProcessors"); - - int[] expected = new int[] { 1, available/2, available-1, available }; - - for (int i : expected) { - System.out.println("Testing for " + i + " processors ..."); - int max = i - 1; - ArrayList<String> cmdline = new ArrayList<>(master.command()); - // prepend taskset command - cmdline.add(0, "0-" + max); - cmdline.add(0, "-c"); - cmdline.add(0, taskset); - // append expected processor count - cmdline.add(String.valueOf(i)); - ProcessBuilder pb = new ProcessBuilder(cmdline); - System.out.println("Final command line: " + - ProcessTools.getCommandLine(pb)); - OutputAnalyzer output = ProcessTools.executeProcess(pb); - output.shouldContain(SUCCESS_STRING); - } - } - } - - static void checkProcessors(int expected) { - int available = Runtime.getRuntime().availableProcessors(); - if (available != expected) - throw new Error("Expected " + expected + " processors, but found " - + available); - else - System.out.println(SUCCESS_STRING + available); - } -}