twisti@1020: /* twisti@1020: * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. twisti@1020: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. twisti@1020: * twisti@1020: * This code is free software; you can redistribute it and/or modify it twisti@1020: * under the terms of the GNU General Public License version 2 only, as twisti@1020: * published by the Free Software Foundation. twisti@1020: * twisti@1020: * This code is distributed in the hope that it will be useful, but WITHOUT twisti@1020: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or twisti@1020: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License twisti@1020: * version 2 for more details (a copy is included in the LICENSE file that twisti@1020: * accompanied this code). twisti@1020: * twisti@1020: * You should have received a copy of the GNU General Public License version twisti@1020: * 2 along with this work; if not, write to the Free Software Foundation, twisti@1020: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. twisti@1020: * twisti@1020: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, twisti@1020: * CA 95054 USA or visit www.sun.com if you need additional information or twisti@1020: * have any questions. twisti@1020: * twisti@1020: */ twisti@1020: twisti@1020: # include "incls/_precompiled.incl" twisti@1020: # include "incls/_vm_version_x86.cpp.incl" twisti@1020: twisti@1020: twisti@1020: int VM_Version::_cpu; twisti@1020: int VM_Version::_model; twisti@1020: int VM_Version::_stepping; twisti@1020: int VM_Version::_cpuFeatures; twisti@1020: const char* VM_Version::_features_str = ""; twisti@1020: VM_Version::CpuidInfo VM_Version::_cpuid_info = { 0, }; twisti@1020: twisti@1020: static BufferBlob* stub_blob; twisti@1020: static const int stub_size = 300; twisti@1020: twisti@1020: extern "C" { twisti@1020: typedef void (*getPsrInfo_stub_t)(void*); twisti@1020: } twisti@1020: static getPsrInfo_stub_t getPsrInfo_stub = NULL; twisti@1020: twisti@1020: twisti@1020: class VM_Version_StubGenerator: public StubCodeGenerator { twisti@1020: public: twisti@1020: twisti@1020: VM_Version_StubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {} twisti@1020: twisti@1020: address generate_getPsrInfo() { twisti@1020: // Flags to test CPU type. twisti@1020: const uint32_t EFL_AC = 0x40000; twisti@1020: const uint32_t EFL_ID = 0x200000; twisti@1020: // Values for when we don't have a CPUID instruction. twisti@1020: const int CPU_FAMILY_SHIFT = 8; twisti@1020: const uint32_t CPU_FAMILY_386 = (3 << CPU_FAMILY_SHIFT); twisti@1020: const uint32_t CPU_FAMILY_486 = (4 << CPU_FAMILY_SHIFT); twisti@1020: twisti@1020: Label detect_486, cpu486, detect_586, std_cpuid1; twisti@1020: Label ext_cpuid1, ext_cpuid5, done; twisti@1020: twisti@1020: StubCodeMark mark(this, "VM_Version", "getPsrInfo_stub"); twisti@1020: # define __ _masm-> twisti@1020: twisti@1020: address start = __ pc(); twisti@1020: twisti@1020: // twisti@1020: // void getPsrInfo(VM_Version::CpuidInfo* cpuid_info); twisti@1020: // twisti@1020: // LP64: rcx and rdx are first and second argument registers on windows twisti@1020: twisti@1020: __ push(rbp); twisti@1020: #ifdef _LP64 twisti@1020: __ mov(rbp, c_rarg0); // cpuid_info address twisti@1020: #else twisti@1020: __ movptr(rbp, Address(rsp, 8)); // cpuid_info address twisti@1020: #endif twisti@1020: __ push(rbx); twisti@1020: __ push(rsi); twisti@1020: __ pushf(); // preserve rbx, and flags twisti@1020: __ pop(rax); twisti@1020: __ push(rax); twisti@1020: __ mov(rcx, rax); twisti@1020: // twisti@1020: // if we are unable to change the AC flag, we have a 386 twisti@1020: // twisti@1020: __ xorl(rax, EFL_AC); twisti@1020: __ push(rax); twisti@1020: __ popf(); twisti@1020: __ pushf(); twisti@1020: __ pop(rax); twisti@1020: __ cmpptr(rax, rcx); twisti@1020: __ jccb(Assembler::notEqual, detect_486); twisti@1020: twisti@1020: __ movl(rax, CPU_FAMILY_386); twisti@1020: __ movl(Address(rbp, in_bytes(VM_Version::std_cpuid1_offset())), rax); twisti@1020: __ jmp(done); twisti@1020: twisti@1020: // twisti@1020: // If we are unable to change the ID flag, we have a 486 which does twisti@1020: // not support the "cpuid" instruction. twisti@1020: // twisti@1020: __ bind(detect_486); twisti@1020: __ mov(rax, rcx); twisti@1020: __ xorl(rax, EFL_ID); twisti@1020: __ push(rax); twisti@1020: __ popf(); twisti@1020: __ pushf(); twisti@1020: __ pop(rax); twisti@1020: __ cmpptr(rcx, rax); twisti@1020: __ jccb(Assembler::notEqual, detect_586); twisti@1020: twisti@1020: __ bind(cpu486); twisti@1020: __ movl(rax, CPU_FAMILY_486); twisti@1020: __ movl(Address(rbp, in_bytes(VM_Version::std_cpuid1_offset())), rax); twisti@1020: __ jmp(done); twisti@1020: twisti@1020: // twisti@1020: // At this point, we have a chip which supports the "cpuid" instruction twisti@1020: // twisti@1020: __ bind(detect_586); twisti@1020: __ xorl(rax, rax); twisti@1020: __ cpuid(); twisti@1020: __ orl(rax, rax); twisti@1020: __ jcc(Assembler::equal, cpu486); // if cpuid doesn't support an input twisti@1020: // value of at least 1, we give up and twisti@1020: // assume a 486 twisti@1020: __ lea(rsi, Address(rbp, in_bytes(VM_Version::std_cpuid0_offset()))); twisti@1020: __ movl(Address(rsi, 0), rax); twisti@1020: __ movl(Address(rsi, 4), rbx); twisti@1020: __ movl(Address(rsi, 8), rcx); twisti@1020: __ movl(Address(rsi,12), rdx); twisti@1020: twisti@1020: __ cmpl(rax, 3); // Is cpuid(0x4) supported? twisti@1020: __ jccb(Assembler::belowEqual, std_cpuid1); twisti@1020: twisti@1020: // twisti@1020: // cpuid(0x4) Deterministic cache params twisti@1020: // twisti@1020: __ movl(rax, 4); twisti@1020: __ xorl(rcx, rcx); // L1 cache twisti@1020: __ cpuid(); twisti@1020: __ push(rax); twisti@1020: __ andl(rax, 0x1f); // Determine if valid cache parameters used twisti@1020: __ orl(rax, rax); // eax[4:0] == 0 indicates invalid cache twisti@1020: __ pop(rax); twisti@1020: __ jccb(Assembler::equal, std_cpuid1); twisti@1020: twisti@1020: __ lea(rsi, Address(rbp, in_bytes(VM_Version::dcp_cpuid4_offset()))); twisti@1020: __ movl(Address(rsi, 0), rax); twisti@1020: __ movl(Address(rsi, 4), rbx); twisti@1020: __ movl(Address(rsi, 8), rcx); twisti@1020: __ movl(Address(rsi,12), rdx); twisti@1020: twisti@1020: // twisti@1020: // Standard cpuid(0x1) twisti@1020: // twisti@1020: __ bind(std_cpuid1); twisti@1020: __ movl(rax, 1); twisti@1020: __ cpuid(); twisti@1020: __ lea(rsi, Address(rbp, in_bytes(VM_Version::std_cpuid1_offset()))); twisti@1020: __ movl(Address(rsi, 0), rax); twisti@1020: __ movl(Address(rsi, 4), rbx); twisti@1020: __ movl(Address(rsi, 8), rcx); twisti@1020: __ movl(Address(rsi,12), rdx); twisti@1020: twisti@1020: __ movl(rax, 0x80000000); twisti@1020: __ cpuid(); twisti@1020: __ cmpl(rax, 0x80000000); // Is cpuid(0x80000001) supported? twisti@1020: __ jcc(Assembler::belowEqual, done); twisti@1020: __ cmpl(rax, 0x80000004); // Is cpuid(0x80000005) supported? twisti@1020: __ jccb(Assembler::belowEqual, ext_cpuid1); twisti@1020: __ cmpl(rax, 0x80000007); // Is cpuid(0x80000008) supported? twisti@1020: __ jccb(Assembler::belowEqual, ext_cpuid5); twisti@1020: // twisti@1020: // Extended cpuid(0x80000008) twisti@1020: // twisti@1020: __ movl(rax, 0x80000008); twisti@1020: __ cpuid(); twisti@1020: __ lea(rsi, Address(rbp, in_bytes(VM_Version::ext_cpuid8_offset()))); twisti@1020: __ movl(Address(rsi, 0), rax); twisti@1020: __ movl(Address(rsi, 4), rbx); twisti@1020: __ movl(Address(rsi, 8), rcx); twisti@1020: __ movl(Address(rsi,12), rdx); twisti@1020: twisti@1020: // twisti@1020: // Extended cpuid(0x80000005) twisti@1020: // twisti@1020: __ bind(ext_cpuid5); twisti@1020: __ movl(rax, 0x80000005); twisti@1020: __ cpuid(); twisti@1020: __ lea(rsi, Address(rbp, in_bytes(VM_Version::ext_cpuid5_offset()))); twisti@1020: __ movl(Address(rsi, 0), rax); twisti@1020: __ movl(Address(rsi, 4), rbx); twisti@1020: __ movl(Address(rsi, 8), rcx); twisti@1020: __ movl(Address(rsi,12), rdx); twisti@1020: twisti@1020: // twisti@1020: // Extended cpuid(0x80000001) twisti@1020: // twisti@1020: __ bind(ext_cpuid1); twisti@1020: __ movl(rax, 0x80000001); twisti@1020: __ cpuid(); twisti@1020: __ lea(rsi, Address(rbp, in_bytes(VM_Version::ext_cpuid1_offset()))); twisti@1020: __ movl(Address(rsi, 0), rax); twisti@1020: __ movl(Address(rsi, 4), rbx); twisti@1020: __ movl(Address(rsi, 8), rcx); twisti@1020: __ movl(Address(rsi,12), rdx); twisti@1020: twisti@1020: // twisti@1020: // return twisti@1020: // twisti@1020: __ bind(done); twisti@1020: __ popf(); twisti@1020: __ pop(rsi); twisti@1020: __ pop(rbx); twisti@1020: __ pop(rbp); twisti@1020: __ ret(0); twisti@1020: twisti@1020: # undef __ twisti@1020: twisti@1020: return start; twisti@1020: }; twisti@1020: }; twisti@1020: twisti@1020: twisti@1020: void VM_Version::get_processor_features() { twisti@1020: twisti@1020: _cpu = 4; // 486 by default twisti@1020: _model = 0; twisti@1020: _stepping = 0; twisti@1020: _cpuFeatures = 0; twisti@1020: _logical_processors_per_package = 1; twisti@1020: twisti@1020: if (!Use486InstrsOnly) { twisti@1020: // Get raw processor info twisti@1020: getPsrInfo_stub(&_cpuid_info); twisti@1020: assert_is_initialized(); twisti@1020: _cpu = extended_cpu_family(); twisti@1020: _model = extended_cpu_model(); twisti@1020: _stepping = cpu_stepping(); twisti@1020: twisti@1020: if (cpu_family() > 4) { // it supports CPUID twisti@1020: _cpuFeatures = feature_flags(); twisti@1020: // Logical processors are only available on P4s and above, twisti@1020: // and only if hyperthreading is available. twisti@1020: _logical_processors_per_package = logical_processor_count(); twisti@1020: } twisti@1020: } twisti@1020: twisti@1020: _supports_cx8 = supports_cmpxchg8(); twisti@1020: twisti@1020: #ifdef _LP64 twisti@1020: // OS should support SSE for x64 and hardware should support at least SSE2. twisti@1020: if (!VM_Version::supports_sse2()) { twisti@1020: vm_exit_during_initialization("Unknown x64 processor: SSE2 not supported"); twisti@1020: } roland@1495: // in 64 bit the use of SSE2 is the minimum roland@1495: if (UseSSE < 2) UseSSE = 2; twisti@1020: #endif twisti@1020: twisti@1020: // If the OS doesn't support SSE, we can't use this feature even if the HW does twisti@1020: if (!os::supports_sse()) twisti@1020: _cpuFeatures &= ~(CPU_SSE|CPU_SSE2|CPU_SSE3|CPU_SSSE3|CPU_SSE4A|CPU_SSE4_1|CPU_SSE4_2); twisti@1020: twisti@1020: if (UseSSE < 4) { twisti@1020: _cpuFeatures &= ~CPU_SSE4_1; twisti@1020: _cpuFeatures &= ~CPU_SSE4_2; twisti@1020: } twisti@1020: twisti@1020: if (UseSSE < 3) { twisti@1020: _cpuFeatures &= ~CPU_SSE3; twisti@1020: _cpuFeatures &= ~CPU_SSSE3; twisti@1020: _cpuFeatures &= ~CPU_SSE4A; twisti@1020: } twisti@1020: twisti@1020: if (UseSSE < 2) twisti@1020: _cpuFeatures &= ~CPU_SSE2; twisti@1020: twisti@1020: if (UseSSE < 1) twisti@1020: _cpuFeatures &= ~CPU_SSE; twisti@1020: twisti@1020: if (logical_processors_per_package() == 1) { twisti@1020: // HT processor could be installed on a system which doesn't support HT. twisti@1020: _cpuFeatures &= ~CPU_HT; twisti@1020: } twisti@1020: twisti@1020: char buf[256]; twisti@1210: jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", twisti@1020: cores_per_cpu(), threads_per_core(), twisti@1020: cpu_family(), _model, _stepping, twisti@1020: (supports_cmov() ? ", cmov" : ""), twisti@1020: (supports_cmpxchg8() ? ", cx8" : ""), twisti@1020: (supports_fxsr() ? ", fxsr" : ""), twisti@1020: (supports_mmx() ? ", mmx" : ""), twisti@1020: (supports_sse() ? ", sse" : ""), twisti@1020: (supports_sse2() ? ", sse2" : ""), twisti@1020: (supports_sse3() ? ", sse3" : ""), twisti@1020: (supports_ssse3()? ", ssse3": ""), twisti@1020: (supports_sse4_1() ? ", sse4.1" : ""), twisti@1020: (supports_sse4_2() ? ", sse4.2" : ""), twisti@1078: (supports_popcnt() ? ", popcnt" : ""), twisti@1020: (supports_mmx_ext() ? ", mmxext" : ""), twisti@1020: (supports_3dnow() ? ", 3dnow" : ""), twisti@1020: (supports_3dnow2() ? ", 3dnowext" : ""), twisti@1210: (supports_lzcnt() ? ", lzcnt": ""), twisti@1020: (supports_sse4a() ? ", sse4a": ""), twisti@1020: (supports_ht() ? ", ht": "")); twisti@1020: _features_str = strdup(buf); twisti@1020: twisti@1020: // UseSSE is set to the smaller of what hardware supports and what twisti@1020: // the command line requires. I.e., you cannot set UseSSE to 2 on twisti@1020: // older Pentiums which do not support it. twisti@1020: if( UseSSE > 4 ) UseSSE=4; twisti@1020: if( UseSSE < 0 ) UseSSE=0; twisti@1020: if( !supports_sse4_1() ) // Drop to 3 if no SSE4 support twisti@1020: UseSSE = MIN2((intx)3,UseSSE); twisti@1020: if( !supports_sse3() ) // Drop to 2 if no SSE3 support twisti@1020: UseSSE = MIN2((intx)2,UseSSE); twisti@1020: if( !supports_sse2() ) // Drop to 1 if no SSE2 support twisti@1020: UseSSE = MIN2((intx)1,UseSSE); twisti@1020: if( !supports_sse () ) // Drop to 0 if no SSE support twisti@1020: UseSSE = 0; twisti@1020: twisti@1020: // On new cpus instructions which update whole XMM register should be used twisti@1020: // to prevent partial register stall due to dependencies on high half. twisti@1020: // twisti@1020: // UseXmmLoadAndClearUpper == true --> movsd(xmm, mem) twisti@1020: // UseXmmLoadAndClearUpper == false --> movlpd(xmm, mem) twisti@1020: // UseXmmRegToRegMoveAll == true --> movaps(xmm, xmm), movapd(xmm, xmm). twisti@1020: // UseXmmRegToRegMoveAll == false --> movss(xmm, xmm), movsd(xmm, xmm). twisti@1020: twisti@1020: if( is_amd() ) { // AMD cpus specific settings twisti@1020: if( supports_sse2() && FLAG_IS_DEFAULT(UseAddressNop) ) { twisti@1020: // Use it on new AMD cpus starting from Opteron. twisti@1020: UseAddressNop = true; twisti@1020: } twisti@1020: if( supports_sse2() && FLAG_IS_DEFAULT(UseNewLongLShift) ) { twisti@1020: // Use it on new AMD cpus starting from Opteron. twisti@1020: UseNewLongLShift = true; twisti@1020: } twisti@1020: if( FLAG_IS_DEFAULT(UseXmmLoadAndClearUpper) ) { twisti@1020: if( supports_sse4a() ) { twisti@1020: UseXmmLoadAndClearUpper = true; // use movsd only on '10h' Opteron twisti@1020: } else { twisti@1020: UseXmmLoadAndClearUpper = false; twisti@1020: } twisti@1020: } twisti@1020: if( FLAG_IS_DEFAULT(UseXmmRegToRegMoveAll) ) { twisti@1020: if( supports_sse4a() ) { twisti@1020: UseXmmRegToRegMoveAll = true; // use movaps, movapd only on '10h' twisti@1020: } else { twisti@1020: UseXmmRegToRegMoveAll = false; twisti@1020: } twisti@1020: } twisti@1020: if( FLAG_IS_DEFAULT(UseXmmI2F) ) { twisti@1020: if( supports_sse4a() ) { twisti@1020: UseXmmI2F = true; twisti@1020: } else { twisti@1020: UseXmmI2F = false; twisti@1020: } twisti@1020: } twisti@1020: if( FLAG_IS_DEFAULT(UseXmmI2D) ) { twisti@1020: if( supports_sse4a() ) { twisti@1020: UseXmmI2D = true; twisti@1020: } else { twisti@1020: UseXmmI2D = false; twisti@1020: } twisti@1020: } twisti@1210: twisti@1210: // Use count leading zeros count instruction if available. twisti@1210: if (supports_lzcnt()) { twisti@1210: if (FLAG_IS_DEFAULT(UseCountLeadingZerosInstruction)) { twisti@1210: UseCountLeadingZerosInstruction = true; twisti@1210: } twisti@1210: } twisti@1020: } twisti@1020: twisti@1020: if( is_intel() ) { // Intel cpus specific settings twisti@1020: if( FLAG_IS_DEFAULT(UseStoreImmI16) ) { twisti@1020: UseStoreImmI16 = false; // don't use it on Intel cpus twisti@1020: } twisti@1020: if( cpu_family() == 6 || cpu_family() == 15 ) { twisti@1020: if( FLAG_IS_DEFAULT(UseAddressNop) ) { twisti@1020: // Use it on all Intel cpus starting from PentiumPro twisti@1020: UseAddressNop = true; twisti@1020: } twisti@1020: } twisti@1020: if( FLAG_IS_DEFAULT(UseXmmLoadAndClearUpper) ) { twisti@1020: UseXmmLoadAndClearUpper = true; // use movsd on all Intel cpus twisti@1020: } twisti@1020: if( FLAG_IS_DEFAULT(UseXmmRegToRegMoveAll) ) { twisti@1020: if( supports_sse3() ) { twisti@1020: UseXmmRegToRegMoveAll = true; // use movaps, movapd on new Intel cpus twisti@1020: } else { twisti@1020: UseXmmRegToRegMoveAll = false; twisti@1020: } twisti@1020: } twisti@1020: if( cpu_family() == 6 && supports_sse3() ) { // New Intel cpus twisti@1020: #ifdef COMPILER2 twisti@1020: if( FLAG_IS_DEFAULT(MaxLoopPad) ) { twisti@1020: // For new Intel cpus do the next optimization: twisti@1020: // don't align the beginning of a loop if there are enough instructions twisti@1020: // left (NumberOfLoopInstrToAlign defined in c2_globals.hpp) twisti@1020: // in current fetch line (OptoLoopAlignment) or the padding twisti@1020: // is big (> MaxLoopPad). twisti@1020: // Set MaxLoopPad to 11 for new Intel cpus to reduce number of twisti@1020: // generated NOP instructions. 11 is the largest size of one twisti@1020: // address NOP instruction '0F 1F' (see Assembler::nop(i)). twisti@1020: MaxLoopPad = 11; twisti@1020: } twisti@1020: #endif // COMPILER2 twisti@1020: if( FLAG_IS_DEFAULT(UseXMMForArrayCopy) ) { twisti@1020: UseXMMForArrayCopy = true; // use SSE2 movq on new Intel cpus twisti@1020: } twisti@1020: if( supports_sse4_2() && supports_ht() ) { // Newest Intel cpus twisti@1020: if( FLAG_IS_DEFAULT(UseUnalignedLoadStores) && UseXMMForArrayCopy ) { twisti@1020: UseUnalignedLoadStores = true; // use movdqu on newest Intel cpus twisti@1020: } twisti@1020: } cfang@1116: if( supports_sse4_2() && UseSSE >= 4 ) { cfang@1116: if( FLAG_IS_DEFAULT(UseSSE42Intrinsics)) { cfang@1116: UseSSE42Intrinsics = true; cfang@1116: } cfang@1116: } twisti@1020: } twisti@1020: } twisti@1020: twisti@1078: // Use population count instruction if available. twisti@1078: if (supports_popcnt()) { twisti@1078: if (FLAG_IS_DEFAULT(UsePopCountInstruction)) { twisti@1078: UsePopCountInstruction = true; twisti@1078: } twisti@1078: } twisti@1078: twisti@1020: assert(0 <= ReadPrefetchInstr && ReadPrefetchInstr <= 3, "invalid value"); twisti@1020: assert(0 <= AllocatePrefetchInstr && AllocatePrefetchInstr <= 3, "invalid value"); twisti@1020: twisti@1020: // set valid Prefetch instruction twisti@1020: if( ReadPrefetchInstr < 0 ) ReadPrefetchInstr = 0; twisti@1020: if( ReadPrefetchInstr > 3 ) ReadPrefetchInstr = 3; twisti@1020: if( ReadPrefetchInstr == 3 && !supports_3dnow() ) ReadPrefetchInstr = 0; twisti@1020: if( !supports_sse() && supports_3dnow() ) ReadPrefetchInstr = 3; twisti@1020: twisti@1020: if( AllocatePrefetchInstr < 0 ) AllocatePrefetchInstr = 0; twisti@1020: if( AllocatePrefetchInstr > 3 ) AllocatePrefetchInstr = 3; twisti@1020: if( AllocatePrefetchInstr == 3 && !supports_3dnow() ) AllocatePrefetchInstr=0; twisti@1020: if( !supports_sse() && supports_3dnow() ) AllocatePrefetchInstr = 3; twisti@1020: twisti@1020: // Allocation prefetch settings twisti@1020: intx cache_line_size = L1_data_cache_line_size(); twisti@1020: if( cache_line_size > AllocatePrefetchStepSize ) twisti@1020: AllocatePrefetchStepSize = cache_line_size; twisti@1020: if( FLAG_IS_DEFAULT(AllocatePrefetchLines) ) twisti@1020: AllocatePrefetchLines = 3; // Optimistic value twisti@1020: assert(AllocatePrefetchLines > 0, "invalid value"); twisti@1020: if( AllocatePrefetchLines < 1 ) // set valid value in product VM twisti@1020: AllocatePrefetchLines = 1; // Conservative value twisti@1020: twisti@1020: AllocatePrefetchDistance = allocate_prefetch_distance(); twisti@1020: AllocatePrefetchStyle = allocate_prefetch_style(); twisti@1020: twisti@1020: if( AllocatePrefetchStyle == 2 && is_intel() && twisti@1020: cpu_family() == 6 && supports_sse3() ) { // watermark prefetching on Core twisti@1020: #ifdef _LP64 twisti@1020: AllocatePrefetchDistance = 384; twisti@1020: #else twisti@1020: AllocatePrefetchDistance = 320; twisti@1020: #endif twisti@1020: } twisti@1020: assert(AllocatePrefetchDistance % AllocatePrefetchStepSize == 0, "invalid value"); twisti@1020: twisti@1020: #ifdef _LP64 twisti@1020: // Prefetch settings twisti@1020: PrefetchCopyIntervalInBytes = prefetch_copy_interval_in_bytes(); twisti@1020: PrefetchScanIntervalInBytes = prefetch_scan_interval_in_bytes(); twisti@1020: PrefetchFieldsAhead = prefetch_fields_ahead(); twisti@1020: #endif twisti@1020: twisti@1020: #ifndef PRODUCT twisti@1020: if (PrintMiscellaneous && Verbose) { twisti@1020: tty->print_cr("Logical CPUs per core: %u", twisti@1020: logical_processors_per_package()); twisti@1020: tty->print_cr("UseSSE=%d",UseSSE); twisti@1020: tty->print("Allocation: "); twisti@1020: if (AllocatePrefetchStyle <= 0 || UseSSE == 0 && !supports_3dnow()) { twisti@1020: tty->print_cr("no prefetching"); twisti@1020: } else { twisti@1020: if (UseSSE == 0 && supports_3dnow()) { twisti@1020: tty->print("PREFETCHW"); twisti@1020: } else if (UseSSE >= 1) { twisti@1020: if (AllocatePrefetchInstr == 0) { twisti@1020: tty->print("PREFETCHNTA"); twisti@1020: } else if (AllocatePrefetchInstr == 1) { twisti@1020: tty->print("PREFETCHT0"); twisti@1020: } else if (AllocatePrefetchInstr == 2) { twisti@1020: tty->print("PREFETCHT2"); twisti@1020: } else if (AllocatePrefetchInstr == 3) { twisti@1020: tty->print("PREFETCHW"); twisti@1020: } twisti@1020: } twisti@1020: if (AllocatePrefetchLines > 1) { twisti@1020: tty->print_cr(" %d, %d lines with step %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize); twisti@1020: } else { twisti@1020: tty->print_cr(" %d, one line", AllocatePrefetchDistance); twisti@1020: } twisti@1020: } twisti@1020: twisti@1020: if (PrefetchCopyIntervalInBytes > 0) { twisti@1020: tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes); twisti@1020: } twisti@1020: if (PrefetchScanIntervalInBytes > 0) { twisti@1020: tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes); twisti@1020: } twisti@1020: if (PrefetchFieldsAhead > 0) { twisti@1020: tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead); twisti@1020: } twisti@1020: } twisti@1020: #endif // !PRODUCT twisti@1020: } twisti@1020: twisti@1020: void VM_Version::initialize() { twisti@1020: ResourceMark rm; twisti@1020: // Making this stub must be FIRST use of assembler twisti@1020: twisti@1020: stub_blob = BufferBlob::create("getPsrInfo_stub", stub_size); twisti@1020: if (stub_blob == NULL) { twisti@1020: vm_exit_during_initialization("Unable to allocate getPsrInfo_stub"); twisti@1020: } twisti@1020: CodeBuffer c(stub_blob->instructions_begin(), twisti@1020: stub_blob->instructions_size()); twisti@1020: VM_Version_StubGenerator g(&c); twisti@1020: getPsrInfo_stub = CAST_TO_FN_PTR(getPsrInfo_stub_t, twisti@1020: g.generate_getPsrInfo()); twisti@1020: twisti@1020: get_processor_features(); twisti@1020: }