0N/A/*
2273N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_RUNTIME_VM_VERSION_HPP
1879N/A#define SHARE_VM_RUNTIME_VM_VERSION_HPP
1879N/A
1879N/A#include "memory/allocation.hpp"
1879N/A#include "utilities/ostream.hpp"
1879N/A
0N/A// VM_Version provides information about the VM.
0N/A
0N/Aclass Abstract_VM_Version: AllStatic {
0N/A protected:
0N/A friend class VMStructs;
0N/A static const char* _s_vm_release;
0N/A static const char* _s_internal_vm_info_string;
0N/A // These are set by machine-dependent initializations
0N/A static bool _supports_cx8;
4015N/A static bool _supports_atomic_getset4;
4015N/A static bool _supports_atomic_getset8;
4015N/A static bool _supports_atomic_getadd4;
4015N/A static bool _supports_atomic_getadd8;
0N/A static unsigned int _logical_processors_per_package;
0N/A static int _vm_major_version;
0N/A static int _vm_minor_version;
0N/A static int _vm_build_number;
0N/A static bool _initialized;
10N/A static int _parallel_worker_threads;
10N/A static bool _parallel_worker_threads_initialized;
2679N/A static int _reserve_for_allocation_prefetch;
10N/A
10N/A static unsigned int nof_parallel_worker_threads(unsigned int num,
10N/A unsigned int dem,
10N/A unsigned int switch_pt);
0N/A public:
0N/A static void initialize();
0N/A
0N/A // Name
0N/A static const char* vm_name();
0N/A // Vendor
0N/A static const char* vm_vendor();
0N/A // VM version information string printed by launcher (java -version)
0N/A static const char* vm_info_string();
0N/A static const char* vm_release();
0N/A static const char* vm_platform_string();
2080N/A static const char* vm_build_user();
0N/A
0N/A static int vm_major_version() { assert(_initialized, "not initialized"); return _vm_major_version; }
0N/A static int vm_minor_version() { assert(_initialized, "not initialized"); return _vm_minor_version; }
0N/A static int vm_build_number() { assert(_initialized, "not initialized"); return _vm_build_number; }
0N/A
0N/A // Gets the jvm_version_info.jvm_version defined in jvm.h
0N/A static unsigned int jvm_version();
0N/A
0N/A // Internal version providing additional build information
0N/A static const char* internal_vm_info_string();
3177N/A static const char* jre_release_version();
0N/A
0N/A // does HW support an 8-byte compare-exchange operation?
0N/A static bool supports_cx8() {return _supports_cx8;}
4015N/A // does HW support atomic get-and-set or atomic get-and-add? Used
4015N/A // to guide intrinsification decisions for Unsafe atomic ops
4015N/A static bool supports_atomic_getset4() {return _supports_atomic_getset4;}
4015N/A static bool supports_atomic_getset8() {return _supports_atomic_getset8;}
4015N/A static bool supports_atomic_getadd4() {return _supports_atomic_getadd4;}
4015N/A static bool supports_atomic_getadd8() {return _supports_atomic_getadd8;}
4015N/A
0N/A static unsigned int logical_processors_per_package() {
0N/A return _logical_processors_per_package;
0N/A }
0N/A
2679N/A // Need a space at the end of TLAB for prefetch instructions
2679N/A // which may fault when accessing memory outside of heap.
2679N/A static int reserve_for_allocation_prefetch() {
2679N/A return _reserve_for_allocation_prefetch;
2679N/A }
2679N/A
1601N/A // ARCH specific policy for the BiasedLocking
1601N/A static bool use_biased_locking() { return true; }
1601N/A
0N/A // Number of page sizes efficiently supported by the hardware. Most chips now
0N/A // support two sizes, thus this default implementation. Processor-specific
0N/A // subclasses should define new versions to hide this one as needed. Note
0N/A // that the O/S may support more sizes, but at most this many are used.
0N/A static uint page_size_count() { return 2; }
10N/A
10N/A // Returns the number of parallel threads to be used for VM
10N/A // work. If that number has not been calculated, do so and
10N/A // save it. Returns ParallelGCThreads if it is set on the
10N/A // command line.
10N/A static unsigned int parallel_worker_threads();
10N/A // Calculates and returns the number of parallel threads. May
10N/A // be VM version specific.
10N/A static unsigned int calc_parallel_worker_threads();
0N/A};
1879N/A
1879N/A#endif // SHARE_VM_RUNTIME_VM_VERSION_HPP